<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Dan Miser - .NET</title>
    <link>http://www.distribucon.com/blog/</link>
    <description>Thoughts from Dan Miser</description>
    <language>en-us</language>
    <copyright>Dan Miser</copyright>
    <lastBuildDate>Wed, 24 Feb 2010 04:12:13 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>dmiser@distribucon.com</managingEditor>
    <webMaster>dmiser@distribucon.com</webMaster>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=2f555d4f-9a98-46e3-8aa4-0dbc6a20d135</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,2f555d4f-9a98-46e3-8aa4-0dbc6a20d135.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,2f555d4f-9a98-46e3-8aa4-0dbc6a20d135.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=2f555d4f-9a98-46e3-8aa4-0dbc6a20d135</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I use <a href="http://stackoverflow.com/questions/653514/asp-net-mvc-model-binding-an-ilist-parameter" target="_new">list
binding</a> in my ASP.NET MVC applications in several places. When it works, it is
truly magnificent. When it doesn't, it's just maddening. Here's a quick heads up for
those of you that use list binding in MVC. You would expect the following 2 lines
to render the same HTML, but they don't. To get list binding to work, you need the
HTML to read something like this (I'm just listing the attributes in question here): 
<p /><pre><code> &lt;input name="Results[0].Score" /&gt; </code></pre><p />
The old TextBox helper works fine, since you're assigning the name attribute:<br /><pre><code> Html.TextBox("Results["+id+"].Score", Model.Score) </code></pre><p />
This code, however: <pre><code> Html.TextBoxFor(r =&gt; r.Score, new { name = "Results["
+ id + "].Score" }) </code></pre><p />
produces the following output, which means the Score property won't get bound properly. <pre><code> &lt;input
name="Score" /&gt; </code></pre><p />
The problem is that in the TextBoxFor code, the name attribute is ignored. To be more
precise, the custom name is added, but the attribute is then replaced by the name
derived from the model. <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=2f555d4f-9a98-46e3-8aa4-0dbc6a20d135" /></body>
      <title>ASP.NET MVC list binding differences between TextBox and TextBoxFor</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,2f555d4f-9a98-46e3-8aa4-0dbc6a20d135.aspx</guid>
      <link>http://www.distribucon.com/blog/ASPNETMVCListBindingDifferencesBetweenTextBoxAndTextBoxFor.aspx</link>
      <pubDate>Wed, 24 Feb 2010 04:12:13 GMT</pubDate>
      <description>I use &lt;a href="http://stackoverflow.com/questions/653514/asp-net-mvc-model-binding-an-ilist-parameter" target="_new"&gt;list
binding&lt;/a&gt; in my ASP.NET MVC applications in several places. When it works, it is
truly magnificent. When it doesn't, it's just maddening. Here's a quick heads up for
those of you that use list binding in MVC. You would expect the following 2 lines
to render the same HTML, but they don't. To get list binding to work, you need the
HTML to read something like this (I'm just listing the attributes in question here): 
&lt;p /&gt;
&lt;pre&gt;&lt;code&gt; &amp;lt;input name="Results[0].Score" /&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
The old TextBox helper works fine, since you're assigning the name attribute:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt; Html.TextBox("Results["+id+"].Score", Model.Score) &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
This code, however: &lt;pre&gt;&lt;code&gt; Html.TextBoxFor(r =&amp;gt; r.Score, new { name = "Results["
+ id + "].Score" }) &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
produces the following output, which means the Score property won't get bound properly. &lt;pre&gt;&lt;code&gt; &amp;lt;input
name="Score" /&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
The problem is that in the TextBoxFor code, the name attribute is ignored. To be more
precise, the custom name is added, but the attribute is then replaced by the name
derived from the model. &lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=2f555d4f-9a98-46e3-8aa4-0dbc6a20d135" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,2f555d4f-9a98-46e3-8aa4-0dbc6a20d135.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=e6c300f9-9863-43da-958f-b8bfa4807a9a</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,e6c300f9-9863-43da-958f-b8bfa4807a9a.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,e6c300f9-9863-43da-958f-b8bfa4807a9a.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=e6c300f9-9863-43da-958f-b8bfa4807a9a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I just updated my ASP.NET MVC 1.0 application
to use <a href="http://go.microsoft.com/fwlink/?LinkID=157071" target="_blank">ASP.NET
MVC 2 RC</a>. It was a pretty painless process. Be sure to follow the Release Notes
on the download page, and many applications will be ready to go. Here are some extra
things that might help get you unstuck:<br /><ul><li>
If you're using the ASP.NET MVC Futures (Microsoft.Web.Mvc) assembly, be sure to download
the <a href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=37423" target="_blank">new
one that works with ASP.NET MVC 2</a>.</li><li>
If you're using the Telerik ASP.NET MVC components, be sure to download version BETA
2009.3.1218 or later.</li><li>
Way, way, way back in the ASP.NET MVC 1.0 beta days, they had a very nice mechanism
to update lists of items by tying UI fields to index numbers, so you could use primary
key identifiers to help keep track of what fields were modified where. In the 1.0
RC release, Microsoft <a href="http://forums.asp.net/p/1377775/2906357.aspx" target="_blank">changed
how it worked to do things sequentially instead</a>. I was using the IndexModelBinder
found in that thread with great success ever since then. However, Microsoft added
back in the index support to ASP.NET MVC 2 RC. This means that you will have to delete
the old IndexModelBinder since it won't compile anymore. Thankfully, I didn't have
to change a line of my code. Nice job of code compatibility!!</li></ul><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=e6c300f9-9863-43da-958f-b8bfa4807a9a" /></body>
      <title>ASP.NET MVC 2 RC Changes</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,e6c300f9-9863-43da-958f-b8bfa4807a9a.aspx</guid>
      <link>http://www.distribucon.com/blog/ASPNETMVC2RCChanges.aspx</link>
      <pubDate>Tue, 19 Jan 2010 02:52:39 GMT</pubDate>
      <description>I just updated my ASP.NET MVC 1.0 application to use &lt;a href="http://go.microsoft.com/fwlink/?LinkID=157071" target="_blank"&gt;ASP.NET
MVC 2 RC&lt;/a&gt;. It was a pretty painless process. Be sure to follow the Release Notes
on the download page, and many applications will be ready to go. Here are some extra
things that might help get you unstuck:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;
If you're using the ASP.NET MVC Futures (Microsoft.Web.Mvc) assembly, be sure to download
the &lt;a href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=37423" target="_blank"&gt;new
one that works with ASP.NET MVC 2&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
If you're using the Telerik ASP.NET MVC components, be sure to download version BETA
2009.3.1218 or later.&lt;/li&gt;
&lt;li&gt;
Way, way, way back in the ASP.NET MVC 1.0 beta days, they had a very nice mechanism
to update lists of items by tying UI fields to index numbers, so you could use primary
key identifiers to help keep track of what fields were modified where. In the 1.0
RC release, Microsoft &lt;a href="http://forums.asp.net/p/1377775/2906357.aspx" target="_blank"&gt;changed
how it worked to do things sequentially instead&lt;/a&gt;. I was using the IndexModelBinder
found in that thread with great success ever since then. However, Microsoft added
back in the index support to ASP.NET MVC 2 RC. This means that you will have to delete
the old IndexModelBinder since it won't compile anymore. Thankfully, I didn't have
to change a line of my code. Nice job of code compatibility!!&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=e6c300f9-9863-43da-958f-b8bfa4807a9a" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,e6c300f9-9863-43da-958f-b8bfa4807a9a.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=0572ab77-105e-4ad4-b4a0-f3f6ffcd5ed9</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,0572ab77-105e-4ad4-b4a0-f3f6ffcd5ed9.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,0572ab77-105e-4ad4-b4a0-f3f6ffcd5ed9.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=0572ab77-105e-4ad4-b4a0-f3f6ffcd5ed9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Consider this code fragment:<br /><pre class="c#" name="code">
var list =<br />
from tx in Transactions<br />
group tx by new {tx.TransactionType, tx.ClientTypeID};<br /><br />
foreach (var item in list)<br />
{<br />
Console.WriteLine(item.Key.TransactionType);<br />
Console.WriteLine(item.Sum(tx =&gt; tx.Amount));<br />
foreach (var item2 in item)<br />
Console.WriteLine(item2.TransactionID);<br />
} </pre><p />
After executing the query, we now have an IGrouping&lt;AnonymousType, Transaction&gt;
that lets us run through all of the grouped objects, while still having access to
the original objects in the inner loop. We can accomplish the exact same thing with
this alternative LINQ statement, but the first version seems cleaner to me:<br /><pre class="c#" name="code">
var list =<br />
from tx in Transactions<br />
group tx by new {tx.TransactionType, tx.ClientTypeID} into g<br />
select g; </pre><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=0572ab77-105e-4ad4-b4a0-f3f6ffcd5ed9" /></body>
      <title>LINQ: Query body must end with a select OR groupby clause</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,0572ab77-105e-4ad4-b4a0-f3f6ffcd5ed9.aspx</guid>
      <link>http://www.distribucon.com/blog/LINQQueryBodyMustEndWithASelectORGroupbyClause.aspx</link>
      <pubDate>Tue, 05 Jan 2010 16:30:01 GMT</pubDate>
      <description>Consider this code fragment:&lt;br /&gt;
&lt;pre class=c# name="code"&gt;
var list =&lt;br /&gt;
from tx in Transactions&lt;br /&gt;
group tx by new {tx.TransactionType, tx.ClientTypeID};&lt;br /&gt;
&lt;br /&gt;
foreach (var item in list)&lt;br /&gt;
{&lt;br /&gt;
Console.WriteLine(item.Key.TransactionType);&lt;br /&gt;
Console.WriteLine(item.Sum(tx =&amp;gt; tx.Amount));&lt;br /&gt;
foreach (var item2 in item)&lt;br /&gt;
Console.WriteLine(item2.TransactionID);&lt;br /&gt;
} &lt;/pre&gt;
&lt;p /&gt;
After executing the query, we now have an IGrouping&amp;lt;AnonymousType, Transaction&amp;gt;
that lets us run through all of the grouped objects, while still having access to
the original objects in the inner loop. We can accomplish the exact same thing with
this alternative LINQ statement, but the first version seems cleaner to me:&lt;br /&gt;
&lt;pre class=c# name="code"&gt;
var list =&lt;br /&gt;
from tx in Transactions&lt;br /&gt;
group tx by new {tx.TransactionType, tx.ClientTypeID} into g&lt;br /&gt;
select g; &lt;/pre&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=0572ab77-105e-4ad4-b4a0-f3f6ffcd5ed9" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,0572ab77-105e-4ad4-b4a0-f3f6ffcd5ed9.aspx</comments>
      <category>.NET</category>
      <category>LINQ</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=7894225c-ffc2-429b-9829-a49998567094</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,7894225c-ffc2-429b-9829-a49998567094.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,7894225c-ffc2-429b-9829-a49998567094.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=7894225c-ffc2-429b-9829-a49998567094</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Telerik just released an extremely impressive <a href="http://demos.telerik.com/aspnet-mvc/" target="_blank">library
of components</a> (Grid, Menu, TabStrip, and MenuBar), written for MVC. They are truly
first-class, from the architecture, to the development experience, to the finished
screens that your user sees. They released them as open-source, and even better, these
controls are written from the ground up to support ASP.NET MVC. 
<p />
Be sure to check out this awesome write up on how to <a href="http://weblogs.asp.net/rashid/archive/2009/11/05/using-telerik-mvc-grid-in-crud-scenario.aspx" target="_blank">Use
the grid in a CRUD scenario</a>. Very nicely done. 
<p />
I'm not a fan of the whole "Edit/Delete" action column. I'd much rather just have
a link on the column to take me to the detail screen. Here's the way I solved that: <pre><code> &lt;%
Html.Telerik().Grid(Model) .Name("Grid") .PrefixUrlParameters(false) .Columns(columns
=&gt; { columns.Add(o =&gt; o.CollectionDate).Template(c =&gt; { %&gt; &lt;%= Html.ActionLink(c.CollectionDate.ToShortDateString(),
"View", new { Id = c.Id })%&gt; &lt;% }).Width(40); columns.Add(o =&gt; o.Location.Name).Width(40);
}) .Scrollable() .Sortable() .Pageable() .Filterable() .Render(); %&gt; </code></pre><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=7894225c-ffc2-429b-9829-a49998567094" /></body>
      <title>Telerik Extensions for ASP.NET MVC</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,7894225c-ffc2-429b-9829-a49998567094.aspx</guid>
      <link>http://www.distribucon.com/blog/TelerikExtensionsForASPNETMVC.aspx</link>
      <pubDate>Sun, 08 Nov 2009 03:00:21 GMT</pubDate>
      <description>Telerik just released an extremely impressive &lt;a href="http://demos.telerik.com/aspnet-mvc/" target="_blank"&gt;library
of components&lt;/a&gt; (Grid, Menu, TabStrip, and MenuBar), written for MVC. They are truly
first-class, from the architecture, to the development experience, to the finished
screens that your user sees. They released them as open-source, and even better, these
controls are written from the ground up to support ASP.NET MVC. 
&lt;p /&gt;
Be sure to check out this awesome write up on how to &lt;a href="http://weblogs.asp.net/rashid/archive/2009/11/05/using-telerik-mvc-grid-in-crud-scenario.aspx" target="_blank"&gt;Use
the grid in a CRUD scenario&lt;/a&gt;. Very nicely done. 
&lt;p /&gt;
I'm not a fan of the whole "Edit/Delete" action column. I'd much rather just have
a link on the column to take me to the detail screen. Here's the way I solved that: &lt;pre&gt;&lt;code&gt; &amp;lt;%
Html.Telerik().Grid(Model) .Name("Grid") .PrefixUrlParameters(false) .Columns(columns
=&amp;gt; { columns.Add(o =&amp;gt; o.CollectionDate).Template(c =&amp;gt; { %&gt; &amp;lt;%= Html.ActionLink(c.CollectionDate.ToShortDateString(),
"View", new { Id = c.Id })%&amp;gt; &amp;lt;% }).Width(40); columns.Add(o =&amp;gt; o.Location.Name).Width(40);
}) .Scrollable() .Sortable() .Pageable() .Filterable() .Render(); %&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=7894225c-ffc2-429b-9829-a49998567094" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,7894225c-ffc2-429b-9829-a49998567094.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=30b6e8a6-7d18-49a3-825c-ea4c0c2006fc</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,30b6e8a6-7d18-49a3-825c-ea4c0c2006fc.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,30b6e8a6-7d18-49a3-825c-ea4c0c2006fc.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=30b6e8a6-7d18-49a3-825c-ea4c0c2006fc</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">Given a collection of players that were
constructed like this: <pre><code> private static IList&lt;Player&gt; LoadPlayers()
{ Player favre = new Player { Id = 1, Name = "Favre", Team = new Team { Id = 1, Name
= "Vikings" } }; Player peterson = new Player { Id = 2, Name = "Peterson", Team =
new Team { Id = 1, Name = "Vikings" } }; Player rodgers = new Player { Id = 3, Name
= "Rodgers", Team = new Team { Id = 2, Name = "Packers" } }; Player driver = new Player
{ Id = 4, Name = "Driver", Team = new Team { Id = 2, Name = "Packers" } }; List&lt;Player&gt;
players = new List&lt;Player&gt; {favre, peterson, rodgers, driver}; return players;
} </code></pre><p />
And the following LINQ query: <pre><code> var query = from p in LoadPlayers() group
p by p.Team into g select g; </code></pre><p />
We will see the following output: <pre><code> Vikings Vikings Packers Packers </code></pre><p />
The reason this is happening is that we created new Team objects for each and every
Player, and when LINQ tries to group, it does so based on object equality. The solution
to this is to <a href="http://www.developer.com/net/asp/print.php/989091" target="_blank">override
the Equals() and GetHashCode() methods</a> in the Team class. After doing that, the
LINQ query will be able to group the objects up properly and just display each team
name once. <a href="http://www.jetbrains.com/resharper/" target="_blank">Resharper</a> has
a nice code generation template to create solid implementations of these methods (press
Alt+Ins to bring up the code generation menu). 
<p />
The example here is obviously contrived. We could create each team object once, and
then use the same instance during the property assignment, and if we did that, things
would work just fine. However, I ran into a more generalized version of this problem
when using WCF and a lot of custom code generation. The underlying lesson is still
the same: LINQ and GroupBy need to have object equality defined properly in order
to make things work as you would expect.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=30b6e8a6-7d18-49a3-825c-ea4c0c2006fc" /></body>
      <title>LINQ GroupBy requires object equality</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,30b6e8a6-7d18-49a3-825c-ea4c0c2006fc.aspx</guid>
      <link>http://www.distribucon.com/blog/LINQGroupByRequiresObjectEquality.aspx</link>
      <pubDate>Fri, 16 Oct 2009 18:14:18 GMT</pubDate>
      <description>Given a collection of players that were constructed like this:
&lt;pre&gt;&lt;code&gt; private
static IList&amp;lt;Player&amp;gt; LoadPlayers() { Player favre = new Player { Id = 1, Name
= "Favre", Team = new Team { Id = 1, Name = "Vikings" } }; Player peterson = new Player
{ Id = 2, Name = "Peterson", Team = new Team { Id = 1, Name = "Vikings" } }; Player
rodgers = new Player { Id = 3, Name = "Rodgers", Team = new Team { Id = 2, Name =
"Packers" } }; Player driver = new Player { Id = 4, Name = "Driver", Team = new Team
{ Id = 2, Name = "Packers" } }; List&amp;lt;Player&amp;gt; players = new List&amp;lt;Player&amp;gt;
{favre, peterson, rodgers, driver}; return players; } &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
And the following LINQ query: &lt;pre&gt;&lt;code&gt; var query = from p in LoadPlayers() group
p by p.Team into g select g; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
We will see the following output: &lt;pre&gt;&lt;code&gt; Vikings Vikings Packers Packers &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
The reason this is happening is that we created new Team objects for each and every
Player, and when LINQ tries to group, it does so based on object equality. The solution
to this is to &lt;a href="http://www.developer.com/net/asp/print.php/989091" target="_blank"&gt;override
the Equals() and GetHashCode() methods&lt;/a&gt; in the Team class. After doing that, the
LINQ query will be able to group the objects up properly and just display each team
name once. &lt;a href="http://www.jetbrains.com/resharper/" target="_blank"&gt;Resharper&lt;/a&gt; has
a nice code generation template to create solid implementations of these methods (press
Alt+Ins to bring up the code generation menu). 
&lt;p /&gt;
The example here is obviously contrived. We could create each team object once, and
then use the same instance during the property assignment, and if we did that, things
would work just fine. However, I ran into a more generalized version of this problem
when using WCF and a lot of custom code generation. The underlying lesson is still
the same: LINQ and GroupBy need to have object equality defined properly in order
to make things work as you would expect.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=30b6e8a6-7d18-49a3-825c-ea4c0c2006fc" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,30b6e8a6-7d18-49a3-825c-ea4c0c2006fc.aspx</comments>
      <category>.NET</category>
      <category>LINQ</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Given a set up like this (where ExpenseSummaryData
returns some arbitrary HTML fragment) : <pre><code> &lt;%using (Ajax.BeginForm("ExpenseSummaryData",
new AjaxOptions { UpdateTargetId = "result" })) { %&gt; &lt;label for="startDate"&gt;Start
Date:&lt;/label&gt; &lt;%= Html.TextBox("startDate") %&gt; &lt;br /&gt; &lt;label
for="endDate"&gt;End Date:&lt;/label&gt; &lt;%= Html.TextBox("endDate")%&gt; &lt;br
/&gt; &lt;input type="submit"/&gt; &lt;br /&gt; &lt;span id="result"/&gt; &lt;% }
%&gt; </code></pre><p />
If that is all your page does, you will notice that you get taken to a new page when
pressing Submit. The data on the new page is the HTML fragment returned by the AJAX
call, but that's all it contains (e.g. no master page), and it's clearly not replacing
the result span. 
<p />
The reason for this is that I forgot to add the following lines to the &lt;head&gt;
section in the original page: <pre><code> &lt;script src='&lt;%=ResolveUrl("~/Content/js/MicrosoftAjax.debug.js")%&gt;'
type="text/javascript"&gt;&lt;/script&gt; &lt;script src='&lt;%=ResolveUrl("~/Content/js/MicrosoftMvcAjax.debug.js")%&gt;'
type="text/javascript"&gt;&lt;/script&gt; </code></pre><p />
After adding those declarations in, the content in the span tag is properly updated
and it looks like a real AJAX call.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5" /></body>
      <title>Why AJAX posts go to a new page instead of updating UpdateTargetId</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</guid>
      <link>http://www.distribucon.com/blog/WhyAJAXPostsGoToANewPageInsteadOfUpdatingUpdateTargetId.aspx</link>
      <pubDate>Sun, 31 May 2009 16:38:24 GMT</pubDate>
      <description>Given a set up like this (where ExpenseSummaryData returns some arbitrary HTML fragment) :
&lt;pre&gt;&lt;code&gt; &amp;lt;%using
(Ajax.BeginForm("ExpenseSummaryData", new AjaxOptions { UpdateTargetId = "result"
})) { %&amp;gt; &amp;lt;label for="startDate"&amp;gt;Start Date:&amp;lt;/label&amp;gt; &amp;lt;%= Html.TextBox("startDate")
%&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;label for="endDate"&amp;gt;End Date:&amp;lt;/label&amp;gt; &amp;lt;%= Html.TextBox("endDate")%&amp;gt;
&amp;lt;br /&amp;gt; &amp;lt;input type="submit"/&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;span id="result"/&amp;gt; &amp;lt;%
} %&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
If that is all your page does, you will notice that you get taken to a new page when
pressing Submit. The data on the new page is the HTML fragment returned by the AJAX
call, but that's all it contains (e.g. no master page), and it's clearly not replacing
the result span. 
&lt;p /&gt;
The reason for this is that I forgot to add the following lines to the &amp;lt;head&amp;gt;
section in the original page: &lt;pre&gt;&lt;code&gt; &amp;lt;script src='&amp;lt;%=ResolveUrl("~/Content/js/MicrosoftAjax.debug.js")%&amp;gt;'
type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;script src='&amp;lt;%=ResolveUrl("~/Content/js/MicrosoftMvcAjax.debug.js")%&amp;gt;'
type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
After adding those declarations in, the content in the span tag is properly updated
and it looks like a real AJAX call.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=60411c85-da2d-4907-8d0a-d0949d16ffee</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,60411c85-da2d-4907-8d0a-d0949d16ffee.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,60411c85-da2d-4907-8d0a-d0949d16ffee.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=60411c85-da2d-4907-8d0a-d0949d16ffee</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I've been on Facebook for a while, and
I just added Twitter to the mix. I'm trying to keep communications on those sites
much more informal and fairly non-technical. If you want to follow me, search for
dmiser@wi.rr.com on Facebook or danmiser on Twitter. Hope to see you over there.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=60411c85-da2d-4907-8d0a-d0949d16ffee" /></body>
      <title>Social networking</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,60411c85-da2d-4907-8d0a-d0949d16ffee.aspx</guid>
      <link>http://www.distribucon.com/blog/SocialNetworking.aspx</link>
      <pubDate>Sat, 25 Apr 2009 17:08:10 GMT</pubDate>
      <description>I've been on Facebook for a while, and I just added Twitter to the mix. I'm trying to keep communications on those sites much more informal and fairly non-technical. If you want to follow me, search for dmiser@wi.rr.com on Facebook or danmiser on Twitter. Hope to see you over there.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=60411c85-da2d-4907-8d0a-d0949d16ffee" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,60411c85-da2d-4907-8d0a-d0949d16ffee.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=c8755312-f231-4981-8332-07422a11622a</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,c8755312-f231-4981-8332-07422a11622a.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,c8755312-f231-4981-8332-07422a11622a.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=c8755312-f231-4981-8332-07422a11622a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Are you looking for a strong developer/architect
with a serious passion for all things technical and a unique blend of experience?
If so, feel free to <a href="mailto:dmiser@distribucon.com">email me</a>. My main
focus over the past couple of years has been on things ALT.NET-ish (e.g. ASP.NET MVC,
NHibernate, Spring.NET, etc.) while I have delved into a variety of other technologies
as well (e.g. Mindscape LightSpeed, LINQ, Dynamic Data, Delphi, etc.). If you know
of an opening - contract or full-time - please keep me in mind. I'd prefer to remain
in the Milwaukee area, but occasional travel wouldn't be the end of the world. 
<p />
Until the next technical post here, take care and thanks in advance.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=c8755312-f231-4981-8332-07422a11622a" /></body>
      <title>Looking for work</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,c8755312-f231-4981-8332-07422a11622a.aspx</guid>
      <link>http://www.distribucon.com/blog/LookingForWork.aspx</link>
      <pubDate>Wed, 22 Apr 2009 18:29:54 GMT</pubDate>
      <description>Are you looking for a strong developer/architect with a serious passion for all things technical and a unique blend of experience? If so, feel free to &lt;a href="mailto:dmiser@distribucon.com"&gt;email
me&lt;/a&gt;. My main focus over the past couple of years has been on things ALT.NET-ish
(e.g. ASP.NET MVC, NHibernate, Spring.NET, etc.) while I have delved into a variety
of other technologies as well (e.g. Mindscape LightSpeed, LINQ, Dynamic Data, Delphi,
etc.). If you know of an opening - contract or full-time - please keep me in mind.
I'd prefer to remain in the Milwaukee area, but occasional travel wouldn't be the
end of the world. 
&lt;p /&gt;
Until the next technical post here, take care and thanks in advance.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=c8755312-f231-4981-8332-07422a11622a" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,c8755312-f231-4981-8332-07422a11622a.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
      <category>Delphi</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=da104123-1fd4-4541-a102-2d93529154ca</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,da104123-1fd4-4541-a102-2d93529154ca.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,da104123-1fd4-4541-a102-2d93529154ca.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=da104123-1fd4-4541-a102-2d93529154ca</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The first time you load an assembly of <a href="http://quartznet.sourceforge.net/" target="_blank">Quartz.NET</a> jobs,
it populates the database with the current trigger information (cron vs. simple, timings,
etc.) that it finds in the configuration file. It appears that this information does
not get updated once it's in the database. So if you want to make a change to set
the trigger time to be every minute instead of the original version of "run every
day at 2am", you will be waiting for a loooong time to see that trigger fire (unless
you start at 1:59am :)).
</p>
        <p>
Since I'm using <a href="http://code.google.com/p/migratordotnet/" target="_blank">Migrator.NET</a> to
control my database schema, I can easily drop the tables and recreate them. This isn't
a big deal because once I have things tested, I won't need to change the trigger information,
but it did trip me up for a bit so I thought I'd share.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=da104123-1fd4-4541-a102-2d93529154ca" />
      </body>
      <title>Quartz.NET trigger updates</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,da104123-1fd4-4541-a102-2d93529154ca.aspx</guid>
      <link>http://www.distribucon.com/blog/QuartzNETTriggerUpdates.aspx</link>
      <pubDate>Fri, 13 Mar 2009 04:47:18 GMT</pubDate>
      <description>&lt;p&gt;
The first time you load an assembly of &lt;a href="http://quartznet.sourceforge.net/" target="_blank"&gt;Quartz.NET&lt;/a&gt; jobs,
it populates the database with the current trigger information (cron vs. simple, timings,
etc.) that it finds in the configuration file. It appears that this information does
not get updated once it's in the database. So if you want to make a change to set
the trigger time to be every minute instead of the original version of "run every
day at 2am", you will be waiting for a loooong time to see that trigger fire (unless
you start at 1:59am :)).
&lt;/p&gt;
&lt;p&gt;
Since I'm using &lt;a href="http://code.google.com/p/migratordotnet/" target="_blank"&gt;Migrator.NET&lt;/a&gt; to
control my database schema, I can easily drop the tables and recreate them. This isn't
a big deal because once I have things tested, I won't need to change the trigger information,
but it did trip me up for a bit so I thought I'd share.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=da104123-1fd4-4541-a102-2d93529154ca" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,da104123-1fd4-4541-a102-2d93529154ca.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=b6eb635e-95be-4f1e-a5c6-3b7fa18db772</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,b6eb635e-95be-4f1e-a5c6-3b7fa18db772.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,b6eb635e-95be-4f1e-a5c6-3b7fa18db772.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b6eb635e-95be-4f1e-a5c6-3b7fa18db772</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I came across this exception today when
inserting multiple objects through an NHibernate SessionScope:<br /><pre><code> NHibernate.NonUniqueObjectException: a different object with the same
identifier value was already associated with the session: 0, of class: Foo.Entity.Bar
at NHibernate.Impl.SessionImpl.DoSave(Object obj, Object id, IEntityPersister persister,
Boolean useIdentityColumn, CascadingAction cascadeAction, Object anything) at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object
obj, CascadingAction action, Object anything) at NHibernate.Impl.SessionImpl.Save(Object
obj) </code></pre><p>
I didn't see much out there on this, but <a href="http://www.zorched.net" target="_blank">Geoff
Lane</a> picked up on it pretty quickly. It turns out that my Bar.hbm.xml mapping
file had set the id generator incorrectly to "generated", which was a problem because
it was actually a MSSQL IDENTITY field. The mapping should have looked like this: 
</p><p></p><pre><code> &lt;id name="Id"&gt;<br />
  &lt;generator class="native" /&gt;<br />
&lt;/id&gt;</code></pre><p>
Luckily for me, I had run my tests by trying to insert 2 entities inside the session
so the error bubbled up right away. 
</p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=b6eb635e-95be-4f1e-a5c6-3b7fa18db772" /></body>
      <title>NHibernate NonUniqueException</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,b6eb635e-95be-4f1e-a5c6-3b7fa18db772.aspx</guid>
      <link>http://www.distribucon.com/blog/NHibernateNonUniqueException.aspx</link>
      <pubDate>Thu, 12 Mar 2009 02:06:02 GMT</pubDate>
      <description>I came across this exception today when inserting multiple objects through an NHibernate SessionScope:&lt;br&gt;
&lt;pre&gt;&lt;code&gt; NHibernate.NonUniqueObjectException: a different object with the same
identifier value was already associated with the session: 0, of class: Foo.Entity.Bar
at NHibernate.Impl.SessionImpl.DoSave(Object obj, Object id, IEntityPersister persister,
Boolean useIdentityColumn, CascadingAction cascadeAction, Object anything) at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object
obj, CascadingAction action, Object anything) at NHibernate.Impl.SessionImpl.Save(Object
obj) &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
I didn't see much out there on this, but &lt;a href="http://www.zorched.net" target="_blank"&gt;Geoff
Lane&lt;/a&gt; picked up on it pretty quickly. It turns out that my Bar.hbm.xml mapping
file had set the id generator incorrectly to "generated", which was a problem because
it was actually a MSSQL IDENTITY field. The mapping should have looked like this: 
&lt;p&gt;
&lt;pre&gt;&lt;code&gt; &amp;lt;id name="Id"&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;generator class="native" /&amp;gt;&lt;br&gt;
&amp;lt;/id&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Luckily for me, I had run my tests by trying to insert 2 entities inside the session
so the error bubbled up right away. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=b6eb635e-95be-4f1e-a5c6-3b7fa18db772" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,b6eb635e-95be-4f1e-a5c6-3b7fa18db772.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=52754cfb-f1c7-4264-bd08-905039f15b62</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,52754cfb-f1c7-4264-bd08-905039f15b62.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,52754cfb-f1c7-4264-bd08-905039f15b62.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=52754cfb-f1c7-4264-bd08-905039f15b62</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Yesterday, I had to upgrade from Spring.NET 1.1 to <a href="http://www.springframework.net/download.html" target="_blank">Spring.NET
1.2</a> in order to <a href="http://www.zorched.net/2009/03/07/using-quartznet-springnet-and-nhibernate-to-run-scheduled-tasks-in-aspnet/" target="_blank">use
Quartz.NET</a>. After doing that, I started to get InvalidCastException errors in
my unit tests that told me I couldn't convert an int to a Nullable&lt;int&gt;. Things
like this were broken:
</p>
        <pre>
          <code> void TestMe(int? id) { // do testing here } // and elsewhere, we call
it like this TestMe(42); </code>
        </pre>
        <p>
Very strange. It turns out that this is a <a href="http://jira.springframework.org/browse/SPRNET-1131" target="_blank">known
(and fixed) issue</a> due to using Nullable types through AOP. I grabbed the latest
nightly build and all of the tests passed again. 
</p>
        <p>
However, when running, I found a breaking change in the post-1.2.0 code that I needed
to correct, namely: 
</p>
        <p>
Overriding the SessionFactoryObjectName in web.config no longer uses Spring.Data.NHibernate.Support.OpenSessionInViewModule.SessionFactoryObjectName
as the key. Now, you need to use Spring.Data.NHibernate.Support.SessionScope.SessionFactoryObjectName.
e.g.
</p>
        <pre>
          <code>&lt;add key="Spring.Data.NHibernate.Support.SessionScope.SessionFactoryObjectName"
value="NHibernateSessionFactory" /&gt; </code>
        </pre>
        <p>
Now everything is upgraded and working again.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=52754cfb-f1c7-4264-bd08-905039f15b62" />
      </body>
      <title>Spring.NET 1.2.1 breaking change</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,52754cfb-f1c7-4264-bd08-905039f15b62.aspx</guid>
      <link>http://www.distribucon.com/blog/SpringNET121BreakingChange.aspx</link>
      <pubDate>Tue, 10 Mar 2009 19:02:30 GMT</pubDate>
      <description>&lt;p&gt;
Yesterday, I had to upgrade from Spring.NET 1.1 to &lt;a href="http://www.springframework.net/download.html" target="_blank"&gt;Spring.NET
1.2&lt;/a&gt; in order to &lt;a href="http://www.zorched.net/2009/03/07/using-quartznet-springnet-and-nhibernate-to-run-scheduled-tasks-in-aspnet/" target="_blank"&gt;use
Quartz.NET&lt;/a&gt;. After doing that, I started to get InvalidCastException errors in
my unit tests that told me I couldn't convert an int to a Nullable&amp;lt;int&amp;gt;. Things
like this were broken:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; void TestMe(int? id) { // do testing here } // and elsewhere, we call
it like this TestMe(42); &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Very strange. It turns out that this is a &lt;a href="http://jira.springframework.org/browse/SPRNET-1131" target="_blank"&gt;known
(and fixed) issue&lt;/a&gt; due to using Nullable types through AOP. I grabbed the latest
nightly build and all of the tests passed again. 
&lt;p&gt;
However, when running, I found a breaking change in the post-1.2.0 code that I needed
to correct, namely: 
&lt;p&gt;
Overriding the SessionFactoryObjectName in web.config no longer uses Spring.Data.NHibernate.Support.OpenSessionInViewModule.SessionFactoryObjectName
as the key. Now, you need to use Spring.Data.NHibernate.Support.SessionScope.SessionFactoryObjectName.
e.g.&lt;pre&gt;&lt;code&gt;&amp;lt;add key="Spring.Data.NHibernate.Support.SessionScope.SessionFactoryObjectName"
value="NHibernateSessionFactory" /&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Now everything is upgraded and working again.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=52754cfb-f1c7-4264-bd08-905039f15b62" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,52754cfb-f1c7-4264-bd08-905039f15b62.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=6f800a00-7b0e-449a-9a4f-1b66bc5cb220</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,6f800a00-7b0e-449a-9a4f-1b66bc5cb220.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,6f800a00-7b0e-449a-9a4f-1b66bc5cb220.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6f800a00-7b0e-449a-9a4f-1b66bc5cb220</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'll be out in L.A. for <a href="http://www.microsoftpdc.com" target="_blank">PDC</a> 10/25-10/30.
If you're going to be there, too, drop me an email!
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=6f800a00-7b0e-449a-9a4f-1b66bc5cb220" />
      </body>
      <title>Heading out to PDC</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,6f800a00-7b0e-449a-9a4f-1b66bc5cb220.aspx</guid>
      <link>http://www.distribucon.com/blog/HeadingOutToPDC.aspx</link>
      <pubDate>Thu, 02 Oct 2008 15:22:41 GMT</pubDate>
      <description>&lt;p&gt;
I'll be out in L.A. for &lt;a href="http://www.microsoftpdc.com" target="_blank"&gt;PDC&lt;/a&gt; 10/25-10/30.
If you're going to be there, too, drop me an email!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=6f800a00-7b0e-449a-9a4f-1b66bc5cb220" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,6f800a00-7b0e-449a-9a4f-1b66bc5cb220.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=5ad392b6-edc9-42c3-8fff-467e1bdf7157</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,5ad392b6-edc9-42c3-8fff-467e1bdf7157.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,5ad392b6-edc9-42c3-8fff-467e1bdf7157.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=5ad392b6-edc9-42c3-8fff-467e1bdf7157</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you want to add Membership Provider features to your WebHost4Life application,
I've found that you can't use the aspnet_regsql wizard UI. Instead, use the following
code at the command prompt:
</p>
        <pre>
          <code> aspnet_regsql -C "Data Source=sqlNNN.mysite4now.com;Initial Catalog=yourdb;User
Id=yourUserName;Password=yourPwd" -A mr </code>
        </pre>
        <p>
Replace NNN with your assigned address, and obviously replace the other elements of
the above connection string, too. :-)<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5ad392b6-edc9-42c3-8fff-467e1bdf7157" /></p>
      </body>
      <title>Adding Membership Provider to WebHost4Life web apps</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,5ad392b6-edc9-42c3-8fff-467e1bdf7157.aspx</guid>
      <link>http://www.distribucon.com/blog/AddingMembershipProviderToWebHost4LifeWebApps.aspx</link>
      <pubDate>Tue, 15 Apr 2008 21:12:01 GMT</pubDate>
      <description>&lt;p&gt;
If you want to add Membership Provider features to your WebHost4Life application,
I've found that you can't use the aspnet_regsql wizard UI. Instead, use the following
code at the command prompt:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; aspnet_regsql -C "Data Source=sqlNNN.mysite4now.com;Initial Catalog=yourdb;User
Id=yourUserName;Password=yourPwd" -A mr &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Replace NNN with your assigned address, and obviously replace the other elements of
the above connection string, too. :-)&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5ad392b6-edc9-42c3-8fff-467e1bdf7157" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,5ad392b6-edc9-42c3-8fff-467e1bdf7157.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=5e13f744-b3bd-4847-ab0d-814187f61cdb</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,5e13f744-b3bd-4847-ab0d-814187f61cdb.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,5e13f744-b3bd-4847-ab0d-814187f61cdb.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=5e13f744-b3bd-4847-ab0d-814187f61cdb</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <link rel="stylesheet" type="text/css" href="/styles/csharp.css" />
        <p>
Problem: I have written my own membership provider to store and validate user information.
Further, I have a web page that allows a user to come and sign up with a username,
password, and a whole host of other client-related data. When the user submits that
data, I would like to have them logged in.
</p>
        <p>
Solution: Since I'm using Forms authentication for the ASP.NET website, it appears
that the following code-snippet does what I want:
</p>
        <pre class="csharpcode">
          <span class="kwrd">if</span> (Membership.ValidateUser(u.UserName,
u.Password)) FormsAuthentication.SetAuthCookie(u.UserName, <span class="kwrd">false</span>); </pre>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5e13f744-b3bd-4847-ab0d-814187f61cdb" />
      </body>
      <title>Programmatic ASP.NET Login</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,5e13f744-b3bd-4847-ab0d-814187f61cdb.aspx</guid>
      <link>http://www.distribucon.com/blog/ProgrammaticASPNETLogin.aspx</link>
      <pubDate>Tue, 25 Mar 2008 20:24:17 GMT</pubDate>
      <description>&lt;link rel="stylesheet" type="text/css" href="/styles/csharp.css"&gt;
&lt;p&gt;
Problem: I have written my own membership provider to store and validate user information.
Further, I have a web page that allows a user to come and sign up with a username,
password, and a whole host of other client-related data. When the user submits that
data, I would like to have them logged in.
&lt;/p&gt;
&lt;p&gt;
Solution: Since I'm using Forms authentication for the ASP.NET website, it appears
that the following code-snippet does what I want:
&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (Membership.ValidateUser(u.UserName,
u.Password)) FormsAuthentication.SetAuthCookie(u.UserName, &lt;span class="kwrd"&gt;false&lt;/span&gt;); &lt;/pre&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5e13f744-b3bd-4847-ab0d-814187f61cdb" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,5e13f744-b3bd-4847-ab0d-814187f61cdb.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=17afd100-c19d-4fd0-b206-658fda5c1e11</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,17afd100-c19d-4fd0-b206-658fda5c1e11.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,17afd100-c19d-4fd0-b206-658fda5c1e11.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=17afd100-c19d-4fd0-b206-658fda5c1e11</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Nikhil Kothari wrote a brilliant blog post titled <a href="http://www.nikhilk.net/Ajax-MVC.aspx" target="_blank">Ajax
with the ASP.NET MVC Framework</a>. In that post, he built a demonstration TaskList
application that used Ajax and the ASP.NET MVC framework that Microsoft is working
on. Microsoft is doing a good job in releasing more frequent updates to this framework,
but that means that there will be pain when moving from one release to the next. The
ASP.NET MVC Preview 2 release was no exception to this rule. There were a list of
documented, tedious and manual steps that one needed to follow to get their old code
running with preview 2: update web.config, change the route description, update assembly
dependencies, etc.. There were also other items that were not so well-documented: 
add ProjectTypeGuids to the csproj file, methods that fell out of the preview 2 release
(e.g. ViewFactory.CreateView), etc.
</p>
        <p>
I updated Nikhil's code, and some basic testing shows me that it's working with the
preview 2 bits. Download the updated code <a href="http://www.distribucon.com/download/dotnet/TaskListMiserMVCPreview2.zip" target="_blank">here</a>.
Please leave a comment or send me an email if you see any errors that need to be corrected.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=17afd100-c19d-4fd0-b206-658fda5c1e11" />
      </body>
      <title>Updated TaskList for Preview 2 - Ajax and MVC</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,17afd100-c19d-4fd0-b206-658fda5c1e11.aspx</guid>
      <link>http://www.distribucon.com/blog/UpdatedTaskListForPreview2AjaxAndMVC.aspx</link>
      <pubDate>Mon, 17 Mar 2008 18:21:14 GMT</pubDate>
      <description>&lt;p&gt;
Nikhil Kothari wrote a brilliant blog post titled &lt;a href="http://www.nikhilk.net/Ajax-MVC.aspx" target="_blank"&gt;Ajax
with the ASP.NET MVC Framework&lt;/a&gt;. In that post, he built a demonstration TaskList
application that used Ajax and the ASP.NET MVC framework that Microsoft is working
on. Microsoft is doing a good job in releasing more frequent updates to this framework,
but that means that there will be pain when moving from one release to the next. The
ASP.NET MVC Preview 2 release was no exception to this rule. There were a list of
documented, tedious and manual steps that one needed to follow to get their old code
running with preview 2: update web.config, change the route description, update assembly
dependencies, etc.. There were also other items that were not so well-documented:&amp;nbsp;
add ProjectTypeGuids to the csproj file, methods that fell out of the preview 2 release
(e.g. ViewFactory.CreateView), etc.
&lt;/p&gt;
&lt;p&gt;
I updated Nikhil's code, and some basic testing shows me that it's working with the
preview 2 bits. Download the updated code &lt;a href="http://www.distribucon.com/download/dotnet/TaskListMiserMVCPreview2.zip" target="_blank"&gt;here&lt;/a&gt;.
Please leave a comment or send me an email if you see any errors that need to be corrected.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=17afd100-c19d-4fd0-b206-658fda5c1e11" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,17afd100-c19d-4fd0-b206-658fda5c1e11.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=04665464-7538-43ca-8d5e-83a1b7dd63df</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,04665464-7538-43ca-8d5e-83a1b7dd63df.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,04665464-7538-43ca-8d5e-83a1b7dd63df.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=04665464-7538-43ca-8d5e-83a1b7dd63df</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=38cc4cf1-773a-47e1-8125-ba3369bf54a3&amp;displaylang=en" target="_blank">ASP.NET
MVC Preview 2</a> was released yesterday. I've had a chance to install and play with
it, and I hate to report that I am underwhelmed. My thinking leads me to believe that
MS rushed this release out the door just to be able to say they shipped <em>something</em> at
MIX. While there has been good progress made on several issues (e.g. medium-trust
support, public methods are callable by default, and route setup is improved). However,
I find several other things lacking, referenced from <a href="http://weblogs.asp.net/scottgu/archive/2008/02/12/asp-net-mvc-framework-road-map-update.aspx" target="_blank">ScottGu</a>:
</p>
        <ol>
          <li>
Source code is not released. Sure, it might be coming "soon", but why not have everything
coordinated and ready to go? Hitting an arbitrary deadline of "ship while at MIX"
is less important to me than having answers to questions like these.</li>
          <li>
Dynamic Data (scaffolding) will not work with Preview 2. It is almost always inexcusable
to take functionality and features away. The ability to scaffold is one of <strong>the</strong> coolest
things in Rails. Having something similar in ASP.NET was a welcome treat. Now it's
gone. Again, I'm sure there is something that will be released "soon", but why not
have everything ready to go? I hate not only playing catch up years later, but having
a taste of it, only to have it yanked a few weeks later.</li>
          <li>
The "choose your unit testing framework" feature that was hyped up ships with only
MSTest enabled. I understand that MS is working to enlist support from the various
unit testing groups to <a href="http://blogs.msdn.com/webdevtools/archive/2008/02/18/asp-net-mvc-test-framework-integration.aspx" target="_blank">add
their tool to the list</a>, but it seems disingenuous to post mocked up screen shots
with test frameworks in a combo box that were never developed.</li>
          <li>
Others have pointed out some more detailed issues that need solving to help with testability
(e.g. see <a href="http://feeds.feedburner.com/~r/jeffreypalermo/~3/246302878/new-drop-of-asp-net-mvc-framework-now-available.aspx" target="_blank">here</a> and <a href="http://www.paulstovell.net/blog/index.php/recommended-reading-ihttpcontext-and-versioning/" target="_blank">here</a>). 
</li>
        </ol>
        <p>
I look forward to seeing these issues addressed ASAP because I absolutely <strong>LOVE</strong> the
promise that the MVC bits hold.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=04665464-7538-43ca-8d5e-83a1b7dd63df" />
      </body>
      <title>ASP.NET MVC Preview 2 looks rushed</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,04665464-7538-43ca-8d5e-83a1b7dd63df.aspx</guid>
      <link>http://www.distribucon.com/blog/ASPNETMVCPreview2LooksRushed.aspx</link>
      <pubDate>Fri, 07 Mar 2008 19:30:33 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=38cc4cf1-773a-47e1-8125-ba3369bf54a3&amp;amp;displaylang=en" target="_blank"&gt;ASP.NET
MVC Preview 2&lt;/a&gt; was released yesterday. I've had a chance to install and play with
it, and I hate to report that I am underwhelmed. My thinking leads me to believe that
MS rushed this release out the door just to be able to say they shipped &lt;em&gt;something&lt;/em&gt; at
MIX. While there has been good progress made on several issues (e.g. medium-trust
support, public methods are callable by default, and route setup is improved). However,
I find several other things lacking, referenced from &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/02/12/asp-net-mvc-framework-road-map-update.aspx" target="_blank"&gt;ScottGu&lt;/a&gt;:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Source code is not released. Sure, it might be coming "soon", but why not have everything
coordinated and ready to go? Hitting an arbitrary deadline of "ship while at MIX"
is less important to me than having answers to questions like these.&lt;/li&gt;
&lt;li&gt;
Dynamic Data (scaffolding) will not work with Preview 2. It is almost always inexcusable
to take functionality and features away. The ability to scaffold is one of &lt;strong&gt;the&lt;/strong&gt; coolest
things in Rails. Having something similar in ASP.NET was a welcome treat. Now it's
gone. Again, I'm sure there is something that will be released "soon", but why not
have everything ready to go? I hate not only playing catch up years later, but having
a taste of it, only to have it yanked a few weeks later.&lt;/li&gt;
&lt;li&gt;
The "choose your unit testing framework" feature that was hyped up ships with only
MSTest enabled. I understand that MS is working to enlist support from the various
unit testing groups to &lt;a href="http://blogs.msdn.com/webdevtools/archive/2008/02/18/asp-net-mvc-test-framework-integration.aspx" target="_blank"&gt;add
their tool to the list&lt;/a&gt;, but it seems disingenuous to post mocked up screen shots
with test frameworks in a combo box that were never developed.&lt;/li&gt;
&lt;li&gt;
Others have pointed out some more detailed issues that need solving to help with testability
(e.g. see &lt;a href="http://feeds.feedburner.com/~r/jeffreypalermo/~3/246302878/new-drop-of-asp-net-mvc-framework-now-available.aspx" target="_blank"&gt;here&lt;/a&gt; and &lt;a href="http://www.paulstovell.net/blog/index.php/recommended-reading-ihttpcontext-and-versioning/" target="_blank"&gt;here&lt;/a&gt;). 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
I look forward to seeing these issues addressed ASAP because I absolutely &lt;strong&gt;LOVE&lt;/strong&gt; the
promise that the MVC bits hold.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=04665464-7538-43ca-8d5e-83a1b7dd63df" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,04665464-7538-43ca-8d5e-83a1b7dd63df.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=25f4aaa1-2559-487a-9dd5-bb491e8281f0</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,25f4aaa1-2559-487a-9dd5-bb491e8281f0.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,25f4aaa1-2559-487a-9dd5-bb491e8281f0.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=25f4aaa1-2559-487a-9dd5-bb491e8281f0</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
All in all, I was very pleased with the inaugural meeting of the Milwaukee ALT.NET
group. We had a turnout of 10 people, which exceeded my expectation in quantity, and
the quality was quite good, too. We talked about general architecture topics for about
45 minutes, and then Todd Penland led the group in discussion on persistence and the <a href="http://www.martinfowler.com/eaaCatalog/unitOfWork.html" target="_blank">Unit
of Work pattern</a>. We talked about various alternatives to building this yourself
(e.g. NHibernate), and talked about the pros and cons of this approach (i.e. requiring
a <a href="http://en.wikipedia.org/wiki/Topological_sort" target="_blank">topological
sort</a> to deal with database changes properly (something near and dear to my heart
from when I was writing code for MIDAS/DataSnap and BDP), handling object graphs,
requiring a MarkDirty() call in the property setters, etc.). It was a very engaging
discussion. Thanks to everyone who showed up, and to <a href="http://www.spiderlogic.com/" target="_blank">SpiderLogic</a> for
providing the refreshments.
</p>
        <p>
Here are the details for next month:
</p>
When: Wednesday, April 9, 2008 @ 7pm<br />
Where: 10000 Innovation Drive, Suite 260 (SpiderLogic office)<br />
What: Dan Piessens (who is on the advisory panel for <a href="http://www.pnpguidance.net/Tag/Unity.aspx" target="_blank">Unity</a> and <a href="http://www.pnpguidance.net/Category/EnterpriseLibrary.aspx" target="_blank">EntLib
4.0</a>) will cover Unity and EntLib 4.0<br /><p></p><p>
I'm looking forward to it, and hope you are, too. If you're planning on being there,
please send me an email to <a href="mailto:dmiser@distribucon.com" target="_blank">dmiser@distribucon.com</a>,
or leave a comment here. That way I can plan the food and refreshments accordingly.
Feel free to drop me a line on topics you'd like to see covered, too.
</p><p><i>Updated to change the date to April 9th. This date change will allow us to hopefully
get more exposure thanks to Scott Isaacs and the WI .NET User Group. Thanks, Scott!</i><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=25f4aaa1-2559-487a-9dd5-bb491e8281f0" /></p></body>
      <title>ALT.NET Milwaukee, recap of meeting 1</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,25f4aaa1-2559-487a-9dd5-bb491e8281f0.aspx</guid>
      <link>http://www.distribucon.com/blog/ALTNETMilwaukeeRecapOfMeeting1.aspx</link>
      <pubDate>Thu, 06 Mar 2008 16:35:55 GMT</pubDate>
      <description>&lt;p&gt;
All in all, I was very pleased with the inaugural meeting of the Milwaukee ALT.NET
group. We had a turnout of 10 people, which exceeded my expectation in quantity, and
the quality was quite good, too. We talked about general architecture topics for about
45 minutes, and then Todd Penland led the group in discussion on persistence and the &lt;a href="http://www.martinfowler.com/eaaCatalog/unitOfWork.html" target="_blank"&gt;Unit
of Work pattern&lt;/a&gt;. We talked about various alternatives to building this yourself
(e.g. NHibernate), and talked about the pros and cons of this approach (i.e. requiring
a &lt;a href="http://en.wikipedia.org/wiki/Topological_sort" target="_blank"&gt;topological
sort&lt;/a&gt; to deal with database changes properly (something near and dear to my heart
from when I was writing code for MIDAS/DataSnap and BDP), handling object graphs,
requiring a MarkDirty() call in the property setters, etc.). It was a very engaging
discussion. Thanks to everyone who showed up, and to &lt;a href="http://www.spiderlogic.com/" target="_blank"&gt;SpiderLogic&lt;/a&gt; for
providing the refreshments.
&lt;/p&gt;
&lt;p&gt;
Here are the details for next month:
&lt;/p&gt;
When: Wednesday, April 9, 2008 @ 7pm&lt;br&gt;
Where: 10000 Innovation Drive, Suite 260 (SpiderLogic office)&lt;br&gt;
What: Dan Piessens (who is on the advisory panel for &lt;a href="http://www.pnpguidance.net/Tag/Unity.aspx" target="_blank"&gt;Unity&lt;/a&gt; and &lt;a href="http://www.pnpguidance.net/Category/EnterpriseLibrary.aspx" target="_blank"&gt;EntLib
4.0&lt;/a&gt;) will cover Unity and EntLib 4.0&lt;br&gt;
&lt;p&gt;
&lt;p&gt;
I'm looking forward to it, and hope you are, too. If you're planning on being there,
please send me an email to &lt;a href="mailto:dmiser@distribucon.com" target="_blank"&gt;dmiser@distribucon.com&lt;/a&gt;,
or leave a comment here. That way I can plan the food and refreshments accordingly.
Feel free to drop me a line on topics you'd like to see covered, too.
&lt;/p&gt;
&lt;p&gt;
&lt;i&gt;Updated to change the date to April 9th. This date change will allow us to hopefully
get more exposure thanks to Scott Isaacs and the WI .NET User Group. Thanks, Scott!&lt;/i&gt;&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=25f4aaa1-2559-487a-9dd5-bb491e8281f0" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,25f4aaa1-2559-487a-9dd5-bb491e8281f0.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=79592a5d-8646-4409-907e-a3de342a3645</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,79592a5d-8646-4409-907e-a3de342a3645.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,79592a5d-8646-4409-907e-a3de342a3645.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=79592a5d-8646-4409-907e-a3de342a3645</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A co-worker of mine, Brian Kapellusch, is working on a web framework to give us a
garden path for ASP.NET applications. The code that he's writing (and the code to
use it) is trés elegant. One of the underpinnings of this framework is his use of
the <a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.aspx" target="_blank">ObjectDataSource</a> class
(ODS). I am making heavy use of NHibernate and <a href="http://www.springframework.net/" target="_blank">Spring.NET</a> in
this application as well. My understanding of the ODS told me that if I wanted to
control how the source object was created, that I simply needed to handle the ObejctCreating
event and assign the desired object instance in that event to e.ObjectInstance (see <a href="http://msdn2.microsoft.com/en-us/library/ms227436.aspx" target="_blank">here</a> for
some more usage examples). 
</p>
        <p>
However, it turns out that is not enough to fully control when an object gets created.
If you set the <a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.typename.aspx" target="_blank">TypeName</a> property
to a concrete class, ODS will also create a new object behind the scenes - even if
you have handled the ObjectCreating event. This becomes <strong>very</strong> problematic
when using an IoC container to automatically build up and inject properties into your
class. 
</p>
        <p>
The bottom line is this: If you see one version of your object that has things built
up properly (because the IoC container was used properly), and one version that has
null properties (because, in essence, ODS called "new MyClass()" for you, which doesn't
let the IoC container do it's job), you should change the TypeName to point to the
interface type instead of the concrete class type. Much thanks to Brian for this one.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=79592a5d-8646-4409-907e-a3de342a3645" />
      </body>
      <title>Using ObjectDataSource with an Inversion of Control Container</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,79592a5d-8646-4409-907e-a3de342a3645.aspx</guid>
      <link>http://www.distribucon.com/blog/UsingObjectDataSourceWithAnInversionOfControlContainer.aspx</link>
      <pubDate>Tue, 26 Feb 2008 00:36:54 GMT</pubDate>
      <description>&lt;p&gt;
A co-worker of mine, Brian Kapellusch, is working on a web framework to give us a
garden path for ASP.NET applications. The code that he's writing (and the code to
use it) is trés elegant. One of the underpinnings of this framework is his use of
the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.aspx" target="_blank"&gt;ObjectDataSource&lt;/a&gt; class
(ODS). I am making heavy use of NHibernate and &lt;a href="http://www.springframework.net/" target="_blank"&gt;Spring.NET&lt;/a&gt; in
this application as well. My understanding of the ODS told me that if I wanted to
control how the source object was created, that I simply needed to handle the ObejctCreating
event and assign the desired object instance in that event to e.ObjectInstance (see &lt;a href="http://msdn2.microsoft.com/en-us/library/ms227436.aspx" target="_blank"&gt;here&lt;/a&gt; for
some more usage examples). 
&lt;/p&gt;
&lt;p&gt;
However, it turns out that is not enough to fully control when an object gets created.
If you set the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.typename.aspx" target="_blank"&gt;TypeName&lt;/a&gt; property
to a concrete class, ODS will also create a new object behind the scenes - even if
you have handled the ObjectCreating event. This becomes &lt;strong&gt;very&lt;/strong&gt; problematic
when using an IoC container to automatically build up and inject properties into your
class. 
&lt;/p&gt;
&lt;p&gt;
The bottom line is this: If you see one version of your object that has things built
up properly (because the IoC container was used properly), and one version that has
null properties (because, in essence, ODS called "new MyClass()" for you, which doesn't
let the IoC container do it's job), you should change the TypeName to point to the
interface type instead of the concrete class type. Much thanks to Brian for this one.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=79592a5d-8646-4409-907e-a3de342a3645" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,79592a5d-8646-4409-907e-a3de342a3645.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=c481b6b9-fc4f-4194-b937-1c612b4fede8</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,c481b6b9-fc4f-4194-b937-1c612b4fede8.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,c481b6b9-fc4f-4194-b937-1c612b4fede8.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=c481b6b9-fc4f-4194-b937-1c612b4fede8</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I'm using <a href="http://www.nhibernate.org" target="_blank">NHibernate</a> a
lot more lately, and it's been working great. One of the downsides, though, is the
fact that you need to build up the mapping files by hand. Well, no more. I stumbled
upon the open source project, <a href="http://code.google.com/p/active-record-gen/" target="_blank">active-record-gen</a>,
on Google Code. One of the templates that it provides is one that will generate NHibernate
mapping files for tables in an MSSQL database. I tried this on a couple of databases
and it works rather well. 
<p>
A few small suggestions:
</p><ul><li>
Implement a better pluralization/singularization strategy by using <a href="http://andrewpeters.net/inflectornet/" target="_blank">Inflector.NET</a>.</li><li>
Work with more databases than just MSSQL.</li><li>
Allow for the connection string to be built up with more options. Right now, it requires
SSPI integration, and attached databases don't work as well as they should. See <a href="http://www.distribucon.com/blog/PermaLink,guid,1125.aspx" target="_blank">here</a> for
more details.</li></ul><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=c481b6b9-fc4f-4194-b937-1c612b4fede8" /></body>
      <title>Generating NHibernate mapping files</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,c481b6b9-fc4f-4194-b937-1c612b4fede8.aspx</guid>
      <link>http://www.distribucon.com/blog/GeneratingNHibernateMappingFiles.aspx</link>
      <pubDate>Tue, 05 Feb 2008 13:57:18 GMT</pubDate>
      <description>I'm using &lt;a href="http://www.nhibernate.org" target="_blank"&gt;NHibernate&lt;/a&gt; a lot
more lately, and it's been working great. One of the downsides, though, is the fact
that you need to build up the mapping files by hand. Well, no more. I stumbled upon
the open source project, &lt;a href="http://code.google.com/p/active-record-gen/" target="_blank"&gt;active-record-gen&lt;/a&gt;,
on Google Code. One of the templates that it provides is one that will generate NHibernate
mapping files for tables in an MSSQL database. I tried this on a couple of databases
and it works rather well. 
&lt;p&gt;
A few small suggestions:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Implement a better pluralization/singularization strategy by using &lt;a href="http://andrewpeters.net/inflectornet/" target="_blank"&gt;Inflector.NET&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
Work with more databases than just MSSQL.&lt;/li&gt;
&lt;li&gt;
Allow for the connection string to be built up with more options. Right now, it requires
SSPI integration, and attached databases don't work as well as they should. See &lt;a href="http://www.distribucon.com/blog/PermaLink,guid,1125.aspx" target="_blank"&gt;here&lt;/a&gt; for
more details.&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=c481b6b9-fc4f-4194-b937-1c612b4fede8" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,c481b6b9-fc4f-4194-b937-1c612b4fede8.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=49eb05a0-76a2-47be-baf0-421e12d0fa10</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,49eb05a0-76a2-47be-baf0-421e12d0fa10.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,49eb05a0-76a2-47be-baf0-421e12d0fa10.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=49eb05a0-76a2-47be-baf0-421e12d0fa10</wfw:commentRss>
      <slash:comments>5</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://msdn2.microsoft.com/en-us/library/bb385902.aspx" target="_blank">This
link</a> explains the unit testing tools available in VS.NET 2008 Professional. My
take after reading that section is that Microsoft doesn't get it. Here is my list
of observations about this section. Feel free to leave a comment to tell me where
I'm wrong.
</p>
        <ul>
          <li>
I feel like this is nothing more than an upsell to get me to go and buy VS.NET TeamSystem.
Sorry, that's not going to happen. TeamSystem is way too expensive (both initially
and in setup/maintenance time for a TFS server). Besides, we have an existing development
infrastructure setup since we use multiple (non-MS) languages/platforms here.</li>
          <li>
It looks like MS wants to ignore the thriving and long-standing community of open
source unit testing tools. I'm willing to bet that <a href="http://www.nunit.org/index.php" target="_blank">NUnit</a> (and <a href="http://www.mbunit.com/" target="_blank">MbUnit</a>,
etc.) has more code using it than <a id="ctl00_LibFrame_MainContent_ctl53" onclick="javascript:Track('ctl00_LibFrame_MainContent_cpe218312_c|ctl00_LibFrame_MainContent_ctl53',this);" href="http://msdn2.microsoft.com/en-us/library/ms244252.aspx"><font color="#0000ff">Microsoft.VisualStudio.TestTools.UnitTesting</font></a>.
Yet, if I want to use the integrated Test menu in VS.NET, I need to rewrite my unit
test code to use near-identical attributes for my unit tests (e.g. [TestMethod()]
vs. [Test]).</li>
          <li>
Code coverage is not available in VS.NET Pro. I guess code coverage isn't something
that developers should be doing - well, unless they shell out tons of money to get
it done. Thankfully, there are <a href="http://www.ncover.com/download/discontinued" target="_blank">free
alternatives</a>, with cheap upgrades to the latest version.</li>
          <li>
I want to easily run and debug my unit tests. I know Resharper can do this, but I
haven't installed that in VS.NET 2008 due to the number of issues I had with it. (Yes,
I know an EAP is coming out soon, but I also have CodeRush and Refactor, which work
fine with 2008.) I like <a href="http://www.testdriven.net/" target="_blank">TestDriven.net</a>, 
but I'd like to be sure that it <a href="http://weblogs.asp.net/nunitaddin/archive/2007/07/06/microsoft-amp-testdriven-net.aspx" target="_blank">doesn't
go away</a>.</li>
          <li>
The documentation is too cluttered. If you're going to give me a list of what's included
and what's not included in the Pro version, then why not just separate the documentation
to make it easier for me to see what capabilities I have (and what I don't).</li>
        </ul>
        <p>
In short, it's disappointing that MS has chosen to force people to one specific way
of writing unit tests that is against industry norms. ASP.NET has shown me that they
do understand the provider model, so why not use it here to allow me to run and debug
my unit tests using whatever tools I want.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=49eb05a0-76a2-47be-baf0-421e12d0fa10" />
      </body>
      <title>Unit testing with VS.NET 2008 Pro</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,49eb05a0-76a2-47be-baf0-421e12d0fa10.aspx</guid>
      <link>http://www.distribucon.com/blog/UnitTestingWithVSNET2008Pro.aspx</link>
      <pubDate>Mon, 04 Feb 2008 17:01:31 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/bb385902.aspx" target="_blank"&gt;This
link&lt;/a&gt; explains the unit testing tools available in VS.NET 2008 Professional. My
take after reading that section is that Microsoft doesn't get it. Here is my list
of observations about this section. Feel free to leave a comment to tell me where
I'm wrong.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
I feel like this is nothing more than an upsell to get me to go and buy VS.NET TeamSystem.
Sorry, that's not going to happen. TeamSystem is way too expensive (both initially
and in setup/maintenance time for a TFS server). Besides, we have an existing development
infrastructure setup since we use multiple (non-MS) languages/platforms here.&lt;/li&gt;
&lt;li&gt;
It looks like MS wants to ignore the thriving and long-standing community of open
source unit testing tools. I'm willing to bet that &lt;a href="http://www.nunit.org/index.php" target="_blank"&gt;NUnit&lt;/a&gt; (and &lt;a href="http://www.mbunit.com/" target="_blank"&gt;MbUnit&lt;/a&gt;,
etc.) has more code using it than &lt;a id="ctl00_LibFrame_MainContent_ctl53" onclick="javascript:Track('ctl00_LibFrame_MainContent_cpe218312_c|ctl00_LibFrame_MainContent_ctl53',this);" href="http://msdn2.microsoft.com/en-us/library/ms244252.aspx"&gt;&lt;font color="#0000ff"&gt;Microsoft.VisualStudio.TestTools.UnitTesting&lt;/font&gt;&lt;/a&gt;.
Yet, if I want to use the integrated Test menu in VS.NET, I need to rewrite my unit
test code to use near-identical attributes for my unit tests (e.g. [TestMethod()]
vs. [Test]).&lt;/li&gt;
&lt;li&gt;
Code coverage is not available in VS.NET Pro. I guess code coverage isn't something
that developers should be doing - well, unless they shell out tons of money to get
it done. Thankfully, there are &lt;a href="http://www.ncover.com/download/discontinued" target="_blank"&gt;free
alternatives&lt;/a&gt;, with cheap upgrades to the latest version.&lt;/li&gt;
&lt;li&gt;
I want to easily run and debug my unit tests. I know Resharper can do this, but I
haven't installed that in VS.NET 2008 due to the number of issues I had with it. (Yes,
I know an EAP is coming out soon, but I also have CodeRush and Refactor, which work
fine with 2008.) I like &lt;a href="http://www.testdriven.net/" target="_blank"&gt;TestDriven.net&lt;/a&gt;,&amp;nbsp;
but I'd like to be sure that it &lt;a href="http://weblogs.asp.net/nunitaddin/archive/2007/07/06/microsoft-amp-testdriven-net.aspx" target="_blank"&gt;doesn't
go away&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
The documentation is too cluttered. If you're going to give me a list of what's included
and what's not included in the Pro version, then why not just separate the documentation
to make it easier for me to see what capabilities I have (and what I don't).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In short, it's disappointing that MS has chosen to force people to one specific way
of writing unit tests that is against industry norms. ASP.NET has shown me that they
do understand the provider model, so why not use it here to allow me to run and debug
my unit tests using whatever tools I want.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=49eb05a0-76a2-47be-baf0-421e12d0fa10" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,49eb05a0-76a2-47be-baf0-421e12d0fa10.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=f7300437-a68d-4f9f-befd-e4a6ebc932cc</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,f7300437-a68d-4f9f-befd-e4a6ebc932cc.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,f7300437-a68d-4f9f-befd-e4a6ebc932cc.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=f7300437-a68d-4f9f-befd-e4a6ebc932cc</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I would like to take it upon myself to announce the formation of the Milwaukee chapter
of the ALT.NET UserGroup. It will meet the first Wednesday of every month, with the
first meeting to take place on 3/5/08 @ 7pm at 10000 Innovation Drive, Milwaukee,
WI. Pizza and drinks will be served, and the event will be free to attend. Thanks
to <a href="http://www.spiderlogic.com" target="_blank">SpiderLogic</a> for sponsoring
the first meeting.
</p>
        <p>
This group will cover agile development tools and techniques with .NET, best practices
for architecture and coding, emerging technologies, and anything else the group decides
to cover. For more backstory on ALT.NET, read <a href="http://www.distribucon.com/blog/PermaLink,guid,8d7106a3-0697-4fe8-8bb7-04bb88f8f80d.aspx" target="_blank">this
post</a>. The use group will be a very participant-driven group. I will not look to
lead this group in any significant way, other than to call this group to order, and
get people involved in sustaining it. I've learned from other user groups that if
a group is too dependent upon one person, it is a matter of time before it fails.
</p>
        <p>
For the first meeting's agenda, I propose we get some volunteers to take on some minimum
responsibilities and then break into an <a href="http://en.wikipedia.org/wiki/Open_Space_Technology" target="_blank">OpenSpaces</a> format,
where technical topics will be presented by anyone who wants to present. I don't want
this to be yet another 1-way presentation medium for 1-2 hour topics, so be prepared
to be engaged, discuss, and share (bring your laptop to showcase code and/or slides).
I'll take a swipe at talking about ASP.NET MVC this first meeting. If you have something
you want to see covered, or especially if you want to cover something, post a comment,
and we'll get it on the agenda.
</p>
        <p>
Please pass this notice around to anyone you think will be interested! If you plan
on attending, I would appreciate either a comment on this blog or email to <a href="mailto:dmiser@distribucon.com">dmiser@distribucon.com</a>,
just so we can gauge how much food and drink to have on hand. I am really excited
about this, and look forward to seeing everyone there!!
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=f7300437-a68d-4f9f-befd-e4a6ebc932cc" />
      </body>
      <title>ALT.NET UserGroup, Milwaukee Chapter</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,f7300437-a68d-4f9f-befd-e4a6ebc932cc.aspx</guid>
      <link>http://www.distribucon.com/blog/ALTNETUserGroupMilwaukeeChapter.aspx</link>
      <pubDate>Fri, 01 Feb 2008 21:46:14 GMT</pubDate>
      <description>&lt;p&gt;
I would like to take it upon myself to announce the formation of the Milwaukee chapter
of the ALT.NET UserGroup. It will meet the first Wednesday of every month, with the
first meeting to take place on 3/5/08 @ 7pm at 10000 Innovation Drive, Milwaukee,
WI. Pizza and drinks will be served, and the event will be free to attend. Thanks
to &lt;a href="http://www.spiderlogic.com" target="_blank"&gt;SpiderLogic&lt;/a&gt; for sponsoring
the first meeting.
&lt;/p&gt;
&lt;p&gt;
This group will cover agile development tools and techniques with .NET, best practices
for architecture and coding, emerging technologies, and anything else the group decides
to cover. For more backstory on ALT.NET, read &lt;a href="http://www.distribucon.com/blog/PermaLink,guid,8d7106a3-0697-4fe8-8bb7-04bb88f8f80d.aspx" target="_blank"&gt;this
post&lt;/a&gt;. The use group will be a very participant-driven group. I will not look to
lead this group in any significant way, other than to call this group to order, and
get people involved in sustaining it. I've learned from other user groups that if
a group is too dependent upon one person, it is a matter of time before it fails.
&lt;/p&gt;
&lt;p&gt;
For the first meeting's agenda, I propose we get some volunteers to take on some minimum
responsibilities and then break into an &lt;a href="http://en.wikipedia.org/wiki/Open_Space_Technology" target="_blank"&gt;OpenSpaces&lt;/a&gt; format,
where technical topics will be presented by anyone who wants to present. I don't want
this to be yet another 1-way presentation medium for 1-2 hour topics, so be prepared
to be engaged, discuss, and share (bring your laptop to showcase code and/or slides).
I'll take a swipe at talking about ASP.NET MVC this first meeting. If you have something
you want to see covered, or especially if you want to cover something, post a comment,
and we'll get it on the agenda.
&lt;/p&gt;
&lt;p&gt;
Please pass this notice around to anyone you think will be interested! If you plan
on attending, I would appreciate either a comment on this blog or email to &lt;a href="mailto:dmiser@distribucon.com"&gt;dmiser@distribucon.com&lt;/a&gt;,
just so we can gauge how much food and drink to have on hand. I am really excited
about this, and look forward to seeing everyone there!!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=f7300437-a68d-4f9f-befd-e4a6ebc932cc" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,f7300437-a68d-4f9f-befd-e4a6ebc932cc.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=819d903f-b3c6-448e-ba57-83ec077dd150</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,819d903f-b3c6-448e-ba57-83ec077dd150.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,819d903f-b3c6-448e-ba57-83ec077dd150.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=819d903f-b3c6-448e-ba57-83ec077dd150</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I have a .NET application that generates an XML file via serialization (through XmlTextWriter)
and submits the data via https. Recently, they changed something on their end to only
accept an upper cased UTF-8 encoding, like this:
</p>
        <pre>
          <code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; </code>
        </pre>
        <p>
Unfortunately, using the .NET classes mentioned above, it generates the encoding string
in lower case. I could find one mention of this on google, and they said to have the
other company change (not an option here), or override XmlTextWriter. I went with
that approach, making heavy use of <a href="http://www.aisto.com/roeder/dotnet" target="_blank">Reflector</a> along
the way. I started by looking at the WriteStartDocument method, but realized that
the private StartDocument is the thing that generates the output. It also gets called
by the overloaded WriteStartDocument, so I'd need to override that method, too. However,
in the private StartDocument method, it uses a bunch of private variables and generates
output via another private method, InternalWriteProcessingInstructions. Ugly. At this
point I realize that XmlTextWriter is not a class made for inheriting. 
</p>
        <p>
Back to Reflector, and I notice that the Encoding.WebName is the property used to
write out the encoding string. I now create a descendant class of UTF8Encoding. The
class is listed below. Now I just call XmlTextWriter, passing in UpperCaseUTF8Encoding.UpperCaseUTF8
for the Encoding type, and everything works perfectly. 
</p>
        <pre class="code">
          <span style="color: rgb(0,0,255)">public</span>
          <span style="color: rgb(0,0,255)">class</span>
          <span style="color: rgb(43,145,175)">UpperCaseUTF8Encoding</span> : <span style="color: rgb(43,145,175)">UTF8Encoding </span> { <span style="color: rgb(0,0,255)">public</span><span style="color: rgb(0,0,255)">override</span><span style="color: rgb(0,0,255)">string</span> WebName
{ <span style="color: rgb(0,0,255)">get</span> { <span style="color: rgb(0,0,255)">return</span><span style="color: rgb(0,0,255)">base</span>.WebName.ToUpper();
} } <span style="color: rgb(0,0,255)">public</span><span style="color: rgb(0,0,255)">static</span><span style="color: rgb(43,145,175)">UpperCaseUTF8Encoding</span> UpperCaseUTF8
{ <span style="color: rgb(0,0,255)">get </span> { <span style="color: rgb(0,0,255)">if</span> (upperCaseUtf8Encoding
== <span style="color: rgb(0,0,255)">null</span>) upperCaseUtf8Encoding = <span style="color: rgb(0,0,255)">new</span><span style="color: rgb(43,145,175)">UpperCaseUTF8Encoding</span>(); <span style="color: rgb(0,0,255)">return</span> upperCaseUtf8Encoding;
} } <span style="color: rgb(0,0,255)">private</span><span style="color: rgb(0,0,255)">static</span><span style="color: rgb(43,145,175)">UpperCaseUTF8Encoding</span> upperCaseUtf8Encoding
= <span style="color: rgb(0,0,255)">null</span>; }</pre>
        <a href="http://11011.net/software/vspaste">
          <a href="http://11011.net/software/vspaste">
            <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=819d903f-b3c6-448e-ba57-83ec077dd150" />
          </a>
        </a>
      </body>
      <title>Making the Encoding property upper case during XmlSerialization</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,819d903f-b3c6-448e-ba57-83ec077dd150.aspx</guid>
      <link>http://www.distribucon.com/blog/MakingTheEncodingPropertyUpperCaseDuringXmlSerialization.aspx</link>
      <pubDate>Tue, 29 Jan 2008 18:23:57 GMT</pubDate>
      <description>&lt;p&gt;
I have a .NET application that generates an XML file via serialization (through XmlTextWriter)
and submits the data via https. Recently, they changed something on their end to only
accept an upper cased UTF-8 encoding, like this:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; &amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Unfortunately, using the .NET classes mentioned above, it generates the encoding string
in lower case. I could find one mention of this on google, and they said to have the
other company change (not an option here), or override XmlTextWriter. I went with
that approach, making heavy use of &lt;a href="http://www.aisto.com/roeder/dotnet" target="_blank"&gt;Reflector&lt;/a&gt; along
the way. I started by looking at the WriteStartDocument method, but realized that
the private StartDocument is the thing that generates the output. It also gets called
by the overloaded WriteStartDocument, so I'd need to override that method, too. However,
in the private StartDocument method, it uses a bunch of private variables and generates
output via another private method, InternalWriteProcessingInstructions. Ugly. At this
point I realize that XmlTextWriter is not a class made for inheriting. 
&lt;p&gt;
Back to Reflector, and I notice that the Encoding.WebName is the property used to
write out the encoding string. I now create a descendant class of UTF8Encoding. The
class is listed below. Now I just call XmlTextWriter, passing in UpperCaseUTF8Encoding.UpperCaseUTF8
for the Encoding type, and everything works perfectly. &lt;pre class="code"&gt;    &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;UpperCaseUTF8Encoding&lt;/span&gt; : &lt;span style="color: rgb(43,145,175)"&gt;UTF8Encoding &lt;/span&gt; { &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;override&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; WebName
{ &lt;span style="color: rgb(0,0,255)"&gt;get&lt;/span&gt; { &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;base&lt;/span&gt;.WebName.ToUpper();
} } &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;UpperCaseUTF8Encoding&lt;/span&gt; UpperCaseUTF8
{ &lt;span style="color: rgb(0,0,255)"&gt;get &lt;/span&gt; { &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (upperCaseUtf8Encoding
== &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;) upperCaseUtf8Encoding = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;UpperCaseUTF8Encoding&lt;/span&gt;(); &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; upperCaseUtf8Encoding;
} } &lt;span style="color: rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;UpperCaseUTF8Encoding&lt;/span&gt; upperCaseUtf8Encoding
= &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;; }&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=819d903f-b3c6-448e-ba57-83ec077dd150" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,819d903f-b3c6-448e-ba57-83ec077dd150.aspx</comments>
      <category>.NET</category>
      <category>XML</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=198eb2f0-2898-4f8e-9f6d-b1726e3a5fb1</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,198eb2f0-2898-4f8e-9f6d-b1726e3a5fb1.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,198eb2f0-2898-4f8e-9f6d-b1726e3a5fb1.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=198eb2f0-2898-4f8e-9f6d-b1726e3a5fb1</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I had a need to move some VB.NET code to C# today. We're still not at the point where
we can just mix and match languages within an assembly, and in this case, it would
be more work than I wanted to separate things out. I looked around the net, and the
best code converter that I found (read: it successfully converted everything I threw
at it, where others failed) was <a href="http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx" target="_blank">this
one</a>.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=198eb2f0-2898-4f8e-9f6d-b1726e3a5fb1" />
      </body>
      <title>VB.NET to C# conversion</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,198eb2f0-2898-4f8e-9f6d-b1726e3a5fb1.aspx</guid>
      <link>http://www.distribucon.com/blog/VBNETToCConversion.aspx</link>
      <pubDate>Thu, 24 Jan 2008 15:36:42 GMT</pubDate>
      <description>&lt;p&gt;
I had a need to move some VB.NET code to C# today. We're still not at the point where
we can just mix and match languages within an assembly, and in this case, it would
be more work than I wanted to separate things out. I looked around the net, and the
best code converter that I found (read: it successfully converted everything I threw
at it, where others failed) was &lt;a href="http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx" target="_blank"&gt;this
one&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=198eb2f0-2898-4f8e-9f6d-b1726e3a5fb1" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,198eb2f0-2898-4f8e-9f6d-b1726e3a5fb1.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=b976217f-2f8e-44f1-9e5b-a52e2e8713ce</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,b976217f-2f8e-44f1-9e5b-a52e2e8713ce.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,b976217f-2f8e-44f1-9e5b-a52e2e8713ce.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b976217f-2f8e-44f1-9e5b-a52e2e8713ce</wfw:commentRss>
      <slash:comments>5</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
To be sure, this is an incomplete list, but it is a good start. Here's what I don't
like about LINQ to SQL:
</p>
        <ul>
          <li>
It only works with MSSQL. Yes, this point has been beaten to death, but it is entirely
justified. <a href="http://code2code.net/DB_Linq/" target="_blank">Third party solutions</a> don't
cut it. LINQ to SQL intentionally seeks to exclude a sizeable population because of
this hair-brained decision. 
</li>
          <li>
No way to easily specify adhoc LINQ queries. <a href="http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx" target="_blank">This</a> doesn't
count. I know the benefits of design-time queries, but I should also be allowed to
shoot myself to get the added flexibility if I so choose. Building up expression trees
is not a viable option for every day development. 
</li>
          <li>
The constant labeling of LINQ to SQL as an OR/M. That label considerably overstates
what this technology does. One to one mapping between a table and a class is not really
OR/M. It seems like they want to force you to change your database by writing stored
procs and views to make your object model better. 
</li>
          <li>
There is no automated way to easily pick up changes to the database schema. 
</li>
          <li>
There is no easy way to preserve changes to the generated code. e.g. I change the
name of the automatically generated class from collection_details to CollectionDetails,
but I evolve the schema of the table. When I re-add the table, I need to set all of
the custom properties again. I know I shouldn't change generated code, but see the
next point. 
</li>
          <li>
Speaking of collection_details, it would be much better if the underlying class generator
had some options to clean up legacy table names (e.g. remove underscores, camel case
resulting table and column names). 
</li>
          <li>
No many-to-many support. In short, when you have an <a href="http://en.wikipedia.org/wiki/Associative_Entities" target="_blank">junction
table</a> (aka associative table or cross-reference table), you will need to write
code like this: User.UserPermissions[0].Permission vs. User.Permissions[0]. Until
we see LINQ to Entity (if ever), we do have <a href="http://blogs.msdn.com/mitsu/archive/2007/06/21/how-to-implement-a-many-to-many-relationship-using-linq-to-sql.aspx" target="_blank">this</a>,
but you can't use the new entity in a LINQ query. 
</li>
          <li>
There is no built-in solution to using LINQ across tiers. I don't want to expose my
LINQ classes (see the point above about the tight coupling between database and objects)
as I may want to change my database, and I don't want that cascading to all of the
places that use it. There is also no diffgram, so even if I did it, I would have to
write my own change tracking and resolving support. I went to an OpenSpaces meeting
on this very topic during CodeMash, and the consensus was not flattering.</li>
        </ul>
        <p>
In short, it seems like this part of LINQ was released way before it was ready. But
it does demo well...
</p>
        <p>
Feel free to add your own grievance to the comments.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=b976217f-2f8e-44f1-9e5b-a52e2e8713ce" />
      </body>
      <title>Things I Don't Like About LINQ to SQL</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,b976217f-2f8e-44f1-9e5b-a52e2e8713ce.aspx</guid>
      <link>http://www.distribucon.com/blog/ThingsIDontLikeAboutLINQToSQL.aspx</link>
      <pubDate>Fri, 11 Jan 2008 18:23:26 GMT</pubDate>
      <description>&lt;p&gt;
To be sure, this is an incomplete list, but it is a good start. Here's what I don't
like about LINQ to SQL:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
It only works with MSSQL. Yes, this point has been beaten to death, but it is entirely
justified. &lt;a href="http://code2code.net/DB_Linq/" target="_blank"&gt;Third party solutions&lt;/a&gt; don't
cut it. LINQ to SQL intentionally seeks to exclude a sizeable population because of
this hair-brained decision. 
&lt;li&gt;
No way to easily specify adhoc LINQ queries. &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx" target="_blank"&gt;This&lt;/a&gt; doesn't
count. I know the benefits of design-time queries, but I should also be allowed to
shoot myself to get the added flexibility if I so choose. Building up expression trees
is not a viable option for every day development. 
&lt;li&gt;
The constant labeling of LINQ to SQL as an OR/M. That label considerably overstates
what this technology does. One to one mapping between a table and a class is not really
OR/M. It seems like they want to force you to change your database by writing stored
procs and views to make your object model better. 
&lt;li&gt;
There is no automated way to easily pick up changes to the database schema. 
&lt;li&gt;
There is no easy way to preserve changes to the generated code. e.g. I change the
name of the automatically generated class from collection_details to CollectionDetails,
but I evolve the schema of the table. When I re-add the table, I need to set all of
the custom properties again. I know I shouldn't change generated code, but see the
next point. 
&lt;li&gt;
Speaking of collection_details, it would be much better if the underlying class generator
had some options to clean up legacy table names (e.g. remove underscores, camel case
resulting table and column names). 
&lt;li&gt;
No many-to-many support. In short, when you have an &lt;a href="http://en.wikipedia.org/wiki/Associative_Entities" target="_blank"&gt;junction
table&lt;/a&gt; (aka associative table or cross-reference table), you will need to write
code like this: User.UserPermissions[0].Permission vs. User.Permissions[0]. Until
we see LINQ to Entity (if ever), we do have &lt;a href="http://blogs.msdn.com/mitsu/archive/2007/06/21/how-to-implement-a-many-to-many-relationship-using-linq-to-sql.aspx" target="_blank"&gt;this&lt;/a&gt;,
but you can't use the new entity in a LINQ query. 
&lt;li&gt;
There is no built-in solution to using LINQ across tiers. I don't want to expose my
LINQ classes (see the point above about the tight coupling between database and objects)
as I may want to change my database, and I don't want that cascading to all of the
places that use it. There is also no diffgram, so even if I did it, I would have to
write my own change tracking and resolving support. I went to an OpenSpaces meeting
on this very topic during CodeMash, and the consensus was not flattering.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In short, it seems like this part of LINQ was released way before it was ready. But
it does demo well...
&lt;/p&gt;
&lt;p&gt;
Feel free to add your own grievance to the comments.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=b976217f-2f8e-44f1-9e5b-a52e2e8713ce" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,b976217f-2f8e-44f1-9e5b-a52e2e8713ce.aspx</comments>
      <category>.NET</category>
      <category>LINQ</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=ecaf0c3a-f630-4fc9-8a20-b53fac515c8f</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,ecaf0c3a-f630-4fc9-8a20-b53fac515c8f.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,ecaf0c3a-f630-4fc9-8a20-b53fac515c8f.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=ecaf0c3a-f630-4fc9-8a20-b53fac515c8f</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I have been reading Dustin Campbell's series, <a href="http://diditwith.net/2007/12/29/TwelveDaysOfRefactorXmasDayTenRefactoringInXMLLiterals.aspx" target="_blank">The
12 Days of Refactor! X-mas</a>, with interest. He's a very good writer, and has broken
down a bunch of Developer Express features into easy to digest chunks of information.
</p>
        <p>
The episode I linked to above touched on the <a href="http://msdn2.microsoft.com/en-us/library/ms364068%28vs.80%29.aspx#vb9overview_topic6" target="_blank">XML
Literal</a> support that shipped with VB in Visual Studio 2008. The one sentence summary
of this technology is that it lets the VB compiler translate raw XML in the source
code into strongly-typed code using XML classes under the hood. It's a very nice idea,
and I encourage you to look at the links to learn a little more about it.
</p>
        <p>
While the VB team thought this was a good idea and added the feature, Anders and the
C# team believed that it was superfluous to add such a thing to the C# side. I haven't
really made up my mind which group I side with yet. However, Anders is benevolent
:-), so he gave us the little-documented PasteXmlAsLinq addin that will take XML on
the clipboard and paste it into a file in C# syntax building the XML up using classes
like XElement.
</p>
        <p>
In a default install of VS2008, open C:\Program Files\Microsoft Visual Studio 9.0\Samples\1033\CSharpSamples.zip
and extract the LinqSamples\PasteXmlAsLinq files. There is a Readme.html file in there
that tells you how to build, install and use the addin. 
</p>
        <p>
While this isn't the same as VB's support for XML Literals, it does make things easier
to work with. 
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=ecaf0c3a-f630-4fc9-8a20-b53fac515c8f" />
      </body>
      <title>VB XML Literal support in C#</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,ecaf0c3a-f630-4fc9-8a20-b53fac515c8f.aspx</guid>
      <link>http://www.distribucon.com/blog/VBXMLLiteralSupportInC.aspx</link>
      <pubDate>Sun, 30 Dec 2007 23:02:25 GMT</pubDate>
      <description>&lt;p&gt;
I have been reading Dustin Campbell's series, &lt;a href="http://diditwith.net/2007/12/29/TwelveDaysOfRefactorXmasDayTenRefactoringInXMLLiterals.aspx" target="_blank"&gt;The
12 Days of Refactor! X-mas&lt;/a&gt;, with interest. He's a very good writer, and has broken
down a bunch of Developer Express features into easy to digest chunks of information.
&lt;/p&gt;
&lt;p&gt;
The episode I linked to above touched on the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms364068%28vs.80%29.aspx#vb9overview_topic6" target="_blank"&gt;XML
Literal&lt;/a&gt; support that shipped with VB in Visual Studio 2008. The one sentence summary
of this technology is that it lets the VB compiler translate raw XML in the source
code into strongly-typed code using XML classes under the hood. It's a very nice idea,
and I encourage you to look at the links to learn a little more about it.
&lt;/p&gt;
&lt;p&gt;
While the VB team thought this was a good idea and added the feature, Anders and the
C# team believed that it was superfluous to add such a thing to the C# side. I haven't
really made up my mind which group I side with yet. However, Anders is benevolent
:-), so he gave us the little-documented PasteXmlAsLinq addin that will take XML on
the clipboard and paste it into a file in C# syntax building the XML up using classes
like XElement.
&lt;/p&gt;
&lt;p&gt;
In a default install of VS2008, open C:\Program Files\Microsoft Visual Studio 9.0\Samples\1033\CSharpSamples.zip
and extract the LinqSamples\PasteXmlAsLinq files. There is a Readme.html file in there
that tells you how to build, install and use the addin. 
&lt;/p&gt;
&lt;p&gt;
While this isn't the same as VB's support for XML Literals, it does make things easier
to work with. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=ecaf0c3a-f630-4fc9-8a20-b53fac515c8f" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,ecaf0c3a-f630-4fc9-8a20-b53fac515c8f.aspx</comments>
      <category>.NET</category>
      <category>LINQ</category>
      <category>XML</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=d78e55cd-4acd-4ae3-819a-e63d9b6275df</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,d78e55cd-4acd-4ae3-819a-e63d9b6275df.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,d78e55cd-4acd-4ae3-819a-e63d9b6275df.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=d78e55cd-4acd-4ae3-819a-e63d9b6275df</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
At the risk of another "Me, too!" post, I thought I'd highlight several links that
I have found to be helpful, and for a value-added bonus, talk about why this release
matters to me. Back in the day (oh boy, does that make me sound old!), I learned how
to program for the Internet by using straight HTML and Delphi to create CGI and ISAPI
extensions. In order to do this, you needed to be quite aware of how the actual protocols
worked, and what to do to make things behave as you'd expect. I stayed with web development
up until I was using COM objects (again, written in Delphi) from an ASP page. After
that, I wasn't into the web development scene much on a full-time basis.
</p>
        <p>
ASP.NET 1.0 and 2.0 came along, and I found them to be quite daunting. It seemed as
if it was framework built upon framework, layered with add-ins to do what I thought
used to be simple things. 
</p>
        <p>
It appears to me that there has been a resurgence to move away from the barrage of
constant abstractions, and to instead embrace the simplicity of the web (see the popularity
of REST, Rails, and the buzz around ASP.NET MVC for some examples of this). 
</p>
        <p>
So for me, the reason I am excited is that not only can I once again utilize my knowledge
about how the web works, but I can use it in new ways that will make my applications
even better (e.g. TDD, scaffolding, etc.). At any rate, here's the set of links that
I think matter for ASP.NET MVC: 
</p>
        <ul>
          <li>
            <a href="http://asp.net/downloads/3.5-extensions/" target="_blank">ASP.NET Extensions
download</a> - including the MVC bits 
</li>
          <li>
            <a href="http://asp.net/downloads/3.5-extensions/MVCToolkit.zip" target="_blank">MVC
Toolkit</a> - extra download to help with scaffolding (aka dynamic data controls) 
</li>
          <li>
Scott Guthrie's series of tutorials: <a href="http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx" target="_blank">Part
1</a>, <a href="http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx" target="_blank">Part
2</a>, <a href="http://weblogs.asp.net/scottgu/archive/2007/12/06/asp-net-mvc-framework-part-3-passing-viewdata-from-controllers-to-views.aspx" target="_blank">Part
3</a>, and <a href="http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-mvc-framework-part-4-handling-form-edit-and-post-scenarios.aspx" target="_blank">Part
4</a></li>
          <li>
            <a href="http://www.hanselman.com/blog/ASPNET35ExtensionsPlusMVCHowToScreencast.aspx" target="_blank">Scott
Hanselman's video tutorial on the MVC framework</a>
          </li>
          <li>
            <a href="http://haacked.com/" target="_blank">Phil Haack's blog</a> (good posts on
dependency injection and TDD, among others) 
</li>
          <li>
            <a href="http://blog.wekeroad.com/" target="_blank">Rob Conery's blog</a> (check out
the posts on the MVC UI helpers and REST) 
</li>
        </ul>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=d78e55cd-4acd-4ae3-819a-e63d9b6275df" />
      </body>
      <title>ASP.NET MVC CTP released</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,d78e55cd-4acd-4ae3-819a-e63d9b6275df.aspx</guid>
      <link>http://www.distribucon.com/blog/ASPNETMVCCTPReleased.aspx</link>
      <pubDate>Mon, 10 Dec 2007 20:40:56 GMT</pubDate>
      <description>&lt;p&gt;
At the risk of another "Me, too!" post, I thought I'd highlight several links that
I have found to be helpful, and for a value-added bonus, talk about why this release
matters to me. Back in the day (oh boy, does that make me sound old!), I learned how
to program for the Internet by using straight HTML and Delphi to create CGI and ISAPI
extensions. In order to do this, you needed to be quite aware of how the actual protocols
worked, and what to do to make things behave as you'd expect. I stayed with web development
up until I was using COM objects (again, written in Delphi) from an ASP page. After
that, I wasn't into the web development scene much on a full-time basis.
&lt;/p&gt;
&lt;p&gt;
ASP.NET 1.0 and 2.0 came along, and I found them to be quite daunting. It seemed as
if it was framework built upon framework, layered with add-ins to do what I thought
used to be simple things. 
&lt;/p&gt;
&lt;p&gt;
It appears to me that there has been a resurgence to move away from the barrage of
constant abstractions, and to instead embrace the simplicity of the web (see the popularity
of REST, Rails, and the buzz around ASP.NET MVC for some examples of this). 
&lt;/p&gt;
&lt;p&gt;
So for me, the reason I am excited is that not only can I once again utilize my knowledge
about how the web works, but I can use it in new ways that will make my applications
even better (e.g. TDD, scaffolding, etc.). At any rate, here's the set of links that
I think matter for ASP.NET MVC: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://asp.net/downloads/3.5-extensions/" target="_blank"&gt;ASP.NET Extensions
download&lt;/a&gt; - including the MVC bits 
&lt;li&gt;
&lt;a href="http://asp.net/downloads/3.5-extensions/MVCToolkit.zip" target="_blank"&gt;MVC
Toolkit&lt;/a&gt; - extra download to help with scaffolding (aka dynamic data controls) 
&lt;li&gt;
Scott Guthrie's series of tutorials: &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx" target="_blank"&gt;Part
1&lt;/a&gt;, &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx" target="_blank"&gt;Part
2&lt;/a&gt;, &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/12/06/asp-net-mvc-framework-part-3-passing-viewdata-from-controllers-to-views.aspx" target="_blank"&gt;Part
3&lt;/a&gt;, and &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-mvc-framework-part-4-handling-form-edit-and-post-scenarios.aspx" target="_blank"&gt;Part
4&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://www.hanselman.com/blog/ASPNET35ExtensionsPlusMVCHowToScreencast.aspx" target="_blank"&gt;Scott
Hanselman's video tutorial on the MVC framework&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://haacked.com/" target="_blank"&gt;Phil Haack's blog&lt;/a&gt; (good posts on
dependency injection and TDD, among others) 
&lt;li&gt;
&lt;a href="http://blog.wekeroad.com/" target="_blank"&gt;Rob Conery's blog&lt;/a&gt; (check out
the posts on the MVC UI helpers and REST) 
&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=d78e55cd-4acd-4ae3-819a-e63d9b6275df" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,d78e55cd-4acd-4ae3-819a-e63d9b6275df.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=28ea6032-a07d-49b2-bfa3-7eb60522f908</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,28ea6032-a07d-49b2-bfa3-7eb60522f908.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,28ea6032-a07d-49b2-bfa3-7eb60522f908.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=28ea6032-a07d-49b2-bfa3-7eb60522f908</wfw:commentRss>
      <title>CodeMash</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,28ea6032-a07d-49b2-bfa3-7eb60522f908.aspx</guid>
      <link>http://www.distribucon.com/blog/CodeMash.aspx</link>
      <pubDate>Fri, 07 Dec 2007 20:26:22 GMT</pubDate>
      <description>&lt;p&gt;
I wanted to attend CodeMash last year, but waiting until the last minute worked against
me. This year I made sure to commit to the event early, so I just signed up and got
my hotel reservations sorted out. The sessions look to be pretty deep for a smaller
conference, and I'm excited about going there to talk shop.
&lt;/p&gt;
&lt;p&gt;
If you'll be going, drop me a line via comment here, and we'll be sure to sit down
and have a beverage or 2. If you're in the Milwaukee/Madison area, and want to chat
ALT.NET, it might be a good place to formally plan and launch the Milwaukee meetup.
&lt;/p&gt;
&lt;p&gt;
Hope to see you there! 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.codemash.org/"&gt;&lt;img alt="CodeMash &amp;ndash; I&amp;amp;apos;ll be there!" src="http://www.codemash.org/images/bloggerbadge2008.gif"&gt;&lt;/a&gt;&lt;a href="http://www.codemash.org/"&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=28ea6032-a07d-49b2-bfa3-7eb60522f908" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,28ea6032-a07d-49b2-bfa3-7eb60522f908.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=e2072bde-838f-4b18-8885-607394b10639</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,e2072bde-838f-4b18-8885-607394b10639.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,e2072bde-838f-4b18-8885-607394b10639.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=e2072bde-838f-4b18-8885-607394b10639</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you see an error like the following:
</p>
        <pre>
          <code>MSB6006: "NCover.Console.exe" exited with code 1. in build.proj(93, 3)</code>
        </pre>
        <p>
be sure to check that you are using the correct version of CoverLib.dll. In older
versions of NCover (e.g. 1.5.8), by default, this dll should be registered every time
the NCover task is run. I haven't found that to be true, though. I had an older version
of NCover installed somewhere else on the build machine, and I kept on having my build
fail because version 1.5.8 of NCover.Console.exe was loading version 1.5.5 of CoverLib.dll.
</p>
        <p>
By manually registering the correct version of CoverLib.dll, I got the build working
again.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=e2072bde-838f-4b18-8885-607394b10639" />
      </body>
      <title>CC.NET: NCover.Console exited with code 1</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,e2072bde-838f-4b18-8885-607394b10639.aspx</guid>
      <link>http://www.distribucon.com/blog/CCNETNCoverConsoleExitedWithCode1.aspx</link>
      <pubDate>Tue, 27 Nov 2007 04:21:48 GMT</pubDate>
      <description>&lt;p&gt;
If you see an error like the following:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;MSB6006: "NCover.Console.exe" exited with code 1. in build.proj(93, 3)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
be sure to check that you are using the correct version of CoverLib.dll. In older
versions of NCover (e.g. 1.5.8), by default, this dll should be registered every time
the NCover task is run. I haven't found that to be true, though. I had an older version
of NCover installed somewhere else on the build machine, and I kept on having my build
fail because version 1.5.8 of NCover.Console.exe was loading version 1.5.5 of CoverLib.dll.
&lt;/p&gt;
&lt;p&gt;
By manually registering the correct version of CoverLib.dll, I got the build working
again.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=e2072bde-838f-4b18-8885-607394b10639" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,e2072bde-838f-4b18-8885-607394b10639.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=d1e0db1f-577c-49d3-803e-a38193b786a0</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,d1e0db1f-577c-49d3-803e-a38193b786a0.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,d1e0db1f-577c-49d3-803e-a38193b786a0.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=d1e0db1f-577c-49d3-803e-a38193b786a0</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Here is my quick and dirty laundry list of issues that I've been having with MSBuild
over the past few days. 
</p>
        <ul>
          <li>
You can't detect which target is being executed, therefore conditional execution of
tasks cannot be driven by targets. Instead, you need to start a crazy chain of adding
targets and updating properties and adding the new target to DependsOnTargets for
the original target. No wonder the build file becomes unwieldy so quickly. 
</li>
          <li>
It is very unintuitive and cumbersome to update property values. If I want to set
a property one way in one case, and another way in a different case, it is not easy.
Besides, the syntax for the CreateProperty task is way more complex than it needs
to be to simply update a property. 
</li>
          <li>
Brutal gymnastics are required to get around customizing build properties outside
of the confines of the Configuration mechanism for a given project. For example, let's
say I want to change the DocumentationFile parameter used in csc.exe, or change the
NoWarn directive. If you're calling an MSBuild task on your solution, you need to
specify those command-line parameters as /p: parameters from the command-line or track
what you want to do and add the actual command-line parameters to the Properties attribute.
It should be as simple as overriding the default build properties that exist in the
csproj file, but that doesn't work. 
</li>
          <li>
It lacks a way to list descriptive tags for all defined targets (c.f. "nant -projecthelp").</li>
        </ul>
        <p>
Apparently, I'm <a href="http://martinfowler.com/bliki/BuildLanguage.html" target="_blank">not
the only one</a> who sees this as a problem. I think Martin's idea of using a lightweight/script
language to control the build is the way to go. Granted, I'm coming to this conclusion
4 years after he is, but the point is still valid today. I'd like to have more language
elements in my build process to deal with branch, loop and flow so I can react better
than I can with an XML file.
</p>
        <p>
My bottom line: MSBuild may be a good tool for VS.NET to use because it can tightly
control the format, but it is not a generic solution for controlling a medium-to-big
size build process. 
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=d1e0db1f-577c-49d3-803e-a38193b786a0" />
      </body>
      <title>Why MSBuild sucks</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,d1e0db1f-577c-49d3-803e-a38193b786a0.aspx</guid>
      <link>http://www.distribucon.com/blog/WhyMSBuildSucks.aspx</link>
      <pubDate>Fri, 09 Nov 2007 16:45:29 GMT</pubDate>
      <description>&lt;p&gt;
Here is my quick and dirty laundry list of issues that I've been having with MSBuild
over the past few days. 
&lt;ul&gt;
&lt;li&gt;
You can't detect which target is being executed, therefore conditional execution of
tasks cannot be driven by targets. Instead, you need to start a crazy chain of adding
targets and updating properties and adding the new target to DependsOnTargets for
the original target. No wonder the build file becomes unwieldy so quickly. 
&lt;li&gt;
It is very unintuitive and cumbersome to update property values. If I want to set
a property one way in one case, and another way in a different case, it is not easy.
Besides, the syntax for the CreateProperty task is way more complex than it needs
to be to simply update a property. 
&lt;li&gt;
Brutal gymnastics are required to get around customizing build properties outside
of the confines of the Configuration mechanism for a given project. For example, let's
say I want to change the DocumentationFile parameter used in csc.exe, or change the
NoWarn directive. If you're calling an MSBuild task on your solution, you need to
specify those command-line parameters as /p: parameters from the command-line or track
what you want to do and add the actual command-line parameters to the Properties attribute.
It should be as simple as overriding the default build properties that exist in the
csproj file, but that doesn't work. 
&lt;li&gt;
It lacks a way to list descriptive tags for all defined targets (c.f. "nant -projecthelp").&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Apparently, I'm &lt;a href="http://martinfowler.com/bliki/BuildLanguage.html" target="_blank"&gt;not
the only one&lt;/a&gt; who sees this as a problem. I think Martin's idea of using a lightweight/script
language to control the build is the way to go. Granted, I'm coming to this conclusion
4 years after he is, but the point is still valid today. I'd like to have more language
elements in my build process to deal with branch, loop and flow so I can react better
than I can with an XML file.
&lt;/p&gt;
&lt;p&gt;
My bottom line: MSBuild may be a good tool for VS.NET to use because it can tightly
control the format, but it is not a generic solution for controlling a medium-to-big
size build process. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=d1e0db1f-577c-49d3-803e-a38193b786a0" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,d1e0db1f-577c-49d3-803e-a38193b786a0.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=8827a2ad-75a2-4c42-a839-6e0666d69cc3</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,8827a2ad-75a2-4c42-a839-6e0666d69cc3.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,8827a2ad-75a2-4c42-a839-6e0666d69cc3.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=8827a2ad-75a2-4c42-a839-6e0666d69cc3</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've had some conversations with people about the label of ALT.NET. They are of the
opinion that it causes controversy by setting up the "elitist" vs. "everyone else"
mentality. This is not a new observations (see <a href="http://codebetter.com/blogs/jeremy.miller/archive/2007/10/14/my-official-alt-net-recap.aspx" target="_blank">here</a> and <a href="http://martinfowler.com/bliki/AltNetConf.html" target="_blank">here</a>,
e.g.).
</p>
        <p>
I'd like to propose that the divisiveness of the ALT.NET moniker be abolished as quickly
as possible. To that end, my proposal for the name is Pragmatic.NET. It's both a state
of mind and an homage to the Pragmatic Programmer series that touches on several of
the topics important to this group.
</p>
        <p>
Discuss...
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=8827a2ad-75a2-4c42-a839-6e0666d69cc3" />
      </body>
      <title>Pragmatic.NET</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,8827a2ad-75a2-4c42-a839-6e0666d69cc3.aspx</guid>
      <link>http://www.distribucon.com/blog/PragmaticNET.aspx</link>
      <pubDate>Thu, 08 Nov 2007 17:54:09 GMT</pubDate>
      <description>&lt;p&gt;
I've had some conversations with people about the label of ALT.NET. They are of the
opinion that it causes controversy by setting up the "elitist" vs. "everyone else"
mentality. This is not a new observations (see &lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2007/10/14/my-official-alt-net-recap.aspx" target="_blank"&gt;here&lt;/a&gt;&amp;nbsp;and &lt;a href="http://martinfowler.com/bliki/AltNetConf.html" target="_blank"&gt;here&lt;/a&gt;,
e.g.).
&lt;/p&gt;
&lt;p&gt;
I'd like to propose that the divisiveness of the ALT.NET moniker be abolished as quickly
as possible. To that end, my proposal for the name is Pragmatic.NET. It's both a state
of mind and an homage to the Pragmatic Programmer series that touches on several of
the topics important to this group.
&lt;/p&gt;
&lt;p&gt;
Discuss...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=8827a2ad-75a2-4c42-a839-6e0666d69cc3" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,8827a2ad-75a2-4c42-a839-6e0666d69cc3.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=8d7106a3-0697-4fe8-8bb7-04bb88f8f80d</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,8d7106a3-0697-4fe8-8bb7-04bb88f8f80d.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,8d7106a3-0697-4fe8-8bb7-04bb88f8f80d.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=8d7106a3-0697-4fe8-8bb7-04bb88f8f80d</wfw:commentRss>
      <slash:comments>5</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm more than a little disappointed that I missed the <a href="http://altnetconf.com/participants" target="_blank">ALT.NET
conference in Austin</a>, but I'm extremely happy that it looks like the movement
has crystallized and gained enough momentum to be a legitimate option for .NET developers.
Steve Kronsnoble made an analogy to the <a href="http://agilemanifesto.org/history.html" target="_blank">Agile
Manifesto</a>, where it took a bunch of informal participants and related ideas
and turned them into industry standards. Hopefully, when looking back on this event
years from now, people will be able to identify this as the genesis of  .NET.
</p>
        <p>
I really like the idea of <a href="http://altdotnet.org/" target="_blank">ALT.NET</a>,
and it maps to discussions I've had with many developers about trying to find a "Garden
Path" of .NET development. Some percentage of .NET developers will use whatever Microsoft
tells them to without question. That's fine, but that's not how I think. I like to
grab the best technology no matter where I find it (Open Source, other languages,
etc.) . I want to talk about things like <a href="http://www.nhibernate.org/" target="_blank">NHibernate</a>, <a href="http://www.springframework.net/" target="_blank">Spring.NET</a>, <a href="http://www.codeplex.com/subsonic" target="_blank">Subsonic</a>, <a href="http://feeds.feedburner.com/~r/ScottHanselman/~3/181552579/DevConnectionsTheASPNETMVCFramework.aspx" target="_blank">the
new</a><a href="http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx" target="_blank">ASP.MVC</a> framework,
Domain Driven Design, Test Driven Design, Unit Testing, and on and on. To me, that's
the excitement of ALT.NET.
</p>
        <p>
To do my part, I'd like to start a discussion on where and when to hold a local
Milwaukee version of this <a href="http://martinfowler.com/bliki/OpenSpace.html" target="_blank">OpenSpace
conference</a>. If you're passionate about .NET development and want to help shape
this new movement in the Milwaukee area, please leave a comment so we can find a way
to move the ball forward.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=8d7106a3-0697-4fe8-8bb7-04bb88f8f80d" />
      </body>
      <title>ALT.NET, Milwaukee Chapter</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,8d7106a3-0697-4fe8-8bb7-04bb88f8f80d.aspx</guid>
      <link>http://www.distribucon.com/blog/ALTNETMilwaukeeChapter.aspx</link>
      <pubDate>Thu, 08 Nov 2007 16:02:04 GMT</pubDate>
      <description>&lt;p&gt;
I'm more than a little disappointed that I missed the &lt;a href="http://altnetconf.com/participants" target="_blank"&gt;ALT.NET
conference in Austin&lt;/a&gt;, but I'm extremely happy that it looks like the movement
has crystallized and gained enough momentum to be a legitimate option for .NET developers.
Steve Kronsnoble&amp;nbsp;made an analogy to the &lt;a href="http://agilemanifesto.org/history.html" target="_blank"&gt;Agile
Manifesto&lt;/a&gt;, where it&amp;nbsp;took a bunch of informal participants and related ideas
and turned them into industry standards. Hopefully, when looking back on this event
years from now, people will be able to identify this as the genesis of&amp;nbsp; .NET.
&lt;/p&gt;
&lt;p&gt;
I really like the idea of &lt;a href="http://altdotnet.org/" target="_blank"&gt;ALT.NET&lt;/a&gt;,
and it maps to discussions I've had with many developers about trying to find a "Garden
Path" of .NET development. Some percentage of .NET developers will use whatever Microsoft
tells them to without question. That's fine, but that's not how I think. I like to
grab the best technology no matter where I find it (Open Source, other languages,
etc.)&amp;nbsp;. I want to talk about things like &lt;a href="http://www.nhibernate.org/" target="_blank"&gt;NHibernate&lt;/a&gt;, &lt;a href="http://www.springframework.net/" target="_blank"&gt;Spring.NET&lt;/a&gt;, &lt;a href="http://www.codeplex.com/subsonic" target="_blank"&gt;Subsonic&lt;/a&gt;, &lt;a href="http://feeds.feedburner.com/~r/ScottHanselman/~3/181552579/DevConnectionsTheASPNETMVCFramework.aspx" target="_blank"&gt;the
new&lt;/a&gt; &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx" target="_blank"&gt;ASP.MVC&lt;/a&gt; framework,
Domain Driven Design, Test Driven Design, Unit Testing, and on and on. To me, that's
the excitement of ALT.NET.
&lt;/p&gt;
&lt;p&gt;
To do my part,&amp;nbsp;I'd like to start a discussion on where and when to hold a local
Milwaukee version of this &lt;a href="http://martinfowler.com/bliki/OpenSpace.html" target="_blank"&gt;OpenSpace
conference&lt;/a&gt;. If you're passionate about .NET development and want to help shape
this new movement in the Milwaukee area, please leave a comment so we can find a way
to move the ball forward.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=8d7106a3-0697-4fe8-8bb7-04bb88f8f80d" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,8d7106a3-0697-4fe8-8bb7-04bb88f8f80d.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=5d258460-68ac-43e8-80a8-1835cd16390e</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,5d258460-68ac-43e8-80a8-1835cd16390e.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,5d258460-68ac-43e8-80a8-1835cd16390e.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=5d258460-68ac-43e8-80a8-1835cd16390e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I've been working more with data-binding
and the ObjectBindingSource component that <a href="http://www.distribucon.com/blog/PermaLink,guid,d23c9802-5669-4e57-bf30-eed8afdd7bd0.aspx" target="_new">I
wrote about here</a>. Here is some stripped-down sample code to help investigate more
data-binding concepts. <pre><code>class Customer { int Id; BindingList<ORDER>
Orders; } class Order { int OrderNumber; Product ProductInfo; } class Product { string
Vendor; Product Self; }
</ORDER></code></pre>
Assume that we want individual GUI components for the Customer object, and a grid
to display the associated orders, with the related Product information displayed along
with the Order. Here are some quick pseudo-code tips to get things wired up properly. 
<ul><li>
CustomerObjectBindingSource.DataSource = typeof(Customer) 
</li><li>
CustomerObjectBindingSource.BindableProperties.Add("Orders"). (If you don't do this,
the detail ObjectBindingSource won't work later on.) 
</li><li>
OrdersObjectBindingSource.DataSource = CustomerObjectBindingSource and OrdersObjectBindingSource.DataMember
= "Orders" 
</li><li>
OrdersObjectBindingSource.BindableProperties.Add("Product") 
</li><li>
DataGridView.DataSource = OrdersObjectBindingSource 
</li><li>
Modify the DataGridView column for Product by setting: 
<ul><li>
column.DataSource = ProductsBindingSource 
</li><li>
column.DisplayMember = "Name" 
</li><li>
column.ValueMember = Self</li></ul></li><li><b>**IMPORTANT**</b> - Use the same object references everywhere for the product objects
(i.e. in the DataGridView column and where you access them in your code). In the sample,
I use the productBindingSource component for both the lookup in the grid and the way
to lookup individual Product instances. Another alternative that I tested is to use
a singleton class for the collection. If you don't do this, you will get the dreaded
"DataGridViewComboBoxCell value is not valid" error when the grid tries to populate
the Product value.</li></ul><p>
For concrete details, <a href="http://www.distribucon.com/download/dotnet/DataGridObjectsBinding.zip" target="_new">download
this project</a>. I look forward to your comments.
</p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5d258460-68ac-43e8-80a8-1835cd16390e" /></body>
      <title>Using ObjectBindingSource for master/detail scenarios</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,5d258460-68ac-43e8-80a8-1835cd16390e.aspx</guid>
      <link>http://www.distribucon.com/blog/UsingObjectBindingSourceForMasterdetailScenarios.aspx</link>
      <pubDate>Tue, 06 Nov 2007 05:26:17 GMT</pubDate>
      <description>I've been working more with data-binding and the ObjectBindingSource component that &lt;a href="http://www.distribucon.com/blog/PermaLink,guid,d23c9802-5669-4e57-bf30-eed8afdd7bd0.aspx" target=_new&gt;I
wrote about here&lt;/a&gt;. Here is some stripped-down sample code to help investigate more
data-binding concepts. &lt;pre&gt;&lt;code&gt;class Customer { int Id; BindingList&lt;ORDER&gt;
Orders; } class Order { int OrderNumber; Product ProductInfo; } class Product { string
Vendor; Product Self; }
&lt;/code&gt;&lt;/pre&gt;
Assume that we want individual GUI components for the Customer object, and a grid
to display the associated orders, with the related Product information displayed along
with the Order. Here are some quick pseudo-code tips to get things wired up properly. 
&lt;ul&gt;
&lt;li&gt;
CustomerObjectBindingSource.DataSource = typeof(Customer) 
&lt;li&gt;
CustomerObjectBindingSource.BindableProperties.Add("Orders"). (If you don't do this,
the detail ObjectBindingSource won't work later on.) 
&lt;li&gt;
OrdersObjectBindingSource.DataSource = CustomerObjectBindingSource and OrdersObjectBindingSource.DataMember
= "Orders" 
&lt;li&gt;
OrdersObjectBindingSource.BindableProperties.Add("Product") 
&lt;li&gt;
DataGridView.DataSource = OrdersObjectBindingSource 
&lt;li&gt;
Modify the DataGridView column for Product by setting: 
&lt;ul&gt;
&lt;li&gt;
column.DataSource = ProductsBindingSource 
&lt;li&gt;
column.DisplayMember = "Name" 
&lt;li&gt;
column.ValueMember = Self&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
&lt;b&gt;**IMPORTANT**&lt;/b&gt; - Use the same object references everywhere for the product objects
(i.e. in the DataGridView column and where you access them in your code). In the sample,
I use the productBindingSource component for both the lookup in the grid and the way
to lookup individual Product instances. Another alternative that I tested is to use
a singleton class for the collection. If you don't do this, you will get the dreaded
"DataGridViewComboBoxCell value is not valid" error when the grid tries to populate
the Product value.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
For concrete details, &lt;a href="http://www.distribucon.com/download/dotnet/DataGridObjectsBinding.zip" target=_new&gt;download
this project&lt;/a&gt;. I look forward to your comments.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5d258460-68ac-43e8-80a8-1835cd16390e" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,5d258460-68ac-43e8-80a8-1835cd16390e.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=d23c9802-5669-4e57-bf30-eed8afdd7bd0</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,d23c9802-5669-4e57-bf30-eed8afdd7bd0.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,d23c9802-5669-4e57-bf30-eed8afdd7bd0.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=d23c9802-5669-4e57-bf30-eed8afdd7bd0</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Subtitle: How to force .NET Grids to respect Object-Oriented designs
</p>
        <p>
Microsoft clearly intended the DataGridView to be used with databases and primitives.
With the company inventing .NET making it difficult to write GUIs with a proper domain
model, it's no wonder that the majority of .NET code out there is littered with data-access
metaphors. 
</p>
        <p>
Take the following code (yes, I know there are fields here, but it takes less space): 
</p>
        <pre>
          <code>
            <!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;}??\fs20     \cf3 public\cf0  \cf3 class\cf0  \cf4 County\par ??\cf0     \{\par ??        \cf3 public\cf0  County()\par ??        \{\par ??        \}\par ??        \par ??        \cf3 public\cf0  County(\cf3 string\cf0  name, \cf3 double\cf0  taxRate) : \cf3 this\cf0 ()\par ??        \{\par ??            \cf3 this\cf0 .name = name;\par ??            \cf3 this\cf0 .taxRate = taxRate;\par ??        \}\par ??\par ??        \cf3 public\cf0  \cf3 string\cf0  name;\par ??        \cf3 public\cf0  \cf3 double\cf0  taxRate;\par ??    \}\par ??}
-->
            <div style="font-size: 10pt; background: white; color: black; font-family: consolas">
              <p style="margin: 0px">
                <span style="color: blue">public</span>
                <span style="color: blue">class</span>
                <span style="color: #2b91af">County</span>
              </p>
              <p style="margin: 0px">
{
</p>
              <p style="margin: 0px">
    <span style="color: blue">public</span> County() {}
</p>
              <p style="margin: 0px">
    <span style="color: blue">public</span><span style="color: blue">string</span> name;
</p>
              <p style="margin: 0px">
    <span style="color: blue">public</span><span style="color: blue">double</span> taxRate;
</p>
              <p style="margin: 0px">
}
</p>
            </div>
            <!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;}??\fs20     \cf3 public\cf0  \cf3 class\cf0  \cf4 CountyTax\par ??\cf0     \{\par ??        \cf3 public\cf0  CountyTax()\par ??        \{\par ??        \}\par ??\par ??        \cf3 public\cf0  \cf4 County\cf0  County;\par ??        \cf3 public\cf0  \cf3 double\cf0  Amount;\par ??    \}\par ??}
-->
            <div style="font-size: 10pt; background: white; color: black; font-family: consolas">
              <p style="margin: 0px">
                <span style="color: blue">public</span>
                <span style="color: blue">class</span>
                <span style="color: #2b91af">CountyTax</span>
              </p>
              <p style="margin: 0px">
{
</p>
              <p style="margin: 0px">
    <span style="color: blue">public</span> CountyTax() {}
</p>
              <p style="margin: 0px">
    <span style="color: blue">public</span><span style="color: #2b91af">County</span> County;
</p>
              <p style="margin: 0px">
    <span style="color: blue">public</span><span style="color: blue">double</span> Amount;
</p>
              <p style="margin: 0px">
}
</p>
            </div>
          </code>
        </pre>
        <p>
There is no way out of the box to get a DataGridView to display and edit the CountyTax
object's County and Amount fields. I'd like to have a combo box to display a list
of county names, select one, and then enter an amount. Later, I can calculate the
tax by multiplying the TaxRate for the selected county and the Amount I entered. In
other words, I want to employ good domain design principles. 
</p>
        <p>
Here are a couple of solutions, depending on whether or not you want to <a href="http://www.developer-corner.com/Resources/KnowledgeBase/tabid/118/articleType/ArticleView/articleId/28/Default.aspx" target="_new">add
extra code to each grid, and use reflection</a> or <a href="http://www.codeproject.com/useritems/ObjectBindingSource.asp?msg=2288270" target="_new">get
some design-time support in a fairly encapsulated solution with faster-than-reflection
performance</a>. 
</p>
        <p>
I haven't had a chance to check out Orcas, but I can only hope that Microsoft has
finally seen the light and will treat object-oriented developers to a fully functioning
grid.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=d23c9802-5669-4e57-bf30-eed8afdd7bd0" />
      </body>
      <title>Displaying Nested Objects in a DataGridView</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,d23c9802-5669-4e57-bf30-eed8afdd7bd0.aspx</guid>
      <link>http://www.distribucon.com/blog/DisplayingNestedObjectsInADataGridView.aspx</link>
      <pubDate>Sun, 28 Oct 2007 03:59:37 GMT</pubDate>
      <description>&lt;p&gt;
Subtitle: How to force .NET Grids to respect Object-Oriented designs
&lt;/p&gt;
&lt;p&gt;
Microsoft clearly intended the DataGridView&amp;nbsp;to be used with databases and primitives.
With the company inventing .NET making it difficult to write GUIs with a proper domain
model, it's no wonder that the majority of .NET code out there is littered with data-access
metaphors. 
&lt;p&gt;
Take the following code (yes, I know there are fields here, but it takes less space): &lt;pre&gt;&lt;code&gt; 
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;}??\fs20     \cf3 public\cf0  \cf3 class\cf0  \cf4 County\par ??\cf0     \{\par ??        \cf3 public\cf0  County()\par ??        \{\par ??        \}\par ??        \par ??        \cf3 public\cf0  County(\cf3 string\cf0  name, \cf3 double\cf0  taxRate) : \cf3 this\cf0 ()\par ??        \{\par ??            \cf3 this\cf0 .name = name;\par ??            \cf3 this\cf0 .taxRate = taxRate;\par ??        \}\par ??\par ??        \cf3 public\cf0  \cf3 string\cf0  name;\par ??        \cf3 public\cf0  \cf3 double\cf0  taxRate;\par ??    \}\par ??}
--&gt;
&lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas"&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;County&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
{
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;public&lt;/span&gt; County() {}
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; name;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;double&lt;/span&gt; taxRate;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
}
&lt;/p&gt;
&lt;/div&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;}??\fs20     \cf3 public\cf0  \cf3 class\cf0  \cf4 CountyTax\par ??\cf0     \{\par ??        \cf3 public\cf0  CountyTax()\par ??        \{\par ??        \}\par ??\par ??        \cf3 public\cf0  \cf4 County\cf0  County;\par ??        \cf3 public\cf0  \cf3 double\cf0  Amount;\par ??    \}\par ??}
--&gt;
&lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas"&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CountyTax&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
{
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;public&lt;/span&gt; CountyTax() {}
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;County&lt;/span&gt; County;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;double&lt;/span&gt; Amount;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
}
&lt;/p&gt;
&lt;/div&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
There is no way out of the box to get a DataGridView to display and edit the CountyTax
object's County and Amount fields. I'd like to have a combo box to display a list
of county names, select one, and then enter an amount. Later, I can calculate the
tax by multiplying the TaxRate for the selected county and the Amount I entered. In
other words, I want to employ good domain design principles. 
&lt;p&gt;
Here are a couple of solutions, depending on whether or not you want to &lt;a href="http://www.developer-corner.com/Resources/KnowledgeBase/tabid/118/articleType/ArticleView/articleId/28/Default.aspx" target="_new"&gt;add
extra code to each grid, and use reflection&lt;/a&gt; or &lt;a href="http://www.codeproject.com/useritems/ObjectBindingSource.asp?msg=2288270" target="_new"&gt;get
some design-time support in a fairly encapsulated solution with faster-than-reflection
performance&lt;/a&gt;. 
&lt;p&gt;
I haven't had a chance to check out Orcas, but I can only hope that Microsoft has
finally seen the light and will treat object-oriented developers to a fully functioning
grid.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=d23c9802-5669-4e57-bf30-eed8afdd7bd0" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,d23c9802-5669-4e57-bf30-eed8afdd7bd0.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=baee5d9f-75da-475f-a809-8f0327b015e5</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,baee5d9f-75da-475f-a809-8f0327b015e5.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,baee5d9f-75da-475f-a809-8f0327b015e5.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=baee5d9f-75da-475f-a809-8f0327b015e5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Here is the target that I used to generate
an <a href="http://msdn2.microsoft.com/en-us/library/bb429476(VS.80).aspx" target="_new">FxCop</a> report
and integrate it seamlessly into the CC.NET web dashboard. 
<p></p><pre><code>&lt;FxCop TargetAssemblies="$(TargetAssembly)" RuleLibraries="@(FxCopRuleAssemblies)"
AnalysisReportFileName="FxCop.xml" FailOnError="False" ApplyOutXsl="False" OutputXslFilename="Vendor\FxCop\Xml\FxCopReport.xsl"
Verbose="False" IncludeSummaryReport="True" WorkingDirectory="$(MSBuildProjectDirectory)"
ToolPath="$(MSBuildProjectDirectory)\Vendor\FxCop"/&gt; </code></pre><p>
The key here is to be sure that ApplyOutXsl is set to False. If it's set to True,
then the output will not get logged into the CC.NET log, which means when the dashboard
tries to find it, it won't be there. 
</p><p>
The other thing of note here is that I have all of my third-party tools, like FxCop,
Sandcastle, Enterprise Library, etc. in a Vendor subdirectory of my project. By doing
this, I can pick up the one Vendor folder and get another project up to speed quickly
(through copying or Subversion externals).
</p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=baee5d9f-75da-475f-a809-8f0327b015e5" /></body>
      <title>CruiseControl.NET and FxCop</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,baee5d9f-75da-475f-a809-8f0327b015e5.aspx</guid>
      <link>http://www.distribucon.com/blog/CruiseControlNETAndFxCop.aspx</link>
      <pubDate>Fri, 12 Oct 2007 15:48:36 GMT</pubDate>
      <description>Here is the target that I used to generate an &lt;a href="http://msdn2.microsoft.com/en-us/library/bb429476(VS.80).aspx" target="_new"&gt;FxCop&lt;/a&gt; report
and integrate it seamlessly into the CC.NET web dashboard. 
&lt;p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;FxCop TargetAssemblies="$(TargetAssembly)" RuleLibraries="@(FxCopRuleAssemblies)"
AnalysisReportFileName="FxCop.xml" FailOnError="False" ApplyOutXsl="False" OutputXslFilename="Vendor\FxCop\Xml\FxCopReport.xsl"
Verbose="False" IncludeSummaryReport="True" WorkingDirectory="$(MSBuildProjectDirectory)"
ToolPath="$(MSBuildProjectDirectory)\Vendor\FxCop"/&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
The key here is to be sure that ApplyOutXsl is set to False. If it's set to True,
then the output will not get logged into the CC.NET log, which means when the dashboard
tries to find it, it won't be there. 
&lt;p&gt;
The other thing of note here is that I have all of my third-party tools, like FxCop,
Sandcastle, Enterprise Library, etc. in a Vendor subdirectory of my project. By doing
this, I can pick up the one Vendor folder and get another project up to speed quickly
(through copying or Subversion externals).
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=baee5d9f-75da-475f-a809-8f0327b015e5" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,baee5d9f-75da-475f-a809-8f0327b015e5.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=bdd42268-4723-4319-90e4-9f1eaab084a1</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,bdd42268-4723-4319-90e4-9f1eaab084a1.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,bdd42268-4723-4319-90e4-9f1eaab084a1.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=bdd42268-4723-4319-90e4-9f1eaab084a1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
When customizing the appearance of the CC.NET Web Dashboard, you often need to modify
the file c:\Program Files\CruiseControl.NET\webdashboard\dashboard.config. However,
you won't see the changes you make there reflected back in the browser until that
file is reloaded. 
</p>
        <p>
The easiest way to reload dashboard.config is to quickly modify web.config (add a
space and delete it), and save. This forces IIS to reload the web application, which
in turn causes dashboard.config to give up it's new settings. This is especially useful
in a hosted environment where you don't have access to administration-level tools.
</p>
        <p>
An alternative would be to just bounce the entire web server by stopping and starting
the service, but that's not always feasible nor practical.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=bdd42268-4723-4319-90e4-9f1eaab084a1" />
      </body>
      <title>CruiseControl.NET Dashboard Modifications</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,bdd42268-4723-4319-90e4-9f1eaab084a1.aspx</guid>
      <link>http://www.distribucon.com/blog/CruiseControlNETDashboardModifications.aspx</link>
      <pubDate>Thu, 11 Oct 2007 17:58:27 GMT</pubDate>
      <description>&lt;p&gt;
When customizing the appearance of the CC.NET Web Dashboard, you often need to modify
the file c:\Program Files\CruiseControl.NET\webdashboard\dashboard.config. However,
you won't see the changes you make there reflected back in the browser until that
file is reloaded. 
&lt;/p&gt;
&lt;p&gt;
The easiest way to reload dashboard.config is to quickly modify web.config (add a
space and delete it), and save. This forces IIS to reload the web application, which
in turn causes dashboard.config to give up it's new settings. This is especially useful
in a hosted environment where you don't have access to administration-level tools.
&lt;/p&gt;
&lt;p&gt;
An alternative would be to just bounce the entire web server by stopping and starting
the service, but that's not always feasible nor practical.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=bdd42268-4723-4319-90e4-9f1eaab084a1" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,bdd42268-4723-4319-90e4-9f1eaab084a1.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=c43a785d-b2c6-40b8-8e92-eedd153ca518</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,c43a785d-b2c6-40b8-8e92-eedd153ca518.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,c43a785d-b2c6-40b8-8e92-eedd153ca518.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=c43a785d-b2c6-40b8-8e92-eedd153ca518</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
When you need to extract more information from the MSBuild script, you can use the
following syntax:
</p>
        <pre>
          <code> msbuild /v:diag build.proj </code>
        </pre>
        <p>
There are other verbosity options available, too. Very handy when you need to easily
find out what's going on behind the scenes.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=c43a785d-b2c6-40b8-8e92-eedd153ca518" />
      </body>
      <title>MSBuild debug information</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,c43a785d-b2c6-40b8-8e92-eedd153ca518.aspx</guid>
      <link>http://www.distribucon.com/blog/MSBuildDebugInformation.aspx</link>
      <pubDate>Wed, 10 Oct 2007 17:36:46 GMT</pubDate>
      <description>&lt;p&gt;
When you need to extract more information from the MSBuild script, you can use the
following syntax:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; msbuild /v:diag build.proj &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
There are other verbosity options available, too. Very handy when you need to easily
find out what's going on behind the scenes.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=c43a785d-b2c6-40b8-8e92-eedd153ca518" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,c43a785d-b2c6-40b8-8e92-eedd153ca518.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=3be57736-f2cf-496f-9d8e-21c9a3cf4e5e</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,3be57736-f2cf-496f-9d8e-21c9a3cf4e5e.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,3be57736-f2cf-496f-9d8e-21c9a3cf4e5e.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3be57736-f2cf-496f-9d8e-21c9a3cf4e5e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I'm working a lot on agile .NET project
setup right now. One of the standards in this arena is <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET" target="_new">CruiseControl.Net</a>.
We also use <a href="http://subversion.tigris.org/" target="_new">Subversion</a> and <a href="http://msdn2.microsoft.com/en-us/library/0k6kkbsd.aspx" target="_new">MSBuild</a>,
which means we need to use <a href="http://msbuildtasks.tigris.org/" target="_new">MSBuild
Tasks</a> to use the custom Subversion tasks. The documentation for MSBuildTasks is,
well, "Open Sourcey". For the Subversion tasks, not all tasks have example MSBuild
fragments. In addition, the descriptions of most properties or classes are just one
sentence circular summaries. 
<p>
For example, if you need to commit just one file inside the MSBuild script, you would
use the SvnCommit task. You might do this as part of a depoyment process where you
set version numbers on files before creating an installer. This is the snippet that
I finally settled on to update just that one file:<br /><code><br />
&lt;ItemGroup&gt;<br />
  &lt;CodeFiles Include="Properties\AssemblyInfo.cs" /&gt;<br />
&lt;/ItemGroup&gt;<br /><br />
&lt;!-- Later on, inside a Target, use this --&gt;<br />
&lt;SvnCommit<br />
  Targets="@(CodeFiles)" 
<br />
  Message="$(CCNetLabel)" 
<br />
  Password="pwd" 
<br />
  UserName="user" 
<br />
/&gt;</code></p><p>
The reason for this is that SvnCommit descends from SvnClient, which is too generalized
of a base class. For example, the SvnCommit.RepositoryPath property does not work
as one might expect. Specifically, in my case, when I specified the RepositoryPath
attribute in the msbuild file, I received the following error. It turns out that
you should just not specify the RepositoryPath attribute at all (see the documentation
for "svn help commit" to see that a URL is not passed in on the command-line,
but rather, svn figures out the URL from the working copy).<br /><code><br />
    svn: 'svn://x.y.z/project/trunk' is a URL, but URLs cannot be commit
targets<br /></code></p><p>
Also, SvnCommit.LocalPath should not be used. It ends up generating a command-line
similar to the following, which ends up committing everything in the LocalPath and
down. Remember, all I wanted was to update one specific file, so it turns out that
the LocalPath attribute is getting in the way here.
</p><pre><code> svn.exe commit "full\path\to\my\working\directory" </code></pre><pre><code> "Properties\AssemblyInfo.cs" --username user --password pwd </code></pre><pre><code> --message "1.8.1.2" --non-ineractive --no-auth-cache </code></pre><p>
To sum up: 
</p><ul><li>
Don't specify the RepositoryPath attribute in an SvnCommit task 
</li><li>
Don't specify the LocalPath attribute in an SvnCommit task 
</li><li>
Specify a ToolPath entry that points to the folder that holds svn.exe if it's not
in the default location (c:\Program Files\Subversion\) 
</li><li>
Setting the Verbose attribute does not work because it is defined as a nullable boolean 
</li></ul><p><em>Edited on 10/10/2007 for clarity due to comments made by <a href="http://www.stevetrefethen.com/blog/" target="_new">Steve
Trefethen</a>. Thanks, Steve!</em></p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=3be57736-f2cf-496f-9d8e-21c9a3cf4e5e" /></body>
      <title>CruiseControl.NET, Subversion and MSBuildTasks</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,3be57736-f2cf-496f-9d8e-21c9a3cf4e5e.aspx</guid>
      <link>http://www.distribucon.com/blog/CruiseControlNETSubversionAndMSBuildTasks.aspx</link>
      <pubDate>Tue, 09 Oct 2007 19:46:22 GMT</pubDate>
      <description>I'm working a lot on agile .NET project setup right now. One of the standards in this arena is &lt;a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET" target=_new&gt;CruiseControl.Net&lt;/a&gt;.
We also use &lt;a href="http://subversion.tigris.org/" target=_new&gt;Subversion&lt;/a&gt; and &lt;a href="http://msdn2.microsoft.com/en-us/library/0k6kkbsd.aspx" target=_new&gt;MSBuild&lt;/a&gt;,
which means we need to use &lt;a href="http://msbuildtasks.tigris.org/" target=_new&gt;MSBuild
Tasks&lt;/a&gt; to use the custom Subversion tasks. The documentation for MSBuildTasks is,
well, "Open Sourcey". For the Subversion tasks, not all tasks have example MSBuild
fragments. In addition, the descriptions of most properties or classes are just one
sentence circular summaries. 
&lt;p&gt;
For example, if you need to commit just one file inside the MSBuild script, you would
use the SvnCommit task. You might do this as part of a depoyment process where you
set version numbers on files before creating an installer. This is the snippet that
I finally settled on to update just that one file:&lt;br&gt;
&lt;code&gt;
&lt;br&gt;
&amp;lt;ItemGroup&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;CodeFiles Include="Properties\AssemblyInfo.cs" /&amp;gt;&lt;br&gt;
&amp;lt;/ItemGroup&amp;gt;&lt;br&gt;
&lt;br&gt;
&amp;lt;!-- Later on, inside a Target, use this --&amp;gt;&lt;br&gt;
&amp;lt;SvnCommit&lt;br&gt;
&amp;nbsp; Targets="@(CodeFiles)" 
&lt;br&gt;
&amp;nbsp; Message="$(CCNetLabel)" 
&lt;br&gt;
&amp;nbsp; Password="pwd" 
&lt;br&gt;
&amp;nbsp; UserName="user" 
&lt;br&gt;
/&amp;gt;&lt;/code&gt; 
&lt;p&gt;
The reason for this is that SvnCommit descends from SvnClient, which is too generalized
of a base class. For example, the SvnCommit.RepositoryPath property does not work
as one might expect. Specifically, in my case, when I specified the RepositoryPath
attribute in the msbuild file, I received the following error.&amp;nbsp;It turns out that
you should just not specify the RepositoryPath attribute at all&amp;nbsp;(see the documentation
for&amp;nbsp;"svn help commit" to see that a URL is not passed in on the command-line,
but rather, svn figures out the URL from the working copy).&lt;br&gt;
&lt;code&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; svn: 'svn://x.y.z/project/trunk' is a URL, but URLs cannot be commit
targets&lt;br&gt;
&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
Also, SvnCommit.LocalPath should not be used. It ends up generating a command-line
similar to the following, which ends up committing everything in the LocalPath and
down. Remember, all I wanted was to update one specific file, so it turns out that
the LocalPath attribute is getting in the way here.&lt;pre&gt;&lt;code&gt; svn.exe commit "full\path\to\my\working\directory" &lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt; "Properties\AssemblyInfo.cs" --username user --password pwd &lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt; --message "1.8.1.2" --non-ineractive --no-auth-cache &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
To sum up: 
&lt;ul&gt;
&lt;li&gt;
Don't specify the RepositoryPath attribute in an SvnCommit task 
&lt;li&gt;
Don't specify the LocalPath attribute in an SvnCommit task 
&lt;li&gt;
Specify a ToolPath entry that points to the folder that holds svn.exe if it's not
in the default location (c:\Program Files\Subversion\) 
&lt;li&gt;
Setting the Verbose attribute does not work because it is defined as a nullable boolean 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;em&gt;Edited on 10/10/2007 for clarity due to comments made by &lt;a href="http://www.stevetrefethen.com/blog/" target="_new"&gt;Steve
Trefethen&lt;/a&gt;. Thanks, Steve!&lt;/em&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=3be57736-f2cf-496f-9d8e-21c9a3cf4e5e" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,3be57736-f2cf-496f-9d8e-21c9a3cf4e5e.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=60078661-4b30-44a3-ae3f-ff52b3983ba1</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,60078661-4b30-44a3-ae3f-ff52b3983ba1.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,60078661-4b30-44a3-ae3f-ff52b3983ba1.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=60078661-4b30-44a3-ae3f-ff52b3983ba1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I was getting a strange problem at a client's
site recently where on occasion, an ASP.NET application that called a web service
would throw different exceptions. The fact that I could claim "It works on my machine"
meant little consolation. Stranger still, when debugging the application, it would
blow up at different spots. When it finally blew up on a call to Response.Redirect,
the client suddenly remembered some code that he used in a similar situation before.
The theory was that there is some kind of misconfiguration in the servers somewhere,
so this should not be needed, but this work-around has since been added and no additional
errors have been reported. 
<p></p><pre><code><!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green128\blue0;\red0\green0\blue255;\red43\green145\blue175;\red163\green21\blue21;}??\fs20             \cf3 // svc is a WebService that you would use in your ASP.NET application\par ??\cf0             svc.Proxy = \cf4 new\cf0  System.Net.\cf5 WebProxy\cf0 (\cf6 "127.0.0.1"\cf0 );\par ??            ((System.Net.\cf5 WebProxy\cf0 )svc.Proxy).BypassList = \cf4 new\cf0  \cf4 string\cf0 [] \{ \cf6 "NameOfLocalMachine"\cf0  \};\par ??}
--><div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: consolas"><p style="MARGIN: 0px"><span style="COLOR: green">// svc is a WebService that you would use in your ASP.NET
application</span></p><p style="MARGIN: 0px">
svc.Proxy = <span style="COLOR: blue">new</span> System.Net.<span style="COLOR: #2b91af">WebProxy</span>(<span style="COLOR: #a31515">"127.0.0.1"</span>);
</p><p style="MARGIN: 0px">
((System.Net.<span style="COLOR: #2b91af">WebProxy</span>)svc.Proxy).BypassList = <span style="COLOR: blue">new</span><span style="COLOR: blue">string</span>[]
{ <span style="COLOR: #a31515">"NameOfLocalMachine"</span> };
</p></div></code></pre><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=60078661-4b30-44a3-ae3f-ff52b3983ba1" /></body>
      <title>Bypassing proxy server configuration problems</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,60078661-4b30-44a3-ae3f-ff52b3983ba1.aspx</guid>
      <link>http://www.distribucon.com/blog/BypassingProxyServerConfigurationProblems.aspx</link>
      <pubDate>Wed, 22 Aug 2007 18:02:12 GMT</pubDate>
      <description>I was getting a strange problem at a client's site recently where on occasion, an ASP.NET application that called a web service would throw different exceptions. The fact that I could claim "It works on my machine" meant little consolation. Stranger still, when debugging the application, it would blow up at different spots. When it finally blew up on a call to Response.Redirect, the client suddenly remembered some code that he used in a similar situation before. The theory was that there is some kind of misconfiguration in the servers somewhere, so this should not be needed, but this work-around has since been added and no additional errors have been reported. 
&lt;p&gt;
&lt;pre&gt;&lt;code&gt; 
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green128\blue0;\red0\green0\blue255;\red43\green145\blue175;\red163\green21\blue21;}??\fs20             \cf3 // svc is a WebService that you would use in your ASP.NET application\par ??\cf0             svc.Proxy = \cf4 new\cf0  System.Net.\cf5 WebProxy\cf0 (\cf6 "127.0.0.1"\cf0 );\par ??            ((System.Net.\cf5 WebProxy\cf0 )svc.Proxy).BypassList = \cf4 new\cf0  \cf4 string\cf0 [] \{ \cf6 "NameOfLocalMachine"\cf0  \};\par ??}
--&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: consolas"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: green"&gt;// svc is a WebService that you would use in your ASP.NET
application&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
svc.Proxy = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; System.Net.&lt;span style="COLOR: #2b91af"&gt;WebProxy&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"127.0.0.1"&lt;/span&gt;);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
((System.Net.&lt;span style="COLOR: #2b91af"&gt;WebProxy&lt;/span&gt;)svc.Proxy).BypassList = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;[]
{ &lt;span style="COLOR: #a31515"&gt;"NameOfLocalMachine"&lt;/span&gt; };
&lt;/p&gt;
&lt;/div&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=60078661-4b30-44a3-ae3f-ff52b3983ba1" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,60078661-4b30-44a3-ae3f-ff52b3983ba1.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=6a342fce-24b6-4fb8-a420-b7a8376e2520</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,6a342fce-24b6-4fb8-a420-b7a8376e2520.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,6a342fce-24b6-4fb8-a420-b7a8376e2520.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6a342fce-24b6-4fb8-a420-b7a8376e2520</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">If you've come across this error when starting
up an application, be sure to check the format of your app.config file. It turns out
that this exception is of the type <a href="http://msdn2.microsoft.com/en-us/library/system.configuration.configurationerrorsexception(vs.80).aspx" target="_new">System.Configuration.ConfigurationErrorsException</a>. 
<p>
The real problem was that I had ended up generating a malformed config file (see the
schema in c:\Program Files\Microsoft Visual Studio 8\Xml\Schemas\DotNetConfig.xsd)
by putting configSections after appSettings. Once I put the configSections element
back to the top of the config file, everything was fine again.
</p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=6a342fce-24b6-4fb8-a420-b7a8376e2520" /></body>
      <title>Configuration system failed to initialize</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,6a342fce-24b6-4fb8-a420-b7a8376e2520.aspx</guid>
      <link>http://www.distribucon.com/blog/ConfigurationSystemFailedToInitialize.aspx</link>
      <pubDate>Fri, 15 Jun 2007 03:48:41 GMT</pubDate>
      <description>If you've come across this error when starting up an application, be sure to check the format of your app.config file. It turns out that this exception is of the type &lt;a href="http://msdn2.microsoft.com/en-us/library/system.configuration.configurationerrorsexception(vs.80).aspx" target="_new"&gt;System.Configuration.ConfigurationErrorsException&lt;/a&gt;. 
&lt;p&gt;
The real problem was that I had ended up generating a malformed config file (see the
schema in c:\Program Files\Microsoft Visual Studio 8\Xml\Schemas\DotNetConfig.xsd)
by putting configSections after appSettings. Once I put the configSections element
back to the top of the config file, everything was fine again.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=6a342fce-24b6-4fb8-a420-b7a8376e2520" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,6a342fce-24b6-4fb8-a420-b7a8376e2520.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=3401250e-d4d9-45f0-aa7a-33a3bcc9e597</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,3401250e-d4d9-45f0-aa7a-33a3bcc9e597.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,3401250e-d4d9-45f0-aa7a-33a3bcc9e597.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3401250e-d4d9-45f0-aa7a-33a3bcc9e597</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I recently created a Windows Service using
.NET, and in order to install the service, you need to execute this command:<br /><pre><code>installutil myservice.exe</code></pre><p>
However, when I did this, I received a System.BadImageFormatException. It turns out
that my PATH settings were still pointing to the 1.1 .NET framework tools. Changing
the PATH to point to .NET 2.0 (c:\Windows\Microsoft.Net\Framework\v2.0.50727) fixed
the problem and the service can now register successfully.
</p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=3401250e-d4d9-45f0-aa7a-33a3bcc9e597" /></body>
      <title>InstallUtil throws BadImageFormatException</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,3401250e-d4d9-45f0-aa7a-33a3bcc9e597.aspx</guid>
      <link>http://www.distribucon.com/blog/InstallUtilThrowsBadImageFormatException.aspx</link>
      <pubDate>Wed, 13 Jun 2007 15:06:38 GMT</pubDate>
      <description>I recently created a Windows Service using .NET, and in order to install the service, you need to execute this command:&lt;br&gt;
&lt;pre&gt;&lt;code&gt;installutil myservice.exe&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
However, when I did this, I received a System.BadImageFormatException. It turns out
that my PATH settings were still pointing to the 1.1 .NET framework tools. Changing
the PATH to point to .NET 2.0 (c:\Windows\Microsoft.Net\Framework\v2.0.50727) fixed
the problem and the service can now register successfully.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=3401250e-d4d9-45f0-aa7a-33a3bcc9e597" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,3401250e-d4d9-45f0-aa7a-33a3bcc9e597.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=581f6715-2c0c-464d-99ed-b8175209c40b</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,581f6715-2c0c-464d-99ed-b8175209c40b.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,581f6715-2c0c-464d-99ed-b8175209c40b.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=581f6715-2c0c-464d-99ed-b8175209c40b</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I hate when we lose functionality in applications.
I'm writing a pretty classic ASP.NET application right now. One assembly is the Data
Access Layer, and I try to write enough unit tests to actually show that things stand
a chance of working (both now and in the future). Also, I occasionally like to work
at home, disconnected from work's servers (database and other). That means that I
have MSSQL installed on my laptop, which has local copies of the databases that I
would need. I also have my web.config checked into source control so others on the
team can do a simple checkout and have the web site working with a simple build of
the MSBuild script. Given that setup, how would one go about being a responsible unit
tester? It seems that what I want is a way to set a default connection string in the
main config file, and allow a user.config to (optionally) exist. If it did exist,
it could override the settings that were in the main config file to point to a new
database. 
<p>
There is a new attribute, <a href="http://msdn2.microsoft.com/en-us/library/system.configuration.sectioninformation.configsource.aspx" target="_new">configSource</a>,
that looks promising because it can be used to redirect .NET from looking at the app.config
(or web.config) and instead make it look at an arbitrary generic user.config file
for its content. The problem with this approach is that it <b>requires</b> every machine
to have this user.config file in the same place. What I want is more like what the
old <a href="http://msdn2.microsoft.com/en-us/library/ms228154.aspx" target="_new">file
attribute of appSettings</a> provided. Unfortunately, the new tools in ASP.NET 2.0
get the connection string information from the <a href="http://msdn2.microsoft.com/en-us/library/bf7sd233.aspx" target="_new">connectionStrings
section</a>, so using the appSettings approach is out-dated. 
</p><p>
For now, I'll use configSource, but it is a pain to have to tell each memeber of the
dev team that they need to create their very own user.config file and place it in
a certain directory, since this usage means that you wouldn't want to check user.config
into your source control system. 
</p><p>
Take a look at J.D. Meier's paper, <a href="http://blogs.msdn.com/jmeier/archive/2007/04/21/how-to-reference-web-services-and-databases-during-development.aspx" target="_new">How
To Reference Web Services and Databases During Development</a>, for some concrete
samples on how this looks.
</p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=581f6715-2c0c-464d-99ed-b8175209c40b" /></body>
      <title>Using an external config file to control connection strings</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,581f6715-2c0c-464d-99ed-b8175209c40b.aspx</guid>
      <link>http://www.distribucon.com/blog/UsingAnExternalConfigFileToControlConnectionStrings.aspx</link>
      <pubDate>Tue, 29 May 2007 17:54:59 GMT</pubDate>
      <description>I hate when we lose functionality in applications. I'm writing a pretty classic ASP.NET application right now. One assembly is the Data Access Layer, and I try to write enough unit tests to actually show that things stand a chance of working (both now and in the future). Also, I occasionally like to work at home, disconnected from work's servers (database and other). That means that I have MSSQL installed on my laptop, which has local copies of the databases that I would need. I also have my web.config checked into source control so others on the team can do a simple checkout and have the web site working with a simple build of the MSBuild script. Given that setup, how would one go about being a responsible unit tester? It seems that what I want is a way to set a default connection string in the main config file, and allow a user.config to (optionally) exist. If it did exist, it could override the settings that were in the main config file to point to a new database. 
&lt;p&gt;
There is a new attribute, &lt;a href="http://msdn2.microsoft.com/en-us/library/system.configuration.sectioninformation.configsource.aspx" target=_new&gt;configSource&lt;/a&gt;,
that looks promising because it can be used to redirect .NET from looking at the app.config
(or web.config) and instead make it look at an arbitrary generic user.config file
for its content. The problem with this approach is that it &lt;b&gt;requires&lt;/b&gt; every machine
to have this user.config file in the same place. What I want is more like what the
old &lt;a href="http://msdn2.microsoft.com/en-us/library/ms228154.aspx" target=_new&gt;file
attribute of appSettings&lt;/a&gt; provided. Unfortunately, the new tools in ASP.NET 2.0
get the connection string information from the &lt;a href="http://msdn2.microsoft.com/en-us/library/bf7sd233.aspx" target=_new&gt;connectionStrings
section&lt;/a&gt;, so using the appSettings approach is out-dated. 
&lt;p&gt;
For now, I'll use configSource, but it is a pain to have to tell each memeber of the
dev team that they need to create their very own user.config file and place it in
a certain directory, since this usage means that you wouldn't want to check user.config
into your source control system. 
&lt;p&gt;
Take a look at J.D. Meier's paper, &lt;a href="http://blogs.msdn.com/jmeier/archive/2007/04/21/how-to-reference-web-services-and-databases-during-development.aspx" target=_new&gt;How
To Reference Web Services and Databases During Development&lt;/a&gt;, for some concrete
samples on how this looks.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=581f6715-2c0c-464d-99ed-b8175209c40b" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,581f6715-2c0c-464d-99ed-b8175209c40b.aspx</comments>
      <category>.NET</category>
      <category>ADO.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=a11e7723-e580-413a-aea9-78a91bc90c0c</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,a11e7723-e580-413a-aea9-78a91bc90c0c.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,a11e7723-e580-413a-aea9-78a91bc90c0c.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a11e7723-e580-413a-aea9-78a91bc90c0c</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I've been spending a lot of time on .NET
3.0 lately. One of the areas that is a lot of fun for me to dig into is WPF, since
it's such a departure from my usual data/service/remoting pigeon-hole. I know a lot
of people hate grids as a metaphor, but when I saw this <a href="http://xceed.com/Grid_WPF_Demo.html" target="_new">free
WPF grid demo</a>, I knew grids would be with us for yet another generation of user
interfaces. Long live the grid!! <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=a11e7723-e580-413a-aea9-78a91bc90c0c" /></body>
      <title>Grids in WPF</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,a11e7723-e580-413a-aea9-78a91bc90c0c.aspx</guid>
      <link>http://www.distribucon.com/blog/GridsInWPF.aspx</link>
      <pubDate>Thu, 17 May 2007 13:59:02 GMT</pubDate>
      <description>I've been spending a lot of time on .NET 3.0 lately. One of the areas that is a lot of fun for me to dig into is WPF, since it's such a departure from my usual data/service/remoting pigeon-hole. I know a lot of people hate grids as a metaphor, but when I saw this &lt;a href="http://xceed.com/Grid_WPF_Demo.html" target=_new&gt;free
WPF grid demo&lt;/a&gt;, I knew grids would be with us for yet another generation of user
interfaces. Long live the grid!! &lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=a11e7723-e580-413a-aea9-78a91bc90c0c" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,a11e7723-e580-413a-aea9-78a91bc90c0c.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=f12f69c6-5647-44a7-9c27-717c5d953da6</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,f12f69c6-5647-44a7-9c27-717c5d953da6.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,f12f69c6-5647-44a7-9c27-717c5d953da6.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=f12f69c6-5647-44a7-9c27-717c5d953da6</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">The following application shows a subtle
difference in dealing with enums using Enum class methods and when using reflection.
In this sample, I am looking to find the number of elements in the enum. <a href="http://msdn2.microsoft.com/en-us/library/system.enum.getvalues.aspx" target="_new">Enum.GetValues</a> and <a href="http://msdn2.microsoft.com/en-us/library/system.enum.getnames.aspx" target="_new">Enum.GetNames</a> are
not implemented in the .NET Compact Framework, so I cannot use those methods. 
<p>
By using reflection, I figured I would gain the upper hand and take control of my
enum woes. Unfortunately, calling <a href="http://msdn2.microsoft.com/en-us/library/ch9714z3.aspx" target="_new">GetFields</a> on
an enum type adds an extra entry named "value__" to the returned list. After browsing
through the decompilation of Enum, I found that value__ is just a special instance
field used by the enum to hold the value of the selected member. I also noticed that
the actual enum members are really marked as static. So, to get around this problem,
all you need to do is call GetFields with the BindingFlags set to only retrieve the
public, static fields (see the code example below). 
</p><p><code><pre><!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red0\green128\blue0;}??\fs20 \cf1 using\cf0  System;\par ??\cf1 using\cf0  System.Reflection;\par ??\par ??\cf1 namespace\cf0  EnumReflection\par ??\{\par ??    \cf1 class\cf0  \cf4 Program\par ??\cf0     \{\par ??        \cf1 enum\cf0  \cf4 Test\par ??\cf0         \{\par ??            One,\par ??            Two,\par ??            Three\par ??        \}\par ??\par ??        \cf1 static\cf0  \cf1 void\cf0  Main(\cf1 string\cf0 [] args)\par ??        \{\par ??            \cf4 Type\cf0  enumType = \cf1 typeof\cf0 (\cf4 Test\cf0 );\par ??\par ??            \cf5 //The following prints 3, but we can't use this method in .NET CF\par ??\cf0             \cf4 Console\cf0 .WriteLine(\cf4 Enum\cf0 .GetValues(enumType).Length);\par ??\par ??            \cf4 FieldInfo\cf0 [] infos;\par ??            infos = enumType.GetFields();\par ??\par ??            \cf5 //The following prints 4! There is an extra, unrelated Int32 entry named "value__" \par ??\cf0             \cf5 //at the zeroth element of the info array.\par ??\cf0             \cf4 Console\cf0 .WriteLine(infos.Length);\par ??\par ??            \cf5 //The following prints 3. The value__ field is removed by specifying we only want the public, static fields.\par ??\cf0             infos = enumType.GetFields(\cf4 BindingFlags\cf0 .Public | \cf4 BindingFlags\cf0 .Static);\par ??            \cf1 foreach\cf0  (\cf4 FieldInfo\cf0  fi \cf1 in\cf0  infos)\par ??            \{\par ??                \cf4 Console\cf0 .WriteLine(fi.Name);\par ??            \}\par ??        \}\par ??    \}\par ??\}}
--><div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Consolas"><p style="MARGIN: 0px"><span style="COLOR: blue">using</span> System;
</p><p style="MARGIN: 0px"><span style="COLOR: blue">using</span> System.Reflection;
</p><p style="MARGIN: 0px">
 
</p><p style="MARGIN: 0px"><span style="COLOR: blue">namespace</span> EnumReflection
</p><p style="MARGIN: 0px">
{
</p><p style="MARGIN: 0px">
    <span style="COLOR: blue">class</span><span style="COLOR: #2b91af">Program</span></p><p style="MARGIN: 0px">
    {
</p><p style="MARGIN: 0px">
        <span style="COLOR: blue">enum</span><span style="COLOR: #2b91af">Test</span></p><p style="MARGIN: 0px">
        {
</p><p style="MARGIN: 0px">
            One,
</p><p style="MARGIN: 0px">
            Two,
</p><p style="MARGIN: 0px">
            Three
</p><p style="MARGIN: 0px">
        }
</p><p style="MARGIN: 0px">
 
</p><p style="MARGIN: 0px">
        <span style="COLOR: blue">static</span><span style="COLOR: blue">void</span> Main(<span style="COLOR: blue">string</span>[]
args)
</p><p style="MARGIN: 0px">
        {
</p><p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">Type</span> enumType
= <span style="COLOR: blue">typeof</span>(<span style="COLOR: #2b91af">Test</span>);
</p><p style="MARGIN: 0px">
 
</p><p style="MARGIN: 0px">
            <span style="COLOR: green">//The
following prints 3, but we can't use this method in .NET CF</span></p><p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">Console</span>.WriteLine(<span style="COLOR: #2b91af">Enum</span>.GetValues(enumType).Length);
</p><p style="MARGIN: 0px">
 
</p><p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">FieldInfo</span>[]
infos;
</p><p style="MARGIN: 0px">
            infos = enumType.GetFields();
</p><p style="MARGIN: 0px">
 
</p><p style="MARGIN: 0px">
            <span style="COLOR: green">//The
following prints 4! There is an extra, unrelated Int32 entry named "value__" </span></p><p style="MARGIN: 0px">
            <span style="COLOR: green">//at
the zeroth element of the info array.</span></p><p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">Console</span>.WriteLine(infos.Length);
</p><p style="MARGIN: 0px">
 
</p><p style="MARGIN: 0px">
            <span style="COLOR: green">//The
following prints the 3 enum elements. The value__ field is removed by </span></p><p style="MARGIN: 0px"><span style="COLOR: green">            //specifying
we only want the public, static fields.</span></p><p style="MARGIN: 0px">
            infos = enumType.GetFields(<span style="COLOR: #2b91af">BindingFlags</span>.Public
| <span style="COLOR: #2b91af">BindingFlags</span>.Static);
</p><p style="MARGIN: 0px">
            <span style="COLOR: blue">foreach</span> (<span style="COLOR: #2b91af">FieldInfo</span> fi <span style="COLOR: blue">in</span> infos)
</p><p style="MARGIN: 0px">
            {
</p><p style="MARGIN: 0px">
                <span style="COLOR: #2b91af">Console</span>.WriteLine(fi.Name);
</p><p style="MARGIN: 0px">
            }
</p><p style="MARGIN: 0px">
        }
</p><p style="MARGIN: 0px">
    }
</p><p style="MARGIN: 0px">
}
</p></div></pre></code><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=f12f69c6-5647-44a7-9c27-717c5d953da6" /></p></body>
      <title>Getting members of an Enum via reflection</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,f12f69c6-5647-44a7-9c27-717c5d953da6.aspx</guid>
      <link>http://www.distribucon.com/blog/GettingMembersOfAnEnumViaReflection.aspx</link>
      <pubDate>Thu, 22 Mar 2007 16:16:48 GMT</pubDate>
      <description>The following application shows a subtle difference in dealing with enums using Enum class methods and when using reflection. In this sample, I am looking to find the number of elements in the enum. &lt;a href="http://msdn2.microsoft.com/en-us/library/system.enum.getvalues.aspx" target=_new&gt;Enum.GetValues&lt;/a&gt; and &lt;a href="http://msdn2.microsoft.com/en-us/library/system.enum.getnames.aspx" target=_new&gt;Enum.GetNames&lt;/a&gt; are
not implemented in the .NET Compact Framework, so I cannot use those methods. 
&lt;p&gt;
By using reflection, I figured I would gain the upper hand and take control of my
enum woes. Unfortunately, calling &lt;a href="http://msdn2.microsoft.com/en-us/library/ch9714z3.aspx" target=_new&gt;GetFields&lt;/a&gt; on
an enum type adds an extra entry named "value__" to the returned list. After browsing
through the decompilation of Enum, I found that value__ is just a special instance
field used by the enum to hold the value of the selected member. I also noticed that
the actual enum members are really marked as static. So, to get around this problem,
all you need to do is call GetFields with the BindingFlags set to only retrieve the
public, static fields (see the code example below). 
&lt;p&gt;
&lt;code&gt;&lt;pre&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red0\green128\blue0;}??\fs20 \cf1 using\cf0  System;\par ??\cf1 using\cf0  System.Reflection;\par ??\par ??\cf1 namespace\cf0  EnumReflection\par ??\{\par ??    \cf1 class\cf0  \cf4 Program\par ??\cf0     \{\par ??        \cf1 enum\cf0  \cf4 Test\par ??\cf0         \{\par ??            One,\par ??            Two,\par ??            Three\par ??        \}\par ??\par ??        \cf1 static\cf0  \cf1 void\cf0  Main(\cf1 string\cf0 [] args)\par ??        \{\par ??            \cf4 Type\cf0  enumType = \cf1 typeof\cf0 (\cf4 Test\cf0 );\par ??\par ??            \cf5 //The following prints 3, but we can't use this method in .NET CF\par ??\cf0             \cf4 Console\cf0 .WriteLine(\cf4 Enum\cf0 .GetValues(enumType).Length);\par ??\par ??            \cf4 FieldInfo\cf0 [] infos;\par ??            infos = enumType.GetFields();\par ??\par ??            \cf5 //The following prints 4! There is an extra, unrelated Int32 entry named "value__" \par ??\cf0             \cf5 //at the zeroth element of the info array.\par ??\cf0             \cf4 Console\cf0 .WriteLine(infos.Length);\par ??\par ??            \cf5 //The following prints 3. The value__ field is removed by specifying we only want the public, static fields.\par ??\cf0             infos = enumType.GetFields(\cf4 BindingFlags\cf0 .Public | \cf4 BindingFlags\cf0 .Static);\par ??            \cf1 foreach\cf0  (\cf4 FieldInfo\cf0  fi \cf1 in\cf0  infos)\par ??            \{\par ??                \cf4 Console\cf0 .WriteLine(fi.Name);\par ??            \}\par ??        \}\par ??    \}\par ??\}}
--&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Consolas"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System.Reflection;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;namespace&lt;/span&gt; EnumReflection
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Program&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;enum&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Test&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; One,
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Two,
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Three
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;static&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; Main(&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;[]
args)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;Type&lt;/span&gt; enumType
= &lt;span style="COLOR: blue"&gt;typeof&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;Test&lt;/span&gt;);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;//The
following prints 3, but we can't use this method in .NET CF&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="COLOR: #2b91af"&gt;Enum&lt;/span&gt;.GetValues(enumType).Length);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;FieldInfo&lt;/span&gt;[]
infos;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; infos = enumType.GetFields();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;//The
following prints 4! There is an extra, unrelated Int32 entry named "value__" &lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;//at
the zeroth element of the info array.&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(infos.Length);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;//The
following prints the 3 enum elements. The value__ field is removed by &lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: green"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//specifying
we only want the public, static fields.&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; infos = enumType.GetFields(&lt;span style="COLOR: #2b91af"&gt;BindingFlags&lt;/span&gt;.Public
| &lt;span style="COLOR: #2b91af"&gt;BindingFlags&lt;/span&gt;.Static);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;foreach&lt;/span&gt; (&lt;span style="COLOR: #2b91af"&gt;FieldInfo&lt;/span&gt; fi &lt;span style="COLOR: blue"&gt;in&lt;/span&gt; infos)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(fi.Name);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
}
&lt;/p&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;/code&gt;&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=f12f69c6-5647-44a7-9c27-717c5d953da6" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,f12f69c6-5647-44a7-9c27-717c5d953da6.aspx</comments>
      <category>.NET</category>
      <category>Compact Framework</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=8e9c84cb-06f1-4d2f-b102-e1666453ef8c</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,8e9c84cb-06f1-4d2f-b102-e1666453ef8c.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,8e9c84cb-06f1-4d2f-b102-e1666453ef8c.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=8e9c84cb-06f1-4d2f-b102-e1666453ef8c</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I needed to implement a dialog that could
be used to stop from displaying over and over again. We've all seen countless variations
on this theme. I also didn't want to go to the extent of <a href="http://www.codeproject.com/cs/miscctrl/MessageBoxChk.asp" target="_new">using
hooks to accomplish this</a>. 
<p>
I came across the <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/shlwapi/others/shmessageboxcheck.asp" target="_new">SHMessageBoxCheck
function</a>, and it appears to give me what I need. Granted, <a href="http://blogs.msdn.com/oldnewthing/archive/2005/04/29/412577.aspx" target="_new">it
is far from perfect</a>, but it works for me. I used the <a href="http://www.pinvoke.net/default.aspx/shlwapi/SHMessageBoxCheck.html" target="_new">declaration
from PInvoke.net</a>, but I received a PInvokeStackImbalance exception from MDA. I
modified the DllImport to use PreserveSig to true, and the error is gone. I did update
the wiki to mention this finding, so hopefully others will be able to verify. 
</p><p>
All in all, this function works well. But, by trying to be lazy and use a pre-existing
solution, it definitely took longer than it would have had I written my own custom
dialog. I'm sure that won't be the last time that happens. ;-) 
</p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=8e9c84cb-06f1-4d2f-b102-e1666453ef8c" /></body>
      <title>Don't show this dialog again</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,8e9c84cb-06f1-4d2f-b102-e1666453ef8c.aspx</guid>
      <link>http://www.distribucon.com/blog/DontShowThisDialogAgain.aspx</link>
      <pubDate>Thu, 15 Mar 2007 14:49:05 GMT</pubDate>
      <description>I needed to implement a dialog that could be used to stop from displaying over and over again. We've all seen countless variations on this theme. I also didn't want to go to the extent of &lt;a href="http://www.codeproject.com/cs/miscctrl/MessageBoxChk.asp" target=_new&gt;using
hooks to accomplish this&lt;/a&gt;. 
&lt;p&gt;
I came across the &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/shlwapi/others/shmessageboxcheck.asp" target=_new&gt;SHMessageBoxCheck
function&lt;/a&gt;, and it appears to give me what I need. Granted, &lt;a href="http://blogs.msdn.com/oldnewthing/archive/2005/04/29/412577.aspx" target=_new&gt;it
is far from perfect&lt;/a&gt;, but it works for me.&amp;nbsp;I used the &lt;a href="http://www.pinvoke.net/default.aspx/shlwapi/SHMessageBoxCheck.html" target=_new&gt;declaration
from PInvoke.net&lt;/a&gt;, but I received a PInvokeStackImbalance exception from MDA. I
modified the DllImport to use PreserveSig to true, and the error is gone. I did update
the wiki to mention this finding, so hopefully others will be able to verify. 
&lt;p&gt;
All in all, this function works well. But, by trying to be lazy and use a pre-existing
solution, it definitely took longer than it would have had I written my own custom
dialog. I'm sure that won't be the last time that happens. ;-) 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=8e9c84cb-06f1-4d2f-b102-e1666453ef8c" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,8e9c84cb-06f1-4d2f-b102-e1666453ef8c.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=fef887de-adfd-4a25-894b-5f57838ed9aa</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,fef887de-adfd-4a25-894b-5f57838ed9aa.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,fef887de-adfd-4a25-894b-5f57838ed9aa.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=fef887de-adfd-4a25-894b-5f57838ed9aa</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I read Scott Hanselman's well-written article <a href="http://www.hanselman.com/blog/HOWTODebugIntoANETXmlSerializerGeneratedAssembly.aspx" target="_new">HOW
TO: Debug into a .NET XmlSerializer Generated Assembly</a>. I can add a few more little
(and most likely obvious) things to his article:<br /><ul><li>
This still works in .NET 2.0. 
</li><li>
If you just do an Add New Item to add a new Application Configuration File to your
project in VS, you can just paste the debugging flags in, and the config file will
get deployed to the application directory automatically. 
</li><li>
You can just Step Into (F11) the call to x.Serialize, and you will be taken into the
proper generated file. You may want to open the file manually as Scott mentioned,
but I find it to be faster to press F11, and then go to the place in the file I want
to debug. 
</li></ul><p>
In the end, we ended up <a href="http://www.zorched.net/2007/02/28/custom-xml-serialization-for-the-net-compact-framework/" target="_new">writing
our own serialization for .NET CF</a> due to one too many bugs.
</p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=fef887de-adfd-4a25-894b-5f57838ed9aa" /></body>
      <title>Debugging XMLSerializer generated code</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,fef887de-adfd-4a25-894b-5f57838ed9aa.aspx</guid>
      <link>http://www.distribucon.com/blog/DebuggingXMLSerializerGeneratedCode.aspx</link>
      <pubDate>Thu, 08 Mar 2007 20:26:21 GMT</pubDate>
      <description>I read Scott Hanselman's well-written article &lt;a href="http://www.hanselman.com/blog/HOWTODebugIntoANETXmlSerializerGeneratedAssembly.aspx" target=_new&gt;HOW
TO: Debug into a .NET XmlSerializer Generated Assembly&lt;/a&gt;. I can add a few more little
(and most likely obvious) things to his article:&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
This still works in .NET 2.0. 
&lt;li&gt;
If you just do an Add New Item to add a new Application Configuration File to your
project in VS, you can just paste the debugging flags in, and the config file will
get deployed to the application directory automatically. 
&lt;li&gt;
You can just Step Into (F11) the call to x.Serialize, and you will be taken into the
proper generated file. You may want to open the file manually as Scott mentioned,
but I find it to be faster to press F11, and then go to the place in the file I want
to debug. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In the end, we ended up &lt;a href="http://www.zorched.net/2007/02/28/custom-xml-serialization-for-the-net-compact-framework/" target=_new&gt;writing
our own serialization for .NET CF&lt;/a&gt; due to one too many bugs.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=fef887de-adfd-4a25-894b-5f57838ed9aa" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,fef887de-adfd-4a25-894b-5f57838ed9aa.aspx</comments>
      <category>.NET</category>
      <category>XML</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=43dc99a1-fca9-4428-9574-39f18ecb3c30</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,43dc99a1-fca9-4428-9574-39f18ecb3c30.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,43dc99a1-fca9-4428-9574-39f18ecb3c30.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=43dc99a1-fca9-4428-9574-39f18ecb3c30</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">A while back, I wrote about <a href="http://www.distribucon.com/blog/PermaLink,guid,1655.aspx" taget="_new">how
to use the Data Access Application Block (DAAB) in the Compact Framework</a>. While
this code works just fine, it turns out that <a href="http://www.codeplex.com/entlib" target="_new">Enterprise
Library 3.0</a> will support this natively. I really like the TableExists method that
they added, too. 
<p>
David Hayden wrote a couple of articles about this <a href="http://codebetter.com/blogs/david.hayden/archive/2007/02/02/Enterprise-Library-3.0-DAAB-Improvements-To-Date.aspx" target="_new">here</a> and <a href="http://davidhayden.com/blog/dave/archive/2007/01/02/SqlCeDatabaseDataAccessApplicationBlock.aspx" target="_new">here</a>.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=43dc99a1-fca9-4428-9574-39f18ecb3c30" /></p></body>
      <title>Enterprise Library 3.0 provides MSSQL Compact Edition support</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,43dc99a1-fca9-4428-9574-39f18ecb3c30.aspx</guid>
      <link>http://www.distribucon.com/blog/EnterpriseLibrary30ProvidesMSSQLCompactEditionSupport.aspx</link>
      <pubDate>Wed, 21 Feb 2007 23:23:26 GMT</pubDate>
      <description>A while back, I wrote about &lt;a href="http://www.distribucon.com/blog/PermaLink,guid,1655.aspx" taget="_new"&gt;how
to use the Data Access Application Block (DAAB) in the Compact Framework&lt;/a&gt;. While
this code works just fine, it turns out that &lt;a href="http://www.codeplex.com/entlib" target="_new"&gt;Enterprise
Library 3.0&lt;/a&gt; will support this natively. I really like the TableExists method that
they added, too. 
&lt;p&gt;
David Hayden wrote a couple of articles about this &lt;a href="http://codebetter.com/blogs/david.hayden/archive/2007/02/02/Enterprise-Library-3.0-DAAB-Improvements-To-Date.aspx" target="_new"&gt;here&lt;/a&gt; and &lt;a href="http://davidhayden.com/blog/dave/archive/2007/01/02/SqlCeDatabaseDataAccessApplicationBlock.aspx" target="_new"&gt;here&lt;/a&gt;.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=43dc99a1-fca9-4428-9574-39f18ecb3c30" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,43dc99a1-fca9-4428-9574-39f18ecb3c30.aspx</comments>
      <category>.NET</category>
      <category>ADO.NET</category>
      <category>Compact Framework</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=818592b9-7eea-478a-84c7-77ce873de426</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,818592b9-7eea-478a-84c7-77ce873de426.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,818592b9-7eea-478a-84c7-77ce873de426.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=818592b9-7eea-478a-84c7-77ce873de426</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">The following code assigns DateTime.MaxValue
to a parameter. When trying to run this code against the Northwind databse, it will
produce the error, "An overflow occurred while converting to datetime". 
<p></p><pre><code><!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red43\green145\blue175;\red0\green0\blue255;\red163\green21\blue21;\red0\green128\blue0;}??\fs20             \cf3 SqlCeConnection\cf0  conn = \cf4 new\cf0  \cf3 SqlCeConnection\cf0 (connStr);\par ??            conn.Open();\par ??            \cf3 SqlCeCommand\cf0  cmd = \cf4 new\cf0  \cf3 SqlCeCommand\cf0 (\cf5 "select * from employees where [Hire Date] &lt; @paramDate"\cf0 , conn);\par ??\par ??            \cf3 SqlCeParameter\cf0  paramDate = cmd.CreateParameter();\par ??            paramDate.ParameterName = \cf5 "@paramDate"\cf0 ;\par ??            paramDate.DbType = \cf3 DbType\cf0 .DateTime;\par ??            paramDate.Value = \cf3 DateTime\cf0 .MaxValue\cf6 \par ??\cf0             cmd.Parameters.Add(paramDate);\par ??\par ??            \cf3 SqlCeDataAdapter\cf0  da = \cf4 new\cf0  \cf3 SqlCeDataAdapter\cf0 (cmd);\par ??            \cf3 DataTable\cf0  tbl = \cf4 new\cf0  \cf3 DataTable\cf0 ();\par ??            da.Fill(tbl);\par ??            dataGridView1.DataSource = tbl;\par ??\par ??            conn.Close();\par ??}
--><div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Consolas"><p style="MARGIN: 0px"><span style="COLOR: #2b91af">SqlCeConnection</span> conn = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">SqlCeConnection</span>(connStr);
</p><p style="MARGIN: 0px">
conn.Open();
</p><p style="MARGIN: 0px"><span style="COLOR: #2b91af">SqlCeCommand</span> cmd = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">SqlCeCommand</span>(<span style="COLOR: #a31515">"select
* from employees where [Hire Date] &lt; @paramDate"</span>, conn);
</p><p style="MARGIN: 0px">
 
</p><p style="MARGIN: 0px"><span style="COLOR: #2b91af">SqlCeParameter</span> paramDate = cmd.CreateParameter();
</p><p style="MARGIN: 0px">
paramDate.ParameterName = <span style="COLOR: #a31515">"@paramDate"</span>;
</p><p style="MARGIN: 0px">
paramDate.DbType = <span style="COLOR: #2b91af">DbType</span>.DateTime;
</p><p style="MARGIN: 0px">
paramDate.Value = <span style="COLOR: #2b91af">DateTime</span>.MaxValue;
</p><p style="MARGIN: 0px">
cmd.Parameters.Add(paramDate);
</p><p style="MARGIN: 0px">
 
</p><p style="MARGIN: 0px"><span style="COLOR: #2b91af">SqlCeDataAdapter</span> da = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">SqlCeDataAdapter</span>(cmd);
</p><p style="MARGIN: 0px"><span style="COLOR: #2b91af">DataTable</span> tbl = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">DataTable</span>();
</p><p style="MARGIN: 0px">
da.Fill(tbl);
</p><p style="MARGIN: 0px">
dataGridView1.DataSource = tbl;
</p><p style="MARGIN: 0px">
 
</p><p style="MARGIN: 0px">
conn.Close();
</p></div></code></pre><p>
Note that this fails when using MSSQL Compact Edition (MSSQLCE) under a standard WinForm
application and a Pocket PPC platform. The same code against a standard desktop MSSQL
version will work fine. 
</p><p>
The workaround is simple. Just get away from the MaxValue. Of course, this is a workaround,
so it's not perfect, but it certainly works for my needs. 
</p><pre><code> paramDate.Value = DateTime.MaxValue.AddMilliseconds(-1); </code></pre><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=818592b9-7eea-478a-84c7-77ce873de426" /></body>
      <title>DateTime.MaxValue overflow error in MSSQL Compact Edition</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,818592b9-7eea-478a-84c7-77ce873de426.aspx</guid>
      <link>http://www.distribucon.com/blog/DateTimeMaxValueOverflowErrorInMSSQLCompactEdition.aspx</link>
      <pubDate>Mon, 19 Feb 2007 15:37:16 GMT</pubDate>
      <description>The following code assigns DateTime.MaxValue to a parameter. When trying to run this code against the Northwind databse, it will produce the error, "An overflow occurred while converting to datetime". 
&lt;p&gt;
&lt;pre&gt;&lt;code&gt; 
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red43\green145\blue175;\red0\green0\blue255;\red163\green21\blue21;\red0\green128\blue0;}??\fs20             \cf3 SqlCeConnection\cf0  conn = \cf4 new\cf0  \cf3 SqlCeConnection\cf0 (connStr);\par ??            conn.Open();\par ??            \cf3 SqlCeCommand\cf0  cmd = \cf4 new\cf0  \cf3 SqlCeCommand\cf0 (\cf5 "select * from employees where [Hire Date] &amp;lt; @paramDate"\cf0 , conn);\par ??\par ??            \cf3 SqlCeParameter\cf0  paramDate = cmd.CreateParameter();\par ??            paramDate.ParameterName = \cf5 "@paramDate"\cf0 ;\par ??            paramDate.DbType = \cf3 DbType\cf0 .DateTime;\par ??            paramDate.Value = \cf3 DateTime\cf0 .MaxValue\cf6 \par ??\cf0             cmd.Parameters.Add(paramDate);\par ??\par ??            \cf3 SqlCeDataAdapter\cf0  da = \cf4 new\cf0  \cf3 SqlCeDataAdapter\cf0 (cmd);\par ??            \cf3 DataTable\cf0  tbl = \cf4 new\cf0  \cf3 DataTable\cf0 ();\par ??            da.Fill(tbl);\par ??            dataGridView1.DataSource = tbl;\par ??\par ??            conn.Close();\par ??}
--&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Consolas"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;SqlCeConnection&lt;/span&gt; conn = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SqlCeConnection&lt;/span&gt;(connStr);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
conn.Open();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;SqlCeCommand&lt;/span&gt; cmd = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SqlCeCommand&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"select
* from employees where [Hire Date] &amp;lt; @paramDate"&lt;/span&gt;, conn);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;SqlCeParameter&lt;/span&gt; paramDate = cmd.CreateParameter();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
paramDate.ParameterName = &lt;span style="COLOR: #a31515"&gt;"@paramDate"&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
paramDate.DbType = &lt;span style="COLOR: #2b91af"&gt;DbType&lt;/span&gt;.DateTime;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
paramDate.Value = &lt;span style="COLOR: #2b91af"&gt;DateTime&lt;/span&gt;.MaxValue;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
cmd.Parameters.Add(paramDate);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;SqlCeDataAdapter&lt;/span&gt; da = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SqlCeDataAdapter&lt;/span&gt;(cmd);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;DataTable&lt;/span&gt; tbl = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;DataTable&lt;/span&gt;();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
da.Fill(tbl);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
dataGridView1.DataSource = tbl;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
conn.Close();
&lt;/p&gt;
&lt;/div&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Note that this fails when using MSSQL Compact Edition (MSSQLCE) under a standard WinForm
application and a Pocket PPC platform. The same code against a standard desktop MSSQL
version will work fine. 
&lt;p&gt;
The workaround is simple. Just get away from the MaxValue. Of course, this is a workaround,
so it's not perfect, but it certainly works for my needs. &lt;pre&gt;&lt;code&gt; paramDate.Value
= DateTime.MaxValue.AddMilliseconds(-1); &lt;/code&gt;&lt;/pre&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=818592b9-7eea-478a-84c7-77ce873de426" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,818592b9-7eea-478a-84c7-77ce873de426.aspx</comments>
      <category>.NET</category>
      <category>ADO.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=4c37ea38-52be-4343-bf15-2c4ba46ae3ad</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,4c37ea38-52be-4343-bf15-2c4ba46ae3ad.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,4c37ea38-52be-4343-bf15-2c4ba46ae3ad.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=4c37ea38-52be-4343-bf15-2c4ba46ae3ad</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I was banging through some quick and dirty
sample applications today, in preparation for a talk on LINQ tonight. One of my old
LINQ to SQL demos shows how to use the external xml mapping file. I also <a href="http://www.distribucon.com/blog/PermaLink,guid,974.aspx" target="_new">blogged
about this before</a>. Today, I kept getting the following error whenever I would
run with an external xml mapping file:<br /><pre><code>The type 'Order' is not an entity.</code></pre><p>
I was using the following command line to generate the xml mapping file:<br /></p><pre><code>SqlMetal /server:(local) /database:Northwind /map:Northwind.xml /code:Northwind.cs
/pluralize</code></pre><p>
Looking at the resulting xml file, I finally noticed this section:<br /></p><pre><code> &lt;Table Name="Orders"&gt; &lt;Type Name=".Order"&gt; </code></pre><p>
Notice the leading dot before the type name attribute. That's the problem. So I went
back and added the /namespace switch to the sqlMetal command line, and now all is
well with the world again. Granted, this problem is the result of me doing demo work,
and not production work, but it's still a little bit irritating. Then again, I'm still
running the May 2006 CTP on VS2005, so for all I know, MS has already fixed all of
this with a subsequent release of a build in Orcas.
</p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=4c37ea38-52be-4343-bf15-2c4ba46ae3ad" /></body>
      <title>sqlMetal mapping file generation requires namespaces</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,4c37ea38-52be-4343-bf15-2c4ba46ae3ad.aspx</guid>
      <link>http://www.distribucon.com/blog/sqlMetalMappingFileGenerationRequiresNamespaces.aspx</link>
      <pubDate>Thu, 08 Feb 2007 19:23:16 GMT</pubDate>
      <description>I was banging through some quick and dirty sample applications today, in preparation for a talk on LINQ tonight. One of my old LINQ to SQL demos shows how to use the external xml mapping file. I also &lt;a href="http://www.distribucon.com/blog/PermaLink,guid,974.aspx" target=_new&gt;blogged
about this before&lt;/a&gt;. Today, I kept getting the following error whenever I would
run with an external xml mapping file:&lt;br&gt;
&lt;pre&gt;&lt;code&gt;The type 'Order' is not an entity.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
I was using the following command line to generate the xml mapping file:&lt;br&gt;
&lt;pre&gt;&lt;code&gt;SqlMetal /server:(local) /database:Northwind /map:Northwind.xml /code:Northwind.cs
/pluralize&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Looking at the resulting xml file, I finally noticed this section:&lt;br&gt;
&lt;pre&gt;&lt;code&gt; &amp;lt;Table Name="Orders"&amp;gt; &amp;lt;Type Name=".Order"&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Notice the leading dot before the type name attribute. That's the problem. So I went
back and added the /namespace switch to the sqlMetal command line, and now all is
well with the world again. Granted, this problem is the result of me doing demo work,
and not production work, but it's still a little bit irritating. Then again, I'm still
running the May 2006 CTP on VS2005, so for all I know, MS has already fixed all of
this with a subsequent release of a build in Orcas.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=4c37ea38-52be-4343-bf15-2c4ba46ae3ad" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,4c37ea38-52be-4343-bf15-2c4ba46ae3ad.aspx</comments>
      <category>.NET</category>
      <category>LINQ</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=5a8c1153-af71-40e0-8152-67805c999902</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,5a8c1153-af71-40e0-8152-67805c999902.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,5a8c1153-af71-40e0-8152-67805c999902.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=5a8c1153-af71-40e0-8152-67805c999902</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I had a requirement to make a list of objects
be displayed in some kind of a grid metaphor. I've used the <a href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridview(VS.80).aspx" target="_new">DataGridView</a> before,
and even written some blog entries on extending it (check out the cool Search feature
on my blog for more information). However, all of my grid usage had been limited to
database-related use. 
<p>
What I needed was a way to easily get filtering and sorting working for the list of
objects. I found 2 links that helped me out a ton. The first one is <a href="http://msdn2.microsoft.com/en-us/library/aa480727.aspx" target="_new">Building
a Drop-Down Filter List for a DataGridView Column Header Cell</a>. This article is
incredibly well-written and talks about the different interfaces you need to implement,
and provides a sample, too. For the sorting, I used Brian Noyes' BindingListView class
from Chapter 9 of his excellent book, <a href="http://www.softinsight.com/databindingbook/">Data
Binding with Windows Forms 2.0</a>. 
</p><p>
When stitching these 2 pieces together, I noticed several things:<br /></p><ul><li>
The DataGridViewAutoFilterColumnHeaderCell.UpdateFilter method was adding square brackets
around the property names for some reason. I can't tell why this was being done, but
my guess is it had to do with spaces in database column names. Since I'm not using
it for that purpose, I removed the brackets. The other approach would have been to
adjust the BindingList.UpdateFilter method to deal with the brackets, so I may revisit
this in the future. 
</li><li>
The BindingListView.UpdateFilter needed some minor modifications. I added a precondition
guard check to make sure m_FilterString is not null. It looks like the DataGridViewAutoFilterColumnHeaderCell
class will call back to the BindingListView class more frequently than Brian had anticipated. 
</li><li>
I adjusted the setter of the IBindingListView.Filter property to remove the filter
if it gets set to String.Empty or null.<br /><pre><code><!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;}??\fs20         \cf3 string\cf0  \cf4 IBindingListView\cf0 .Filter\par ??        \{\par ??            \cf3 get\par ??\cf0             \{\par ??                \cf3 return\cf0  m_FilterString;\par ??            \}\par ??            \cf3 set\par ??\cf0             \{\par ??                \cf3 if\cf0  (\cf3 string\cf0 .IsNullOrEmpty(\cf3 value\cf0 ))\par ??                    ((\cf4 IBindingListView\cf0 )\cf3 this\cf0 ).RemoveFilter();\par ??                \cf3 else\par ??\cf0                 \{\par ??                    m_FilterString = \cf3 value\cf0 ;\par ??                    m_Filtered = \cf3 true\cf0 ;\par ??                    UpdateFilter();\par ??                \}\par ??            \}\par ??        \}\par ??}
--><div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Consolas"><p style="MARGIN: 0px"><span style="COLOR: blue">string</span><span style="COLOR: #2b91af">IBindingListView</span>.Filter
</p><p style="MARGIN: 0px">
{
</p><p style="MARGIN: 0px">
    <span style="COLOR: blue">get</span></p><p style="MARGIN: 0px">
    {
</p><p style="MARGIN: 0px">
        <span style="COLOR: blue">return</span> m_FilterString;
</p><p style="MARGIN: 0px">
    }
</p><p style="MARGIN: 0px">
    <span style="COLOR: blue">set</span></p><p style="MARGIN: 0px">
    {
</p><p style="MARGIN: 0px">
        <span style="COLOR: blue">if</span> (<span style="COLOR: blue">string</span>.IsNullOrEmpty(<span style="COLOR: blue">value</span>))
</p><p style="MARGIN: 0px">
            ((<span style="COLOR: #2b91af">IBindingListView</span>)<span style="COLOR: blue">this</span>).RemoveFilter();
</p><p style="MARGIN: 0px">
        <span style="COLOR: blue">else</span></p><p style="MARGIN: 0px">
        {
</p><p style="MARGIN: 0px">
            m_FilterString = <span style="COLOR: blue">value</span>;
</p><p style="MARGIN: 0px">
            m_Filtered = <span style="COLOR: blue">true</span>;
</p><p style="MARGIN: 0px">
            UpdateFilter();
</p><p style="MARGIN: 0px">
        }
</p><p style="MARGIN: 0px">
    }
</p><p style="MARGIN: 0px">
}
</p></div></code></pre></li><li>
You need to build up your collection of objects using BindingListView 
</li><li>
You must use a <a href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.bindingsource.aspx" target="_new">BindingSource</a> to
link between your collection and the DataGridView by setting dataGridView1.DataSource
= myBindingSource. 
</li></ul><p>
By doing all of this, I got things working the way I wanted. Now it's time to tackle
the next task of getting child objects bound properly in a DataGridView.
</p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5a8c1153-af71-40e0-8152-67805c999902" /></body>
      <title>DataBinding for objects</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,5a8c1153-af71-40e0-8152-67805c999902.aspx</guid>
      <link>http://www.distribucon.com/blog/DataBindingForObjects.aspx</link>
      <pubDate>Wed, 31 Jan 2007 20:48:22 GMT</pubDate>
      <description>I had a requirement to make a list of objects be displayed in some kind of a grid metaphor. I've used the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridview(VS.80).aspx" target=_new&gt;DataGridView&lt;/a&gt; before,
and even written some blog entries on extending it (check out the cool Search feature
on my blog for more information). However, all of my grid usage had been limited to
database-related use. 
&lt;p&gt;
What I needed was a way to easily get filtering and sorting working for the list of
objects. I found 2 links that helped me out a ton. The first one is &lt;a href="http://msdn2.microsoft.com/en-us/library/aa480727.aspx" target=_new&gt;Building
a Drop-Down Filter List for a DataGridView Column Header Cell&lt;/a&gt;. This article is
incredibly well-written and talks about the different interfaces you need to implement,
and provides a sample, too. For the sorting, I used Brian Noyes' BindingListView class
from Chapter 9 of his excellent book, &lt;a href="http://www.softinsight.com/databindingbook/"&gt;Data
Binding with Windows Forms 2.0&lt;/a&gt;. 
&lt;p&gt;
When stitching these 2 pieces together, I noticed several things:&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
The DataGridViewAutoFilterColumnHeaderCell.UpdateFilter method was adding square brackets
around the property names for some reason. I can't tell why this was being done, but
my guess is it had to do with spaces in database column names. Since I'm not using
it for that purpose, I removed the brackets. The other approach would have been to
adjust the BindingList.UpdateFilter method to deal with the brackets, so I may revisit
this in the future. 
&lt;li&gt;
The BindingListView.UpdateFilter needed some minor modifications. I added a precondition
guard check to make sure m_FilterString is not null. It looks like the DataGridViewAutoFilterColumnHeaderCell
class will call back to the BindingListView class more frequently than Brian had anticipated. 
&lt;li&gt;
I adjusted the setter of the IBindingListView.Filter property to remove the filter
if it gets set to String.Empty or null.&lt;br&gt;
&lt;pre&gt;&lt;code&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;}??\fs20         \cf3 string\cf0  \cf4 IBindingListView\cf0 .Filter\par ??        \{\par ??            \cf3 get\par ??\cf0             \{\par ??                \cf3 return\cf0  m_FilterString;\par ??            \}\par ??            \cf3 set\par ??\cf0             \{\par ??                \cf3 if\cf0  (\cf3 string\cf0 .IsNullOrEmpty(\cf3 value\cf0 ))\par ??                    ((\cf4 IBindingListView\cf0 )\cf3 this\cf0 ).RemoveFilter();\par ??                \cf3 else\par ??\cf0                 \{\par ??                    m_FilterString = \cf3 value\cf0 ;\par ??                    m_Filtered = \cf3 true\cf0 ;\par ??                    UpdateFilter();\par ??                \}\par ??            \}\par ??        \}\par ??}
--&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Consolas"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IBindingListView&lt;/span&gt;.Filter
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;get&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;return&lt;/span&gt; m_FilterString;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;set&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;.IsNullOrEmpty(&lt;span style="COLOR: blue"&gt;value&lt;/span&gt;))
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ((&lt;span style="COLOR: #2b91af"&gt;IBindingListView&lt;/span&gt;)&lt;span style="COLOR: blue"&gt;this&lt;/span&gt;).RemoveFilter();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;else&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; m_FilterString = &lt;span style="COLOR: blue"&gt;value&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; m_Filtered = &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; UpdateFilter();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
}
&lt;/p&gt;
&lt;/div&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;li&gt;
You need to build up your collection of objects using BindingListView 
&lt;li&gt;
You must use a &lt;a href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.bindingsource.aspx" target=_new&gt;BindingSource&lt;/a&gt; to
link between your collection and the DataGridView by setting dataGridView1.DataSource
= myBindingSource. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
By doing all of this, I got things working the way I wanted. Now it's time to tackle
the next task of getting child objects bound properly in a DataGridView.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5a8c1153-af71-40e0-8152-67805c999902" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,5a8c1153-af71-40e0-8152-67805c999902.aspx</comments>
      <category>.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=1957cc64-25e6-41cf-bf97-693a576554b0</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,1957cc64-25e6-41cf-bf97-693a576554b0.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,1957cc64-25e6-41cf-bf97-693a576554b0.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=1957cc64-25e6-41cf-bf97-693a576554b0</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I came across <a href="http://www.codeplex.com/evil" target="_new">EViL</a> last
week when looking into simplifying validation of domain objects. This open-source
project is done very well. Dave Donaldson <a href="http://arcware.net/archive/2006/12/08/Get-EViL.aspx" target="_new">introduced
EViL</a> last month. 
<p>
In a nutshell, it's a library that provides attribute-based enforcement of business
rules on your entity objects. It comes with a bunch of pre-defined attributes to handle
common scenarios (e.g. a field is required, a field should have a maximum length,
a field should match a certain regex, etc.). It also easily allows for adding new,
custom rules. 
</p><p>
The thing I like best about this project is that it doesn't force you into descending
your classes from some super class. You can do that if you want, but it will also
work if you want to leave your classes alone. All in all, I would highly recommend
looking into using EViL in your .NET applications. 
</p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=1957cc64-25e6-41cf-bf97-693a576554b0" /></body>
      <title>EViL validation</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,1957cc64-25e6-41cf-bf97-693a576554b0.aspx</guid>
      <link>http://www.distribucon.com/blog/EViLValidation.aspx</link>
      <pubDate>Wed, 24 Jan 2007 20:57:44 GMT</pubDate>
      <description>I came across &lt;a href="http://www.codeplex.com/evil" target=_new&gt;EViL&lt;/a&gt; last week
when looking into simplifying validation of domain objects. This open-source project
is done very well. Dave Donaldson &lt;a href="http://arcware.net/archive/2006/12/08/Get-EViL.aspx" target=_new&gt;introduced
EViL&lt;/a&gt; last month. 
&lt;p&gt;
In a nutshell, it's a library that provides attribute-based enforcement of business
rules on your entity objects. It comes with a bunch of pre-defined attributes to handle
common scenarios (e.g. a field is required, a field should have a maximum length,
a field should match a certain regex, etc.). It also easily allows for adding new,
custom rules. 
&lt;p&gt;
The thing I like best about this project is that it doesn't force you into descending
your classes from some super class. You can do that if you want, but it will also
work if you want to leave your classes alone. All in all, I would highly recommend
looking into using EViL in your .NET applications. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=1957cc64-25e6-41cf-bf97-693a576554b0" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,1957cc64-25e6-41cf-bf97-693a576554b0.aspx</comments>
      <category>.NET</category>
    </item>
  </channel>
</rss>