<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><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>Crunch mode is a pure waste of time, energy and money</title>
            <category>Misc</category>
            <link>http://codemetropolis.com/archive/2008/07/31/crunch-mode-is-a-pure-waste-of-time-energy-and.aspx</link>
            <description>&lt;p&gt;Crunch mode, overtimes, weekends spent at the office, are at the very first sight the easiest way to maximize production to meet strict deadlines: my experience is that actually many companies operating in the Italian IT market intensively use this approach. Is the effort worth the gains? Is a tired employee able to work at the same quality level of a fresh one? Obviously not, crunch mode reveals to be counterproductive after a short amount of time. &lt;a href="http://blogs.ugidotnet.org/Franny/Default.aspx"&gt;Francesco Carucci&lt;/a&gt;, a member of the &lt;a href="http://www.ugidotnet.org/"&gt;Italian .NET User Group&lt;/a&gt;, &lt;a href="http://blogs.ugidotnet.org/Franny/archive/2008/07/28/93547.aspx"&gt;recently posted&lt;/a&gt; a link to a very interesting article every PM should read.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.igda.org/articles/erobinson_crunch.php"&gt;Here it is&lt;/a&gt;, enjoy.&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/Crunch%20Mode"&gt;Crunch Mode&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Overtimes"&gt;Overtimes&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Project%20management"&gt;Project management&lt;/a&gt;&lt;/p&gt;&lt;img src="http://codemetropolis.com/aggbug/19.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/07/31/crunch-mode-is-a-pure-waste-of-time-energy-and.aspx</guid>
            <pubDate>Thu, 31 Jul 2008 15:41:36 GMT</pubDate>
            <comments>http://codemetropolis.com/archive/2008/07/31/crunch-mode-is-a-pure-waste-of-time-energy-and.aspx#feedback</comments>
            <slash:comments>10</slash:comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/19.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/19.aspx</trackback:ping>
        </item>
        <item>
            <title>Double Click on the .sln file doesn't open Visual Studio on Vista</title>
            <category>Misc</category>
            <link>http://codemetropolis.com/archive/2008/07/27/double-click-on-the-.sln-file-doesnt-open-visual-studio.aspx</link>
            <description>&lt;p&gt;It's a very annoying bug I had to cohabit with for a while. Today I was less patient than usual and I decided to get rid of it :-)&lt;/p&gt;  &lt;p&gt;I googled for a minute to find a comment on &lt;a href="http://www.pluralsight.com/community/blogs/matt/archive/2007/05/21/47446.aspx"&gt;this post&lt;/a&gt; with the solution I needed:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;It works when you set both Launcher (C:\Program Files\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe) and IDE (C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe) to run as administrator. (Right click .exe and select Properties -&amp;gt; Compatibility, and choose Run as Administrator)&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Oh... obviously a solution could be to directly bind the .sln files to devenv.exe, but I think this is a nicer one.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodemetropolis.com%2farchive%2f2008%2f07%2f27%2fdouble-click-on-the-.sln-file-doesnt-open-visual-studio.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%2f07%2f27%2fdouble-click-on-the-.sln-file-doesnt-open-visual-studio.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:f234a86b-3262-4b36-aef2-0c95ea30a826" 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/Visual%20Studio" rel="tag"&gt;Visual Studio&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Vista" rel="tag"&gt;Vista&lt;/a&gt;&lt;/div&gt;&lt;img src="http://codemetropolis.com/aggbug/18.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/07/27/double-click-on-the-.sln-file-doesnt-open-visual-studio.aspx</guid>
            <pubDate>Sun, 27 Jul 2008 07:02:14 GMT</pubDate>
            <comments>http://codemetropolis.com/archive/2008/07/27/double-click-on-the-.sln-file-doesnt-open-visual-studio.aspx#feedback</comments>
            <slash:comments>7</slash:comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/18.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/18.aspx</trackback:ping>
        </item>
        <item>
            <title>Domain Model &amp;amp; Aggregates: when do master-detail associations happen?</title>
            <category>Software Architecture</category>
            <link>http://codemetropolis.com/archive/2008/07/22/domain-model-amp-aggregates-when-do-master-detail-associations-happen.aspx</link>
            <description>&lt;p&gt;During my experience as a consultant, I usually come across domain models in which entities are so interconnected that my head begins to hurt just a minute after I'm trying to figure out where each aggregation symbol leads to, and often the source of all pain is the overuse of master-detail relationship.&lt;/p&gt;  &lt;p&gt;An &lt;strong&gt;association&lt;/strong&gt; in a domain model is something etheral, something that apart from its implementation, represent a logical connection between two or more abstract entities. It usually translates itself as a reference in a Object Oriented world and, for example, as a FK relationship between two tables in a relational database.&lt;/p&gt;  &lt;p&gt;Now, let's consider a &lt;strong&gt;Bill - BillDetail&lt;/strong&gt; relationship: no one would disagree if I modeled it with the following couple of classes, building a two ways master-detail association:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="167" alt="image" src="http://www.marcodesanctis.it/images/Blog/DomainModelAggregates_9F40/image_5.png" width="457" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;When we project it to a relational database schema, it becomes something like this:&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="157" alt="image" src="http://www.marcodesanctis.it/images/Blog/DomainModelAggregates_9F40/image_3.png" width="462" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Relational representation lacks a lot of the expressivity the object oriented paradigm provides: looking at the classes topology, we can explicitely see that one Bill instance holds a reference to a collection of BillDetails, and thanks to BillDetail.ParentBill property, we can walk that association in both directions while navigating the object graph; all those infos are only implicitely stored in the relational FK association.&lt;/p&gt;  &lt;p&gt;In fact, what happens when we consider the Customer the bill belongs to? Let's start from DB schema this time, as most of us are (incorrectly) still used to do while designing a domain model:&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="148" alt="image" src="http://www.marcodesanctis.it/images/Blog/DomainModelAggregates_9F40/image_4.png" width="458" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Now, the inexperienced (but somehow smart) designer should feel that something's different between the two aforementioned examples, even though the relational representation is exactly the same: the association from a bill towards its customer is something we all agree with, but what about the mirrored association? Should we blindly equip our Customer entity with a Bills collection? Or should we simply ignore that side, perhaps providing a GetBillsByCustomer(..) service if we really need to walk from a customer to his bills?&lt;/p&gt;  &lt;p&gt;There's a subtle differerence going on between these two examples, something that, once again, is not easy to infer if we're using the database schema as the starting point for our modeling process. A &lt;strong&gt;bill detail&lt;/strong&gt; is something unuseful if taken away from its root; the "&lt;strong&gt;Bill&lt;/strong&gt;" entity with all its details, encompasses the business concept of a real world "&lt;strong&gt;Bill&lt;/strong&gt;". Using a DDD term, they are an &lt;strong&gt;Aggregate&lt;/strong&gt;, whose &lt;strong&gt;root&lt;/strong&gt; is the Bill itself. In that case, implementing a master detail relationship between the two makes a lot of sense, because you're always going to access each bill detail coming from the main Bill entity (you should never access directly each bill detail, according to what &lt;a href="http://www.domainlanguage.com/about/ericevans.html"&gt;Eric Evans&lt;/a&gt; states in its &lt;a href="http://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215"&gt;Domain Driven Design&lt;/a&gt; book).&lt;/p&gt;  &lt;p&gt;The relationship between Customer and its Bills now is clearly different! There's nothing bad on directly referencing a Bill, without coming from the Customer, actually a Bill makes a lot of sense (and has a huge business meaning) even though we don't even take care of which customer it belongs to! in other words, &lt;strong&gt;Customer and its Bills are not an aggregate&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;Why we should avoid master-detail relationship between the two? Because associations are cool, but don't come for free: they have a great cost in terms of complexity and performance, even though we can leverage some ORM to limit the impact on the application. What could be the purpose of a "Bills" property into the Customer class? Even if we suppose to lazy load it, simply accessing it would trigger a query for every bill he has, regardless of the period, of its paying status, and so on. Does it have a business meaning? I don't think so, but that wrong design choice makes us paying its cost anyway.&lt;/p&gt;  &lt;p&gt;In other words, a good rule of thumb is: &lt;strong&gt;if it's not an aggregate, limit the cohesion and try to avoid master-detail relationships because they are expensive&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;I hope many of you agree with that.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:16ae317e-493a-4dcb-8664-c28f789ce7a9" 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/Domain%20Driven%20Design" rel="tag"&gt;Domain Driven Design&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Association" rel="tag"&gt;Association&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Aggregate" rel="tag"&gt;Aggregate&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodemetropolis.com%2farchive%2f2008%2f07%2f22%2fdomain-model-amp-aggregates-when-do-master-detail-associations-happen.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%2f07%2f22%2fdomain-model-amp-aggregates-when-do-master-detail-associations-happen.aspx&amp;amp;bgcolor=FF9900" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://codemetropolis.com/aggbug/17.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/07/22/domain-model-amp-aggregates-when-do-master-detail-associations-happen.aspx</guid>
            <pubDate>Tue, 22 Jul 2008 14:08:09 GMT</pubDate>
            <comments>http://codemetropolis.com/archive/2008/07/22/domain-model-amp-aggregates-when-do-master-detail-associations-happen.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/17.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/17.aspx</trackback:ping>
        </item>
        <item>
            <title>How I Got Started in Software Development</title>
            <category>Misc</category>
            <link>http://codemetropolis.com/archive/2008/07/14/how-i-got-started-in-software-development.aspx</link>
            <description>&lt;p&gt;A couple (perhaps more?) days ago, my friend &lt;a href="http://codeclimber.net.nz/"&gt;Simone&lt;/a&gt; &lt;a href="http://codeclimber.net.nz/archive/2008/07/10/How-I-Got-Started-in-Software-Development.aspx"&gt;tagged me&lt;/a&gt; with the brand new meme &lt;strong&gt;How did you got started in software development?&lt;/strong&gt; Uhm... ok... here we go ;-)&lt;/p&gt;  &lt;h2&gt;How old were you when you started programming?&lt;/h2&gt;  &lt;p&gt;I can't tell it for sure, it must have been when I was 6 or 7 with my father's Pc IBM (who was actually doing it professionally). Anyway... I'm talking about early 80s here.&lt;/p&gt;  &lt;h2&gt;How did you get started in programming?&lt;/h2&gt;  &lt;p&gt;My father wanted me to learn how to do it, although I was very young and all that I could do was summing two numbers or playing some notes on the internal beeper. After that very early period, I focused more on videogames for some years, until Visual Basic 1.0 came out. I was so excited that I decided this would have been my life's profession.&lt;/p&gt;  &lt;h2&gt;What was your first language?&lt;/h2&gt;  &lt;p&gt;Basic&lt;/p&gt;  &lt;h2&gt;What was the first real program you wrote?&lt;/h2&gt;  &lt;p&gt;It was a car taxes calculator I made for a company that hired me during summertime (I was still a student). I made it in Visual Basic for MS-DOS (can anyone remember it?)&lt;/p&gt;  &lt;h2&gt;What languages have you used since you started programming?&lt;/h2&gt;  &lt;p&gt;So many... C, C++, Assembler, Basic, Visual Basic, C#, HTML, Javascript, Java... Oh... and VHDL too, as I've been working on digital controlled power supply too.&lt;/p&gt;  &lt;h2&gt;What was your first professional programming gig?&lt;/h2&gt;  &lt;p&gt;As I said before, I joined a company to do some work during summer time while I was still a student. Then I re-joined the same company many years later, after my degree in engineering.&lt;/p&gt;  &lt;h2&gt;If you knew then what you know now, would you have started programming?&lt;/h2&gt;  &lt;p&gt;Uhm... I think so... I'm actually so happy on what I do every day. However, if I could, I would take some different path on my professional career.&lt;/p&gt;  &lt;h2&gt;If there is one thing you learned along the way that you would tell new developers, what would it be?  &lt;/h2&gt;  &lt;p&gt;Try to work with the best, and someday you'll become one of them too.&lt;/p&gt;  &lt;h2&gt;What's the most fun you've ever had ... programming?&lt;/h2&gt;  &lt;p&gt;Too easy... having diner with my friends at &lt;a href="http://blogs.ugidotnet.org/"&gt;UGIdotNet&lt;/a&gt; after a meeting!!&lt;/p&gt;  &lt;h2&gt;Who do I tag?&lt;/h2&gt;  &lt;p&gt;Uhm... what about my friend &lt;a href="http://www.nablasoft.com/alkampfer/"&gt;Alkampfer&lt;/a&gt;? :D&lt;/p&gt;&lt;img src="http://codemetropolis.com/aggbug/16.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Marco De Sanctis</dc:creator>
            <guid>http://codemetropolis.com/archive/2008/07/14/how-i-got-started-in-software-development.aspx</guid>
            <pubDate>Sun, 13 Jul 2008 22:16:23 GMT</pubDate>
            <comments>http://codemetropolis.com/archive/2008/07/14/how-i-got-started-in-software-development.aspx#feedback</comments>
            <slash:comments>9</slash:comments>
            <wfw:commentRss>http://codemetropolis.com/comments/commentRss/16.aspx</wfw:commentRss>
            <trackback:ping>http://codemetropolis.com/services/trackbacks/16.aspx</trackback:ping>
        </item>
        <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>
            <comments>http://codemetropolis.com/archive/2008/06/30/unleash-the-power-of-visualstatemanager-with-custom-states.aspx#feedback</comments>
            <slash:comments>12</slash: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>
            <comments>http://codemetropolis.com/archive/2008/06/25/blend-2.5-june-ctp-and-custom-controls-templating.aspx#feedback</comments>
            <slash:comments>10</slash: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>
            <comments>http://codemetropolis.com/archive/2008/06/14/transactionscope-timeout.aspx#feedback</comments>
            <slash:comments>32</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>
            <comments>http://codemetropolis.com/archive/2008/06/11/custom-controls-and-default-template-in-silverlight-2-beta-2.aspx#feedback</comments>
            <slash:comments>9</slash: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>
            <comments>http://codemetropolis.com/archive/2008/06/06/silverlight-2-beta-2-documentation-available.aspx#feedback</comments>
            <slash:comments>64</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>
            <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>
    </channel>
</rss>
