<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" 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:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/" version="2.0">
    <channel>
        <title>CodeMetropolis</title>
        <link>http://codemetropolis.com/Default.aspx</link>
        <description>Thoughts of a .NET addicted mind</description>
        <language>en-US</language>
        <copyright>Marco De Sanctis</copyright>
        <managingEditor>marcodesanctis2@gmail.com</managingEditor>
        <generator>Subtext Version 1.9.5.177</generator>
        <image>
            <title>CodeMetropolis</title>
            <url>http://codemetropolis.com/images/RSS2Image.gif</url>
            <link>http://codemetropolis.com/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Codemetropolis" type="application/rss+xml" /><item>
            <title>Unleash the power of VisualStateManager with custom states</title>
            <category>Silverlight</category>
            <link>http://codemetropolis.com/archive/2008/06/30/unleash-the-power-of-visualstatemanager-with-custom-states.aspx</link>
            <description>&lt;p&gt;Property triggers are the WPF feature I miss the most in Silverlight 2: I really liked writing behaviors in declarative style with XAML and Styles and it was somehow frustrating being forced to use C# code and event handling to achieve similar results in Silverlight.&lt;/p&gt;  &lt;p&gt;Although it's not here for exactly the same puropose, VisualStateManager is a great improvement to fill the gap thanks to:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Blend visual support &lt;/li&gt;    &lt;li&gt;automatic state transition animation &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Those two features, combined with the opportunity to inject custom states at your own will, make VisualStateManager so poweful that you're going to miss it once back to WPF, at least until it won't be supported for smart clients too.&lt;/p&gt;  &lt;p&gt;Let's suppose I want to animate a textbox to change its background color when mouse pointer overs it. If I was in WPF I would have attached a trigger to the IsMouseOver property, in Silverlight we got no triggers, but we have Blend and VisualStateManager.&lt;/p&gt;  &lt;p&gt;So what I do is putting a TextBox in my UserControl and ask Blend to customize its template:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="323" alt="image" src="http://www.marcodesanctis.it/images/Blog/UnleashthepowerofVisualStateManagerwithc_29/image.png" width="472" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;As we can see, we got no states for the standard TextBox so VisualStateManager seems to be unuseful at first: should we once againf rely on procedural code to achieve our goal? Not at all (or, more exactly, almost not at all). Even though standard TextBox has no built-in states (it doesn't specify any in its attributes nor it invokes any state transition, as, for example, Button does) we can easily add our own simply editing the generated style XAML markup.&lt;/p&gt;  &lt;p&gt;What we need is a custom StateGroup, called MouseStates, and a couple of states, Normal and MouseOver, so what we do is opening Visual Studio to have intellisense while typing, adding a reference to System.Windows namespace and writing the following lines of code:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="207" alt="image" src="http://www.marcodesanctis.it/images/Blog/UnleashthepowerofVisualStateManagerwithc_29/image_3.png" width="471" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Visual Studio complains about using VisualStateManager.VisualStateGroups attached property; however, don't care about it, everything will compile without errors. Ok, now back in blend to continue editing the control template:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="235" alt="image" src="http://www.marcodesanctis.it/images/Blog/UnleashthepowerofVisualStateManagerwithc_29/image_4.png" width="471" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;As you can notice, Blend recognizes the 2 newly added states and suddenly adds them to the States panel. Now, we can animate the TextBox background as we would usually do:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="215" alt="image" src="http://www.marcodesanctis.it/images/Blog/UnleashthepowerofVisualStateManagerwithc_29/image_5.png" width="452" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Now we only need one last step: adding some code to invoke state transitions when the mouse pointer overs or moves away from the TextBox. So, back in Visual Studio, let's add a couple of event handlers:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="258" alt="image" src="http://www.marcodesanctis.it/images/Blog/UnleashthepowerofVisualStateManagerwithc_29/image_6.png" width="437" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Now, if you build and run the project, you'll notice how the TextBox gracefully changes its background color from white to shaded red. However, our textbox won't work in another UserControl unless we don't add the same event handling code to it. It would be preferrable to build a custom StateTextBox and internally hiding all that logic. Doing it is extremely easy, as it consists only on creating a class which inherits form Textbox and writing code similar to the previous one:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="324" alt="image" src="http://www.marcodesanctis.it/images/Blog/UnleashthepowerofVisualStateManagerwithc_29/image_7.png" width="499" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Notice the two attributes I added to the class declaration to describe the control's state machine structure; Blend is supposed to read them to show controls states when editing its template. Unfortunately, (&lt;a href="http://codemetropolis.com/archive/2008/06/25/blend-2.5-june-ctp-and-custom-controls-templating.aspx"&gt;as I wrote some days ago&lt;/a&gt;) Blend June CTP current version has template editing capabilities only for controls which belong to System.Windows.dll. It means that even if we use StateTextBox, we'll still need to manually do all the stuff. However, it still has the advantage to leave the page code behind free from any textbox state transition code.&lt;/p&gt;  &lt;p&gt;As usual, source code is available &lt;a href="http://www.marcodesanctis.it/images/Blog/CustomStatesDemo.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodemetropolis.com%2farchive%2f2008%2f06%2f30%2funleash-the-power-of-visualstatemanager-with-custom-states.aspx"&gt;&lt;img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodemetropolis.com%2farchive%2f2008%2f06%2f30%2funleash-the-power-of-visualstatemanager-with-custom-states.aspx&amp;amp;bgcolor=FF9900" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:48be9c73-a3a5-46ff-a763-9cf1988d0312" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Silverlight%202%20Beta%202" rel="tag"&gt;Silverlight 2 Beta 2&lt;/a&gt;,&lt;a href="http://technorati.com/tags/VisualStateManager" rel="tag"&gt;VisualStateManager&lt;/a&gt;&lt;/div&gt;&lt;img src="http://codemetropolis.com/aggbug/15.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/06/30/unleash-the-power-of-visualstatemanager-with-custom-states.aspx</guid>
            <pubDate>Sun, 29 Jun 2008 22:12:03 GMT</pubDate>
            <wfw:comment>http://codemetropolis.com/comments/15.aspx</wfw:comment>
            <comments>http://codemetropolis.com/archive/2008/06/30/unleash-the-power-of-visualstatemanager-with-custom-states.aspx#feedback</comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/15.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/15.aspx</trackback:ping>
        </item>
        <item>
            <title>Blend 2.5 June CTP and custom controls templating</title>
            <category>Silverlight</category>
            <link>http://codemetropolis.com/archive/2008/06/25/blend-2.5-june-ctp-and-custom-controls-templating.aspx</link>
            <description>&lt;p&gt;I've been recently doing some experiments on Silverlight and the new Blend June CTP. I'm amazed by the design support to custom template editing it provides, although I couldn't get it work with my own custom controls.&lt;/p&gt;  &lt;p&gt;I though I was mistaking something, perhaps forgetting some attribute or whatever else; after 2-3 days of tests, I finally gave up...&lt;/p&gt;  &lt;p&gt;Today I've found &lt;a href="http://silverlight.net/forums/t/18509.aspx"&gt;this post&lt;/a&gt; explaning that &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Currently Blend doesn't support copy ControlTemplate that are not define in System.Windows.dll. But you should be able to create an empty template and edit it.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Ok... at least it wasn't a fault of mine..&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:bcc27f41-6143-47fa-8c50-3b7b09e23352" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Silverlight%202%20Beta%202" rel="tag"&gt;Silverlight 2 Beta 2&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Blend" rel="tag"&gt;Blend&lt;/a&gt;&lt;/div&gt;&lt;img src="http://codemetropolis.com/aggbug/14.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/06/25/blend-2.5-june-ctp-and-custom-controls-templating.aspx</guid>
            <pubDate>Wed, 25 Jun 2008 08:18:44 GMT</pubDate>
            <wfw:comment>http://codemetropolis.com/comments/14.aspx</wfw:comment>
            <comments>http://codemetropolis.com/archive/2008/06/25/blend-2.5-june-ctp-and-custom-controls-templating.aspx#feedback</comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/14.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/14.aspx</trackback:ping>
        </item>
        <item>
            <title>TransactionScope timeout</title>
            <category>Misc</category>
            <link>http://codemetropolis.com/archive/2008/06/14/transactionscope-timeout.aspx</link>
            <description>&lt;p&gt;TransactionScope constructor has an overload that lets you specify a transaction timeout:&lt;/p&gt;
&lt;p&gt;&lt;img width="528" height="102" border="0" src="http://www.marcodesanctis.it/images/Blog/TransactionScopetimeout_A7AC/image.png" alt="image" style="border-width: 0px;" /&gt; &lt;/p&gt;
&lt;p&gt;The example above sets up a 1 hour timeout on the new transaction. I was using a similar approach to execute an Oracle stored procedure which was doing some batch processing that took about 30 mins. to complete. Anyway, I could se the transaction being rolled back after about 10 minutes, even though the OracleCommand itself had a proper timeout and no exception was raised by the underlying stored procedure. &lt;/p&gt;
&lt;p&gt;Pretty strange, isn't it?&lt;/p&gt;
&lt;p&gt;After some research, I've discovered that the TransactionManager class, which ultimately manages the transactions lifespan, has a readonly MaximumTimeout property, that can be set only at &lt;em&gt;machine.config&lt;/em&gt; level and has a default value of 10 minute:&lt;/p&gt;
&lt;p&gt;&lt;img width="343" height="80" border="0" src="http://www.marcodesanctis.it/images/Blog/TransactionScopetimeout_A7AC/image_3.png" alt="image" style="border-width: 0px;" /&gt; &lt;/p&gt;
&lt;p&gt;This is the maximum time limit your transaction can last, regardless of what you specify on the aforementioned constructor. In my case, I decided to move it to one hour limit.&lt;/p&gt;
&lt;p&gt;Hopes this saves you a little time ;-)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodemetropolis.com%2farchive%2f2008%2f06%2f14%2ftransactionscope-timeout.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodemetropolis.com%2farchive%2f2008%2f06%2f14%2ftransactionscope-timeout.aspx&amp;amp;bgcolor=FF9900" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div style="margin: 0px; padding: 0px; display: inline;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:8e755ec2-19c0-40f0-8361-c603c7a7f718" class="wlWriterSmartContent"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/Distributed%20transactions"&gt;Distributed transactions&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/TransactionScope"&gt;TransactionScope&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Timeout"&gt;Timeout&lt;/a&gt;&lt;/div&gt;&lt;img src="http://codemetropolis.com/aggbug/13.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/06/14/transactionscope-timeout.aspx</guid>
            <pubDate>Fri, 13 Jun 2008 22:01:12 GMT</pubDate>
            <wfw:comment>http://codemetropolis.com/comments/13.aspx</wfw:comment>
            <comments>http://codemetropolis.com/archive/2008/06/14/transactionscope-timeout.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/13.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/13.aspx</trackback:ping>
        </item>
        <item>
            <title>Custom controls and default template in Silverlight 2 Beta 2</title>
            <category>Silverlight</category>
            <link>http://codemetropolis.com/archive/2008/06/11/custom-controls-and-default-template-in-silverlight-2-beta-2.aspx</link>
            <description>&lt;p&gt;As &lt;a href="http://blogs.ugidotnet.org/corrado/"&gt;Corrado Cavalli&lt;/a&gt; &lt;a href="http://blogs.ugidotnet.org/corrado/archive/2008/04/10/92154.aspx"&gt;pointed out in his blog&lt;/a&gt; (sorry, it's in Italian), in Beta 1 custom controls didn't inherit their parent's default template; that means they didn't have any visual representation unless we explicitely provide a default template for them. It was a bit annoying, especially when we only needed to add some logic to standard controls, like creating a CustomTextBox that accepts only numbers, for example.&lt;/p&gt;  &lt;p&gt;I was happy to realize that in Beta2 this limitation has gone: when building custom controls, we no longer have to create a default template for it, as it's inherited from its base class (if none is provided). Starting from Corrado's example, let's create a CustomButton class&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="104" alt="image" src="http://www.marcodesanctis.it/images/Blog/CustomcontrolsanddefaultstyleinSilverlig_1187/image.png" width="301" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Now, if we place it in a Silverlight user control:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="134" alt="image" src="http://www.marcodesanctis.it/images/Blog/CustomcontrolsanddefaultstyleinSilverlig_1187/image_3.png" width="471" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;we obtain exactly what we expected:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="192" alt="image" src="http://www.marcodesanctis.it/images/Blog/CustomcontrolsanddefaultstyleinSilverlig_1187/image_4.png" width="408" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Fair enough!&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:78d2ede8-1cbf-4ff6-b6f9-b9d950f7f0fa" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Silverlight%202%20Beta%202" rel="tag"&gt;Silverlight 2 Beta 2&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Custom%20controls" rel="tag"&gt;Custom controls&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Styles" rel="tag"&gt;Styles&lt;/a&gt;&lt;/div&gt;&lt;img src="http://codemetropolis.com/aggbug/12.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/06/11/custom-controls-and-default-template-in-silverlight-2-beta-2.aspx</guid>
            <pubDate>Wed, 11 Jun 2008 09:37:20 GMT</pubDate>
            <wfw:comment>http://codemetropolis.com/comments/12.aspx</wfw:comment>
            <comments>http://codemetropolis.com/archive/2008/06/11/custom-controls-and-default-template-in-silverlight-2-beta-2.aspx#feedback</comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/12.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/12.aspx</trackback:ping>
        </item>
        <item>
            <title>Silverlight 2 Beta 2 Documentation Available</title>
            <category>Silverlight</category>
            <link>http://codemetropolis.com/archive/2008/06/06/silverlight-2-beta-2-documentation-available.aspx</link>
            <description>&lt;p&gt;If you are excited about Silverlight 2 as I am, and you can't wait for its upcoming beta realease, you'll surely enjoy this: &lt;strong&gt;&lt;a href="https://www.microsoft.com/downloads/details.aspx?FamilyID=BCE7684A-507B-4FC6-BC99-6933CD690CAB&amp;amp;displaylang=en"&gt;Silverlight 2 Beta 2 SDK Documentation&lt;/a&gt;&lt;/strong&gt; is available.&lt;/p&gt;  &lt;p&gt;Let's hope it anticipates the SDK public download only for a few hours.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodemetropolis.com%2farchive%2f2008%2f06%2f06%2fsilverlight-2-beta-2-documentation-available.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodemetropolis.com%2farchive%2f2008%2f06%2f06%2fsilverlight-2-beta-2-documentation-available.aspx&amp;amp;bgcolor=FF9900" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ef43dac8-69d0-4691-8004-5e5ea7d05e72" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Silverlight%202%20Beta%202" rel="tag"&gt;Silverlight 2 Beta 2&lt;/a&gt;&lt;/div&gt;&lt;img src="http://codemetropolis.com/aggbug/11.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/06/06/silverlight-2-beta-2-documentation-available.aspx</guid>
            <pubDate>Fri, 06 Jun 2008 08:17:57 GMT</pubDate>
            <wfw:comment>http://codemetropolis.com/comments/11.aspx</wfw:comment>
            <comments>http://codemetropolis.com/archive/2008/06/06/silverlight-2-beta-2-documentation-available.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/11.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/11.aspx</trackback:ping>
        </item>
        <item>
            <title>When Lazy Loading associations is useful</title>
            <category>LINQ</category>
            <category>Software Architecture</category>
            <link>http://codemetropolis.com/archive/2008/05/22/when-lazy-loading-associations-is-useful.aspx</link>
            <description>&lt;p&gt;I was going to reply to a feedback to &lt;a href="http://codemetropolis.com/archive/2008/05/20/linq-to-sql-in-real-word-web-applications.aspx"&gt;my last post&lt;/a&gt;, but from how much I was writing I realized it could deserve a post on its own. &lt;/p&gt;  &lt;p&gt;When we decide to adopt the &lt;a href="http://martinfowler.com/eaaCatalog/domainModel.html"&gt;Domain Model&lt;/a&gt; pattern to represent data, we're going to deal with complex object graphs: it means that instead of SomeRelatedEntity&lt;strong&gt;Id&lt;/strong&gt; properties, we will have concrete references to related entities, a property of SomeRelatedEntity type in this case&lt;/p&gt;  &lt;p&gt;Obviously, when you start a business transaction and you know from the beginning that the property X will be accessed, &lt;strong&gt;&lt;em&gt;it could be&lt;/em&gt;&lt;/strong&gt; (not always, read below!) a wise choice to eager fetch it to avoid too many DB round trips. However, I consider &lt;a href="http://martinfowler.com/eaaCatalog/lazyLoad.html"&gt;LazyLoad&lt;/a&gt; very useful in at least two practical cases:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;n-level Master-Details: for example, a form with a header to edit the master entity, a grid below for its details and a button for each row which opens an AJAX modal popup to edit the detail's details. Without LazyLoad you should execute a huge query on the beginning (or many smaller ones) to fetch everything, and perhaps the user only wants to modify a Master's field. Oh... and what if the 2nd level details have many-to-one associations towards other entities? How big should our join be?&lt;/li&gt;    &lt;li&gt;There are good chances that the related entity is still in the identity map: let's think about a list of entities with many-to-one association towards the same entity, for example a list of bills of the same customer. Without lazy load, you would fetch the same data many times, with lazy load and identity map, you will have no joins, only one query towards the Customers table, then the same entity will be used for every Bill.&lt;/li&gt; &lt;/ul&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f3117534-8217-48d9-bf70-c5f1c0848009" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/LINQ%20to%20Sql" rel="tag"&gt;LINQ to Sql&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Architecture" rel="tag"&gt;Architecture&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Lazy%20Load" rel="tag"&gt;Lazy Load&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Domain%20Model" rel="tag"&gt;Domain Model&lt;/a&gt;&lt;/div&gt;&lt;img src="http://codemetropolis.com/aggbug/10.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/05/22/when-lazy-loading-associations-is-useful.aspx</guid>
            <pubDate>Thu, 22 May 2008 10:28:42 GMT</pubDate>
            <wfw:comment>http://codemetropolis.com/comments/10.aspx</wfw:comment>
            <comments>http://codemetropolis.com/archive/2008/05/22/when-lazy-loading-associations-is-useful.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/10.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/10.aspx</trackback:ping>
        </item>
        <item>
            <title>Linq To Sql in real word Web applications</title>
            <category>ASP.NET</category>
            <category>LINQ</category>
            <link>http://codemetropolis.com/archive/2008/05/20/linq-to-sql-in-real-word-web-applications.aspx</link>
            <description>&lt;p&gt;As my Italian friends probably know, I'm a huge NHibernate fan, as I decided to permanently adopt it in many desktop and web apps I've built or designed during the last 2-3 years; dealing with Session life cycle management in ASP.NET apps is pretty simple if you use &lt;a href="http://www.hibernate.org/42.html#A4"&gt;well known patterns&lt;/a&gt; like&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Session per Request &lt;/li&gt;    &lt;li&gt;more rarely, Session per Conversation &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;In other words, you have a session alive and kickin' for the whole business transaction your WebForm is accomplishing and, being the NHibernate Session a Unit of Work implementation, this is absolutely faithful to that pattern definition.&lt;/p&gt;  &lt;p&gt;For some reasons, using a similar approach with Linq To Sql's DataContext is not as easy. Let's take a look.&lt;/p&gt;  &lt;h2&gt;Dealing with detached objects&lt;/h2&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;p&gt;Let's start saying that associations in L2S are lazy fetched by default, so you need to have a context alive while navigating the entity graph if you don't want ObjectDisposedExceptions to be raised:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="185" alt="image" src="http://www.marcodesanctis.it/images/Blog/HowmuchyourLinqToSqlDataContextshouldsta_10412/image.png" width="621" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;When adopting a Session per Request pattern, you must frequently detach/reattach the entity versus the current request's DataContext; however, attaching a detached entity in Linq To Sql is not as easy as it's supposed to be, as it isn't a supported scenario. I &lt;a href="http://blogs.ugidotnet.org/Crad/archive/2007/09/21/tre-cosine-che-mi-sono-piaciute-poco-di-linq-to.aspx"&gt;blogged in Italian&lt;/a&gt; a while ago about some strange reattaching behaviors I experienced in Beta2; RTM throws an exception if you try to reattach a persistent entity with associations not yet initialized, at least that's a more consistent behavior, although it doesn't help.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="255" alt="image" src="http://www.marcodesanctis.it/images/Blog/HowmuchyourLinqToSqlDataContextshouldsta_10412/image_3.png" width="540" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;In other words, unless you don't want to deal with workarounds, you can't use Session per Request pattern with Linq To Sql.&lt;/p&gt;  &lt;h2&gt;Moving towards &lt;strike&gt;Session&lt;/strike&gt; DataContext per Conversation&lt;/h2&gt;  &lt;p&gt;That brings us to the decision of having the same DataContext alive for the whole business transaction. I'm fine with that, although the architecture becomes a bit more complicated because its life should span several postbacks. After chatting a while with &lt;a href="http://www.nablasoft.com/Alkampfer/"&gt;my friend Alk&lt;/a&gt;, I realized that ASP.NET's Cache is an awesome storage mechanism for DataContexts because:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;In a perfect world, every business transaction should be explicitely closed. In real world, however, users tend to close their browsers without notice. If we use sliding expiration, the ASP.NET's caching infrastructure takes care itself on getting rid of every pending DataContext that hasn't properly been disposed. &lt;/li&gt;    &lt;li&gt;Cache's sliding expiration is automatically renewed on every access. &lt;/li&gt;    &lt;li&gt;Cache provides a callback mechanism, so we can execute custom code when a DataContext has expired. &lt;/li&gt;    &lt;li&gt;We can configure Cache to not remove DataContexts when the system is in need of memory. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Instead of directly storing the DataContext, it's a better choice to wrap it in a generic UnitOfWork instance; this allows us to inject a bit of additional (and useful) logic:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="258" alt="" src="http://www.marcodesanctis.it/images/Blog/HowmuchyourLinqToSqlDataContextshouldsta_10412/image_4.png" width="471" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;The &lt;em&gt;Items&lt;/em&gt; property, for example, is a string/object dictionary (an idea borrowed from &lt;a href="http://nhcontrib.wiki.sourceforge.net/BurrowHome"&gt;NHibernate.Burrow&lt;/a&gt;) used to store custom transaction items that need to last till the transaction ends; I've also provided a Disposing event if the user wants to execute some custom code when a UnitOfWork is closed.&lt;/p&gt;  &lt;p&gt;A UnitOfWorkContainer singleton object keeps track of all active UnitOfWorks and provides methods to start, rollback or commit (business) transactions:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="217" alt="image" src="http://www.marcodesanctis.it/images/Blog/HowmuchyourLinqToSqlDataContextshouldsta_10412/image_5.png" width="279" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Thanks to that, building a new UnitOfWork and storing it in the cache repository is only a matter of calling the BeginTransaction&amp;lt;T&amp;gt; (T is the Linq to Sql context's concrete type) of the UnitOfWorkContainer singleton class:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="242" alt="image" src="http://www.marcodesanctis.it/images/Blog/HowmuchyourLinqToSqlDataContextshouldsta_10412/image_6.png" width="553" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;That method returns an ID which can be easily stored (f.e. using Viewstate) and will be used to retrieve the current UoW during the future postbacks. Now that a UoW has been created and stored into the container, we can retrieve it very easily &lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="179" alt="image" src="http://www.marcodesanctis.it/images/Blog/HowmuchyourLinqToSqlDataContextshouldsta_10412/image_7.png" width="552" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;and we can use it to interact with the underlying Linq DataContext or with the Items storage as well; for example, the Page_Load method in my example contains the following code:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="372" alt="image" src="http://www.marcodesanctis.it/images/Blog/HowmuchyourLinqToSqlDataContextshouldsta_10412/image_8.png" width="466" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Thanks to this code, in every postback we have a reference to the person currently edited through the &lt;em&gt;entity &lt;/em&gt;filed, we can freely navigate its object graph with the DataContext automatically querying the underlying database if it needs to lazily initialize any property, and tracking every change we make to any entity, being it the current Person instance or any associated one. Not bad, isn't it?&lt;/p&gt;  &lt;p&gt;After some postbacks, here it comes the end of the conversation, in which the user is asked to say "Ok" and persist the changes, or say "No" and cancel everything; this ends the business transaction and invalidates the UnitOfWork:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="219" alt="image" src="http://www.marcodesanctis.it/images/Blog/HowmuchyourLinqToSqlDataContextshouldsta_10412/image_9.png" width="512" border="0" /&gt; &lt;/p&gt;  &lt;h2&gt;Few details on what happens behind the curtain&lt;/h2&gt;  &lt;p&gt;The UnitOfWorkContainer class acts as a repository, providing methods to manage a UoW's lifetime and retrieve it given its Id. Once the user decides to begin a new business transaction, a new UoW is created and added to ASP.NET Cache:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="253" alt="image" src="http://www.marcodesanctis.it/images/Blog/HowmuchyourLinqToSqlDataContextshouldsta_10412/image_10.png" width="586" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Two details to notice here:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The cache item is marked as NotRemovable, so it won't be cleared in case of memory shortage; it will disappear only after a 10 minutes sliding timeout or if explicitely removed. &lt;/li&gt;    &lt;li&gt;I've subscribed a CacheItemRemovedCallback to dispose the UoW once it has been removed from the cache (and, therefore, not reachable anymore from the client code) &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Obviously this is only a very simple example, something very similar to what I used to do with NHibernate. For those who are interested on it as a starting point for their own apps, source code is &lt;a href="http://www.marcodesanctis.it/images/Blog/ContextPerConversation.zip"&gt;available here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodemetropolis.com%2farchive%2f2008%2f05%2f20%2flinq-to-sql-in-real-word-web-applications.aspx"&gt;&lt;img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodemetropolis.com%2farchive%2f2008%2f05%2f20%2flinq-to-sql-in-real-word-web-applications.aspx&amp;amp;bgcolor=FF9900" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:9dc603e0-56fd-4205-95c4-e4301346397d" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/LINQ%20to%20Sql" rel="tag"&gt;LINQ to Sql&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ASP.NET" rel="tag"&gt;ASP.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Session%20per%20Conversation" rel="tag"&gt;Session per Conversation&lt;/a&gt;&lt;/div&gt;&lt;img src="http://codemetropolis.com/aggbug/9.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/05/20/linq-to-sql-in-real-word-web-applications.aspx</guid>
            <pubDate>Tue, 20 May 2008 21:34:23 GMT</pubDate>
            <wfw:comment>http://codemetropolis.com/comments/9.aspx</wfw:comment>
            <comments>http://codemetropolis.com/archive/2008/05/20/linq-to-sql-in-real-word-web-applications.aspx#feedback</comments>
            <slash:comments>9</slash:comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/9.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/9.aspx</trackback:ping>
        </item>
        <item>
            <title>Create a WPF skinnable ImageUploader control</title>
            <category>WPF</category>
            <link>http://codemetropolis.com/archive/2008/05/15/create-a-wpf-skinnable-imageuploader-control.aspx</link>
            <description>&lt;p&gt;&lt;a href="http://codemetropolis.com/archive/2008/05/08/bind-a-linq-binary-type-to-imagesource.aspx"&gt;In a previous post&lt;/a&gt;, I showed how you can directly bind a Binary LINQ type to a WPF Image control implementing an ad-hoc type converter, not so much useful unless you don't have your images already stored on your database. What we need is something that is capable to achieve a two way binding, both displaying images and allowing users to upload their own; what about a brand new, completely skinnable, WPF custom control? So, let's create a new WPF project and add a new CustomControl called ImageUploader and take care of its logic first. &lt;a href="http://codemetropolis.com/archive/2008/05/09/wpf-best-practices-decoupling-behavior-from-the-view.aspx"&gt;As I wrote elsewhere&lt;/a&gt;, it's a good practice to design control's behavior (and implement it) without references to any UI element. &lt;/p&gt;  &lt;p&gt;First of all, we need a property where to store an &lt;em&gt;ImageSource&lt;/em&gt; object; we want it to be two-way bindable, so we are going to build a dependency property instead of a plain CLR one with appropriate FrameworkPropertyMetadataOptions:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="146" alt="image" src="http://www.marcodesanctis.it/images/Blog/CreateaWPFcustomImageUploadercontrol_1894/image.png" width="665" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Next, we need a couple of commands:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;a Clear command (we want the user being able to remove the current image) &lt;/li&gt;    &lt;li&gt;a Browse command to upload a new picture &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;If you've read &lt;a href="http://codemetropolis.com/archive/2008/05/09/wpf-best-practices-decoupling-behavior-from-the-view.aspx"&gt;some posts of mine&lt;/a&gt;, lately, you should perfectly know how to create custom commands and bind them to handlers &lt;img alt="smile_regular" src="http://spaces.live.com/rte/emoticons/smile_regular.gif" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="292" alt="image" src="http://www.marcodesanctis.it/images/Blog/CreateaWPFcustomImageUploadercontrol_1894/image12.png" width="523" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;The ClearImageCommand handler is pretty straightforward:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="127" alt="image" src="http://www.marcodesanctis.it/images/Blog/CreateaWPFcustomImageUploadercontrol_1894/image17.png" width="523" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Same for the BrowseCommand handler, although it deserves one little note: we could obviously use the &lt;a href="http://msdn.microsoft.com/en-us/library/ms602473.aspx"&gt;BitmapImage constructor with a URI&lt;/a&gt; as argument to directly reference the file; however this approach leaves the file locked for the whole BitampImage lifetime (which unfortunately ends only when GC wants to). Therefore what we do is manually handling its loading, setting the &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapimage.cacheoption.aspx"&gt;CacheOption&lt;/a&gt; property to load the entire image data during its init stage and caching it in a MemoryStream:&lt;/p&gt;  &lt;p&gt; &lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="390" alt="image" src="http://www.marcodesanctis.it/images/Blog/CreateaWPFcustomImageUploadercontrol_1894/image_3.png" width="460" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Now that our control's logic is completely defined (and, again, &lt;strong&gt;without references to any UI element&lt;/strong&gt;), we can move to creating a default layout on the generic.xaml file; a very simple one could be the following&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="301" alt="image" src="http://www.marcodesanctis.it/images/Blog/CreateaWPFcustomImageUploadercontrol_1894/image_4.png" width="469" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;that is not so bad if we add a bit of animation...&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:5999d296-3440-46ad-8576-7ba9d179760f" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; width: 283px; padding-top: 0px"&gt;&lt;div id="6f40292b-66e8-4d00-be33-3420963e0a4e" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://video.msn.com/video.aspx?vid=cb2705d9-b96a-4f92-b3cb-e371b0634f08&amp;amp;from=writer" target="_new"&gt;&lt;img src="http://www.marcodesanctis.it/images/Blog/CreateaWPFcustomImageUploadercontrol_1894/video0ab3dedaea2c.jpg" galleryimg="no" onload="var downlevelDiv = document.getElementById('6f40292b-66e8-4d00-be33-3420963e0a4e'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;embed src=\&amp;quot;http://images.video.msn.com/flash/soapbox1_1.swf\&amp;quot; quality=\&amp;quot;high\&amp;quot; width=\&amp;quot;283\&amp;quot; height=\&amp;quot;238\&amp;quot; wmode=\&amp;quot;transparent\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; pluginspage=\&amp;quot;http://macromedia.com/go/getflashplayer\&amp;quot; flashvars=\&amp;quot;c=v&amp;amp;v=cb2705d9-b96a-4f92-b3cb-e371b0634f08&amp;amp;from=writer\&amp;quot; &amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;Anyway, doing something fancier is only a matter of Blend skills (and mine are awful).&lt;/p&gt;  &lt;p&gt;One last note: the BinaryToImageConverter I showed you &lt;a href="http://codemetropolis.com/archive/2008/05/08/bind-a-linq-binary-type-to-imagesource.aspx"&gt;here&lt;/a&gt; is still one-way only. To get it work in both directions, we must implement the ConvertBack method:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="396" alt="image" src="http://www.marcodesanctis.it/images/Blog/CreateaWPFcustomImageUploadercontrol_1894/image_5.png" width="443" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 15px 0px 0px; border-right-width: 0px" height="62" alt="image" src="http://www.marcodesanctis.it/images/Blog/CreateaWPFcustomImageUploadercontrol_1894/image_6.png" width="64" align="left" border="0" /&gt; &lt;a href="http://www.marcodesanctis.it/images/Blog/ImageUploaderControlSolution.zip"&gt;Here's the complete source code&lt;/a&gt;, obviously released under the "Works on my machine" license &lt;img alt="smile_wink" src="http://spaces.live.com/rte/emoticons/smile_wink.gif" /&gt;&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodemetropolis.com%2farchive%2f2008%2f05%2f15%2fcreate-a-wpf-skinnable-imageuploader-control.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodemetropolis.com%2farchive%2f2008%2f05%2f15%2fcreate-a-wpf-skinnable-imageuploader-control.aspx&amp;amp;bgcolor=FF9900" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f7aaff00-785e-4bbc-81ba-96f4566ddb69" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/WPF" rel="tag"&gt;WPF&lt;/a&gt;, &lt;a href="http://technorati.com/tags/WPF%20Binding" rel="tag"&gt;WPF Binding&lt;/a&gt;, &lt;a href="http://technorati.com/tags/WPF%20Custom%20Controls" rel="tag"&gt;WPF Custom Controls&lt;/a&gt;&lt;/div&gt;&lt;img src="http://codemetropolis.com/aggbug/8.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/05/15/create-a-wpf-skinnable-imageuploader-control.aspx</guid>
            <pubDate>Wed, 14 May 2008 23:12:44 GMT</pubDate>
            <wfw:comment>http://codemetropolis.com/comments/8.aspx</wfw:comment>
            <comments>http://codemetropolis.com/archive/2008/05/15/create-a-wpf-skinnable-imageuploader-control.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/8.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/8.aspx</trackback:ping>
        </item>
        <item>
            <title>Cool, professional (and free!) WPF controls</title>
            <category>WPF</category>
            <link>http://codemetropolis.com/archive/2008/05/12/cool-professional-and-free-wpf-controls.aspx</link>
            <description>&lt;p&gt;Today &lt;a href="http://www.nablasoft.com/alkampfer/?p=242"&gt;I saw a post&lt;/a&gt; of a &lt;a href="http://www.nablasoft.com/alkampfer/"&gt;friend of mine&lt;/a&gt; about WPF lacking some of the controls we used to have in Windows Forms (who said DateTimePicker? or was it DataGrid?). Indeed, there are many Open Source project to fill the gap, like &lt;a href="http://www.codeplex.com/AvalonControlsLib"&gt;AvalonControlsLibrary&lt;/a&gt; or &lt;a href="http://www.codeplex.com/wpftoolbelt"&gt;WPF Toolbelt&lt;/a&gt;, but beside that, &lt;a href="http://xceed.com/"&gt;Xceed&lt;/a&gt; has &lt;a href="http://xceed.com/Grid_WPF_Intro.html"&gt;an excellent DataGrid&lt;/a&gt; (although not so straightforward to use) which has a free express edition that can be used even in commercial apps.&lt;/p&gt;  &lt;p&gt;The cool thing is that the package includes a bunch of other useful controls, like a DateTimePicker, a MaskedEditTextbox, and so on, that can be obviously used on their own. Moreover, everything is well documented and with many samples.&lt;/p&gt;  &lt;p&gt;Uh... I was almost forgetting, I'm not related in any way to Xceed Software, it's simply what I think could be a good advice.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:03fd179c-16c9-40d8-9225-935ed961a14c" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/WPF%20Controls" rel="tag"&gt;WPF Controls&lt;/a&gt;,&lt;a href="http://technorati.com/tags/DataGrid" rel="tag"&gt;DataGrid&lt;/a&gt;,&lt;a href="http://technorati.com/tags/DateTimePicker" rel="tag"&gt;DateTimePicker&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Xceed" rel="tag"&gt;Xceed&lt;/a&gt;&lt;/div&gt;&lt;img src="http://codemetropolis.com/aggbug/7.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/05/12/cool-professional-and-free-wpf-controls.aspx</guid>
            <pubDate>Mon, 12 May 2008 08:37:03 GMT</pubDate>
            <wfw:comment>http://codemetropolis.com/comments/7.aspx</wfw:comment>
            <comments>http://codemetropolis.com/archive/2008/05/12/cool-professional-and-free-wpf-controls.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/7.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/7.aspx</trackback:ping>
        </item>
        <item>
            <title>Beware the XamlParseException...</title>
            <category>WPF</category>
            <link>http://codemetropolis.com/archive/2008/05/12/beware-the-xamlparseexception.aspx</link>
            <description>&lt;p&gt;...it doesn't necessarily mean that there's something wrong with your Xaml: it's thrown for any error during the constructor execution, even though it's caused by a C# line:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="147" alt="image" src="http://www.marcodesanctis.it/images/Blog/BewaretheXamlParseException_7AE0/image_thumb.png" width="576" border="0" /&gt; &lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e59d01e7-bbfc-42ce-856d-12cd9f1cd647" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/WPF" rel="tag"&gt;WPF&lt;/a&gt;&lt;/div&gt;&lt;img src="http://codemetropolis.com/aggbug/6.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/05/12/beware-the-xamlparseexception.aspx</guid>
            <pubDate>Mon, 12 May 2008 06:43:49 GMT</pubDate>
            <wfw:comment>http://codemetropolis.com/comments/6.aspx</wfw:comment>
            <comments>http://codemetropolis.com/archive/2008/05/12/beware-the-xamlparseexception.aspx#feedback</comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/6.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/6.aspx</trackback:ping>
        </item>
    </channel>
</rss>
