<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Living in the Tech Avalanche Generation</title>
	<atom:link href="http://www.simonsegal.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.simonsegal.net/blog</link>
	<description>A practitioner's introspective on technology</description>
	<pubDate>Mon, 19 Sep 2011 01:21:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/au/</creativeCommons:license>		<item>
		<title>NServiceBus 3 Day Course comes to Melbourne Australia</title>
		<link>http://www.simonsegal.net/blog/2011/09/19/nservicebus-3-day-course-comes-to-melbourne-australia/</link>
		<comments>http://www.simonsegal.net/blog/2011/09/19/nservicebus-3-day-course-comes-to-melbourne-australia/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 01:20:03 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[NServiceBus]]></category>

		<category><![CDATA[Training]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2011/09/19/nservicebus-3-day-course-comes-to-melbourne-australia/</guid>
		<description><![CDATA[I am happy to announce that Lextrico will be running Udi Dahan’s 3 Day Enterprise Development with NServiceBus course in Melbourne between the 7th and 9th of November 2011. The course will be delivered by Mark Harris and myself and will run at Karstens Training facility in Queen St Melbourne. Morning tea, lunch and afternoon [...]<p><a href="http://www.simonsegal.net/blog/2011/09/19/nservicebus-3-day-course-comes-to-melbourne-australia/">NServiceBus 3 Day Course comes to Melbourne Australia</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p align="justify"><a href="http://www.lextrico.com" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 1px 8px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top: 0px; border-right: 0px; padding-top: 0px" title="logo" border="0" alt="logo" align="left" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/09/logo.png" width="211" height="81" /></a>I am happy to announce that <a href="http://www.lextrico.com" target="_blank">Lextrico</a> will be running Udi Dahan’s 3 Day Enterprise <a href="http://www.nservicebus.com" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 6px 0px 0px 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/09/image.png" width="214" height="65" /></a>Development with <a href="http://www.lextrico.com/index.php/nservicebus/" target="_blank">NServiceBus course</a> in Melbourne between the 7th and 9th of November 2011. The course will be delivered by Mark Harris and myself and will run at <a href="http://www.karstens.com.au/" target="_blank">Karstens</a> Training facility in <a href="http://maps.google.com.au/maps?hl=en&amp;sugexp=gsis,i18n%3Dtrue&amp;cp=10&amp;gs_id=10&amp;xhr=t&amp;safe=off&amp;gs_upl=&amp;bav=on.2,or.r_gc.r_pw.&amp;biw=1440&amp;bih=799&amp;um=1&amp;ie=UTF-8&amp;q=karstens+melbourne&amp;fb=1&amp;gl=au&amp;hq=karstens&amp;hnear=0x6ad646b5d2ba4df7:0x4045675218ccd90,Melbourne+VIC&amp;cid=0,0,302921789635403033&amp;ei=AQFyTu_JEejhmAXJ8JibCg&amp;sa=X&amp;oi=local_result&amp;ct=image&amp;sqi=2&amp;ved=0CAoQ_BI" target="_blank">Queen St Melbourne</a>. Morning tea, lunch and afternoon tea are all catered for and included in the registration cost which is now open <a href="http://www.eventbrite.com/event/2198439592" target="_blank">here</a>.</p>
<p align="justify">Look forward to seeing you there!</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=NServiceBus%203%20Day%20Course%20comes%20to%20Melbourne%20Australia&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2011%2F09%2F19%2Fnservicebus-3-day-course-comes-to-melbourne-australia%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="NServiceBus 3 Day Course comes to Melbourne Australia";
		a2a_linkurl="http://www.simonsegal.net/blog/2011/09/19/nservicebus-3-day-course-comes-to-melbourne-australia/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2011/09/19/nservicebus-3-day-course-comes-to-melbourne-australia/">NServiceBus 3 Day Course comes to Melbourne Australia</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2011/09/19/nservicebus-3-day-course-comes-to-melbourne-australia/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Speaking at alt.NET</title>
		<link>http://www.simonsegal.net/blog/2011/09/17/speaking-at-altnet/</link>
		<comments>http://www.simonsegal.net/blog/2011/09/17/speaking-at-altnet/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 14:01:31 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[Design Patterns]]></category>

		<category><![CDATA[SmartClients]]></category>

		<category><![CDATA[alt.Net]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2011/09/17/speaking-at-altnet/</guid>
		<description><![CDATA[I will be speaking at the September meeting of the alt.Net User group about Task Based user interfaces, their benefits and how explicitly modelled code can make the job easier, more manageable and lead to systems that leave the business in control. I will also discuss how this approach can leverage alternative patterns to MVVM [...]<p><a href="http://www.simonsegal.net/blog/2011/09/17/speaking-at-altnet/">Speaking at alt.NET</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p align="justify"><a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/09/megaphone.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 1px 11px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top: 0px; border-right: 0px; padding-top: 0px" title="megaphone" border="0" alt="megaphone" align="left" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/09/megaphone-thumb.jpg" width="125" height="125" /></a>I will be speaking at the September meeting of the alt.Net User group about Task Based user interfaces, their benefits and how explicitly modelled code can make the job easier, more manageable and lead to systems that leave the business in control. I will also discuss how this approach can leverage alternative patterns to MVVM and work hand in hand with messaging.</p>
<p align="justify">I started a series of posts on this topic recently if you are interested in a preview of the subject matter. You can <a href="http://melbourne.ozalt.net/2011/09/september-meeting.html" target="_blank">register here</a>.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=Speaking%20at%20alt.NET&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2011%2F09%2F17%2Fspeaking-at-altnet%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Speaking at alt.NET";
		a2a_linkurl="http://www.simonsegal.net/blog/2011/09/17/speaking-at-altnet/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2011/09/17/speaking-at-altnet/">Speaking at alt.NET</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2011/09/17/speaking-at-altnet/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A sense of Entitlement?&#8230;stop your whining!</title>
		<link>http://www.simonsegal.net/blog/2011/08/22/a-sense-of-entitlementstop-your-whining/</link>
		<comments>http://www.simonsegal.net/blog/2011/08/22/a-sense-of-entitlementstop-your-whining/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 12:10:08 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[Introspection]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2011/08/22/a-sense-of-entitlementstop-your-whining/</guid>
		<description><![CDATA[Most developers spend a lot of time learning. Who can claim an entire lifetime career invested in a single language, or platform?…VB6 to C# to TSQL to JavaScript to Ruby and so on. Sure there are plenty of professions that don’t necessitate quite the same level of time investment in learning the tools of a [...]<p><a href="http://www.simonsegal.net/blog/2011/08/22/a-sense-of-entitlementstop-your-whining/">A sense of Entitlement?&hellip;stop your whining!</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p align="justify">Most developers spend a lot of time learning. Who can claim an entire lifetime career invested in a single language, or platform?…VB6 to C# to TSQL to JavaScript to Ruby and so on. Sure there are plenty of professions that don’t necessitate quite the same level of time investment in learning the tools of a ‘craft’, but if you stand still you should <em>expect</em> to go nowhere. </p>
<p align="justify">I have worked with lots of different types over the years and developers are no different to<a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/couch-potato-cat-2.jpg"><img style="background-image: none; border-right-width: 0px; margin: 6px 0px 0px 13px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="couch-potato-cat (2)" border="0" alt="couch-potato-cat (2)" align="right" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/couch-potato-cat-2-thumb.jpg" width="260" height="208" /></a> most, there will always be people at work who think they are simply ‘entitled’, owed a sweet ride; some think their employers owe it to them, others think their colleagues do and in society some think their government does. Lately with the whole Windows 8, Silverlight / WPF ‘will they’, ‘wont they’ deliberations in the developer community, there has been some resentful noises emanating from developers who feel left behind by Microsoft who have gone as far to express fear for their careers and encouraged others to follow suit. I find this staggering, lacking self belief, lazy and in some cases cynical attention seeking rabble rousing. </p>
<p align="justify">I have invested plenty in WPF but when it comes down to it, if I have to learn something new because there is simply something better?…then I welcome the education. Perhaps had I been ahead of my time I might have incited a riot when VB6 was outmoded by .NET 1.0, instead I chose to see it as an opportunity, at the time I was faced with either moving on to Java, Swing AWT , JSP and J2EE or to .NET, WinForms, ASP.Net and all the wonderment of web services and remoting (tongue firmly plated in cheek). </p>
<p align="justify">Personally I don’t believe Microsoft is about to abandon XAML but if they do then I will treat it as an opportunity and expect that history will show me not to be alone.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=A%20sense%20of%20Entitlement%3F%26hellip%3Bstop%20your%20whining%21&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2011%2F08%2F22%2Fa-sense-of-entitlementstop-your-whining%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="A sense of Entitlement?&hellip;stop your whining!";
		a2a_linkurl="http://www.simonsegal.net/blog/2011/08/22/a-sense-of-entitlementstop-your-whining/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2011/08/22/a-sense-of-entitlementstop-your-whining/">A sense of Entitlement?&hellip;stop your whining!</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2011/08/22/a-sense-of-entitlementstop-your-whining/feed/</wfw:commentRss>
		</item>
		<item>
		<title>When to ask users to use their eyes to reason by omission?</title>
		<link>http://www.simonsegal.net/blog/2011/08/19/when-to-ask-users-to-use-their-eyes-to-reason-by-omission/</link>
		<comments>http://www.simonsegal.net/blog/2011/08/19/when-to-ask-users-to-use-their-eyes-to-reason-by-omission/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 02:20:18 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[Layout]]></category>

		<category><![CDATA[UI]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2011/08/19/when-to-ask-users-to-use-their-eyes-to-reason-by-omission/</guid>
		<description><![CDATA[An interesting discussion on UI layout came up the other day regarding when / where / how it was appropriate for business rules to surface to the User Interface . The topic of the discussion was based around the value of consistently and explicitly directing user attention to an entities state on a User interface [...]<p><a href="http://www.simonsegal.net/blog/2011/08/19/when-to-ask-users-to-use-their-eyes-to-reason-by-omission/">When to ask users to use their eyes to reason by omission?</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p align="justify">An interesting discussion on UI layout came up the other day regarding when / where / how it was appropriate for business rules to surface to the User Interface . The topic of the discussion was based around the value of consistently and explicitly directing user attention to an entities state on a User interface versus omitting information to infer its meaning, where the inference (by way of omission) was extracted from a break to the repetition of the layout. Phew, a mouthful I know but bear with me for just a moment longer!</p>
<p align="justify">It would be helpful to the discussion at this point to display the UI in question and then pick it <a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/ascomplete.png"><img style="background-image: none; border-right-width: 0px; margin: 6px 11px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="ascomplete" border="0" alt="ascomplete" align="left" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/ascomplete-thumb.png" width="231" height="260" /></a>apart. I am showing only the relevant portion of the screen that was subject to the discussion, in this case the twenty four hour digital clock. Each line item in this dashboard contains a due time and indication as to the amount of days or months passed or to follow. The screen shot shows three line items where:</p>
<ol>
<li>
<div align="justify">Is due in 10 days at 5:38 PM </div>
</li>
<li>
<div align="justify">Is due today at 5:26 PM </div>
</li>
<li>
<div align="justify">Is due in 10 days at 4:16 PM</div>
</li>
</ol>
<ol>
<p align="justify">Things to note: the ‘<em>number of days indicator</em>’ (below) <a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/numberofdays.png"><img style="background-image: none; border-right-width: 0px; margin: 7px 0px 0px 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="numberofdays" border="0" alt="numberofdays" align="right" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/numberofdays-thumb.png" width="185" height="40" /></a>and digital clock are both right aligned, placed in close proximity to each other and each element is repeated regardless of their values, establishing a unified consistent layout.</p>
<p>   <u><font color="#a5b592"><br />
<h4></h4>
<h4><font color="#a5b592">The Debate</font></h4>
<p>     </font></u>To understate the debate better there is one feature of the underlying business logic that <a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/trappedspace-lostrepeat.png"><img style="background-image: none; border-right-width: 0px; margin: 6px 0px 0px 15px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="trappedspace_lostrepeat" border="0" alt="trappedspace_lostrepeat" align="right" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/trappedspace-lostrepeat-thumb.png" width="260" height="250" /></a>should be understood first; a high percentage of jobs are turned around in the same day, meaning the ‘<em>number of days indicator</em>’ will exhibit the value of <strong><em>“TODAY”</em></strong> at a high frequency.&#160; </ol>
<p align="justify">One suggestion in the discussion was that given that the large percentage of due dates would evaluated as <strong><em>“TODAY”</em></strong> then it would make sense to omit it. The logic behind this is that most jobs get done <strong><em>“TODAY”</em></strong> making it almost a default value.&#160; Here (to the left) is what it would look like if we enacted the business logic on the layout of he user interface and looking at the result the converse arguments become clear:</p>
<ol>
<li>
<div align="justify">It creates trapped whitespace. </div>
</li>
<li>
<div align="justify">It is less organised through loss of repetition. </div>
</li>
<li>
<div align="justify">It is less unified with the loss of proximity. </div>
</li>
</ol>
<p align="justify">The other effect of removing the ‘<em>number of days indicator</em>’ is that users will have to be trained in the rule that the omission has a specific meaning. If most line items would show <strong><em>“TODAY”</em></strong> then its likely that the repetition of the text or trapped whitespace would make it possible to spot the exceptions, however the loss of organisation in the layout through the introduction of trapped whitespace makes it more difficult to discern, even with a ‘squint test’ where the user deliberately searches the screen for the items with an empty value in the ‘<em>number of days indicator</em>’.</p>
<p align="justify">In writing this post it also became clear that the upper case rendering of characters in the ‘<em>number of days indicator</em>’ needs to change with a view to making it less cluttered and achieving better contrast with the 24 hour clock.</p>
<p align="justify">All in all a very useful discussion where the debate continues testing the principles in place and highlights the need to retain some simple, subtle yet effective design choices that continue to be refactored through the iterations of the application. </p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=When%20to%20ask%20users%20to%20use%20their%20eyes%20to%20reason%20by%20omission%3F&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2011%2F08%2F19%2Fwhen-to-ask-users-to-use-their-eyes-to-reason-by-omission%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="When to ask users to use their eyes to reason by omission?";
		a2a_linkurl="http://www.simonsegal.net/blog/2011/08/19/when-to-ask-users-to-use-their-eyes-to-reason-by-omission/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2011/08/19/when-to-ask-users-to-use-their-eyes-to-reason-by-omission/">When to ask users to use their eyes to reason by omission?</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2011/08/19/when-to-ask-users-to-use-their-eyes-to-reason-by-omission/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Institutional Resistance to Document Databases</title>
		<link>http://www.simonsegal.net/blog/2011/08/14/institutional-resistance-to-document-databases/</link>
		<comments>http://www.simonsegal.net/blog/2011/08/14/institutional-resistance-to-document-databases/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 04:53:49 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[ISV]]></category>

		<category><![CDATA[NOSQL]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2011/08/14/institutional-resistance-to-document-databases/</guid>
		<description><![CDATA[Perhaps you’re the Development Manager or Architect with an ISV, where the commercial landscape plays into your technology choices constantly. Maybe your product roster is tied to a SQL vendor or possibly more than one. Meanwhile you keep hearing a nagging noise about NoSQL, its been circling the wagons for a while now and a [...]<p><a href="http://www.simonsegal.net/blog/2011/08/14/institutional-resistance-to-document-databases/">Institutional Resistance to Document Databases</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p align="justify">Perhaps you’re the Development Manager or Architect with an ISV, where the commercial landscape plays into your technology choices constantly. Maybe your product roster is tied to a SQL vendor or possibly more than one. Meanwhile you keep hearing a nagging noise about NoSQL, its been circling the wagons for a while now and a few of the top flight developers in your team just wont stop talking about it. Until now it hasn’t been a fit, all your products are quite mature and well established, your customers are conveniently placated by your choice of SQL Server or Oracle; they too are invested in a particular database product, they have licenses, institutional skill set and divisional product and platform proliferation choices have been made on the theme of unification. Oh, and as far as your product is concerned next generation planning doesn’t seem close at hand.</p>
<h4><span style="color: #a5b592;"><span style="text-decoration: underline;">Change starts within!</span></span></h4>
<p align="justify">Eventually the CEO comes up with a new product idea that has him so excited that your team <a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/changes.png"><img style="background-image: none; border-right-width: 0px; margin: 6px 10px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="changes" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/changes-thumb.png" border="0" alt="changes" width="260" height="209" align="left" /></a>is whipped up to fever pitch on the promise of starting a new application from scratch, the time has come to start popping the greenfield champagne corks in the cubicles on the software development floor. In the earliest of design meetings the noise about NoSQL has picked up ferociously, the senior and junior developers are all beating their chests and pushing hard for the company to agree to adopt this new paradigm for data persistence but you have anticipated your bosses reaction, knowing full well he will have some serious commercial concerns about choosing a NoSQL platform to underpin your data storage; what about the clients and all their institutional dependency on SQL, what about all their quirky integration hacking between your system and someone else’s, imagine the new plethora of support requirements for clients that have barely heard of NoSQL let alone have a administrators with the capacity to manage it…the list goes on.</p>
<p align="justify">As a hands on kind of guy you also see the benefits of the NoSQL choice and if you have to write as much data access code as you have routinely over the years (regardless of your fancy dancy ORM) you might just loose interest in this new shiny project. At the end of the day the boss beats you down and the same old reliable safe choices get made for data access and storage, you are left wondering what has to change so this doesn’t become the default position until such time as you retire!</p>
<p align="justify">When you think about how long SQL has been ensconced on its throne, the ubiquity of the SQL language and its potential for universal tooling, then question begs, how long would it take to make NoSQL a transferable skill between jobs, enough to permeates IT and seep out of those cracks and into operational non IT staff skill set?</p>
<h4><span style="color: #a5b592;"><span style="text-decoration: underline;">UnQL resume fodder?</span></span></h4>
<p align="justify">The recent news on UnQL has tongues wagging about the potential for a universal language for document databases, should the vendors decide to implement it of course. Nobody in their right mind is expecting this to happen terribly quickly and even if it does eventuate and provide us with the basis of some equally powerful universal tooling that can be found in the SQL world, there is a deep drop between there and crossing the chasm of bureaucratic red tape and all the elements of resistance to change. I wonder how long it is till we see recruiters list UnQL in job ads?</p>
<h4><span style="color: #a5b592;"><span style="text-decoration: underline;">Independent Software Vendors</span></span></h4>
<p align="justify">Storage concerns that bleed into architecture choices as a direct result of commercial concerns can do so in ways that and in-house software team or web 2.0 vendor may not typically have<a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/digital-signage-stock-ticker.jpg"><img style="background-image: none; border-right-width: 0px; margin: 6px 0px 0px 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="digital-signage-stock-ticker" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/digital-signage-stock-ticker-thumb.jpg" border="0" alt="digital-signage-stock-ticker" width="260" height="180" align="right" /></a> to consider. There is a degree of user data hacking that ISV’s need to consider upon servicing a wide range of clients who possess peculiar concerns and workflows. This can lead to any given client choosing to customise the software vendors product database. Some ISV’s encourage this behaviour and others don’t, opting for building points of extensibility. Making points of extension available is useful approach but it doesn’t eliminate client resistance when the only integration avenue open to them is constrained by their institutional dependency of SQL.</p>
<p align="justify">As a software developer / vendor I find myself often wanting to take advantage of a schema free database but in some instances it represents a potentially commercially damaging choice, one that simply cant be made. The exception might be ancillary tooling in a product suite, applications with small surface area as far as clients are concerned and any projects that fall outside of the scope of client SQL integration needs.</p>
<p align="justify">NOTE: I am fully aware that we haven’t yet discussed specialised reporting or BI tooling here in this post and that its more than possible to design an architecture where SQL products are used in conjunction with a Document Database.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=Institutional%20Resistance%20to%20Document%20Databases&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2011%2F08%2F14%2Finstitutional-resistance-to-document-databases%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Institutional Resistance to Document Databases";
		a2a_linkurl="http://www.simonsegal.net/blog/2011/08/14/institutional-resistance-to-document-databases/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2011/08/14/institutional-resistance-to-document-databases/">Institutional Resistance to Document Databases</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2011/08/14/institutional-resistance-to-document-databases/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Modelling Task based Smart Clients Explicitly&#8211;Part 1</title>
		<link>http://www.simonsegal.net/blog/2011/08/11/modelling-task-based-smart-clients-explicitlypart-1/</link>
		<comments>http://www.simonsegal.net/blog/2011/08/11/modelling-task-based-smart-clients-explicitlypart-1/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 05:19:14 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[Patterns &amp; Practices]]></category>

		<category><![CDATA[SmartClients]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2011/08/11/modelling-task-based-smart-clients-explicitlypart-1/</guid>
		<description><![CDATA[Some time ago when I looked into the MVVM pattern I decided it wasn’t the right choice for me, that hasn’t changed since and I don&#8217;t expect it to change anytime soon. The burning question for me was “will MVVM suit my needs”?…and the answer was simply no it wasn’t. I should say however that [...]<p><a href="http://www.simonsegal.net/blog/2011/08/11/modelling-task-based-smart-clients-explicitlypart-1/">Modelling Task based Smart Clients Explicitly&ndash;Part 1</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p align="justify">Some time ago when I looked into the MVVM pattern I decided it wasn’t the right choice for me, that hasn’t changed since and I don&#8217;t expect it to change anytime soon. The burning question for me was “will MVVM suit my needs”?…and the answer was simply no it wasn’t. I should say however that I do very much like the screen aggregator from the <a href="http://mvvmlight.codeplex.com/" target="_blank">MVVM light libraries</a> and consequently use those quite extensively.</p>
<p align="justify">So what were my requirements and how did <strong><em>we</em></strong><sup>1</sup> go about addressing them? I spend a considerable amount of my time building task based user interfaces in smart clients and I prefer to do it very explicitly, but lets break that somewhat fluffy abstract statement down a little with the specifics:</p>
<ul>
<li>
<div align="justify">Explicitly Task Based means all the way from the XAML layout to the supporting C# code </div>
</li>
<li>
<div align="justify">Smart Clients commonly incorporate messaging and the use of durable queues. </div>
</li>
<li>
<div align="justify">I want to keep the queries and commands very separate in my code </div>
</li>
<li>
<div align="justify">I want a Pipeline for handling UI messages to the controllers (think Ruby or Smalltalk) </div>
</li>
<li>
<div align="justify">I’d like an environment where developers stay out of each others way. </div>
</li>
</ul>
<p align="justify">Now lets pivot on those one at a time (not all here in part 1 however).</p>
<h4><font color="#a5b592"><u>Task Based</u></font></h4>
<p align="justify">Task based user interfaces offer the opportunity to model our screens <em><strong>sharply</strong></em> to the intent of <a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/codeadvisory.jpg"><img style="background-image: none; border-right-width: 0px; margin: 8px 9px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="codeadvisory" border="0" alt="codeadvisory" align="left" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/codeadvisory-thumb.jpg" width="260" height="200" /></a>the user. Consider the example of a grid that allows users to change an employees details, such a grid might include property values such as the first name, last name all the way through to the employees position in the organisation. A ‘position’ of finance clerk might very well be organisationally subject to the concept of <em><strong>‘<a href="http://en.wikipedia.org/wiki/Pay_Bands" target="_blank">banding</a>’</strong></em> to determine pay scale. </p>
<p align="justify">If we provided this grid based screen for users to change an employees <em>position</em>, the grid cell containing the <em>position </em>might be populated by a combo box containing a list of <em>positions</em> defined by the organisation; a user would simply have to change the selection to affect a position move by an employee. But what is actually going on here in this example?…are we really just changing the employees <em>position, </em>or did something else occur in HR to warrant the <em>position </em>change? Lets say the employee was promoted and lets even assume that HR are interested in why the employee was promote…we can see we have a problem now. </p>
<p align="justify">It would strike me as highly surprising if any reader hadn’t been ailed at some point with this syndrome, fumbling around in some legacy relational muck, desperately trying to find ways to reason about data in storage, where the meaning of the events in the system have been inexorably lost. </p>
<h4><u><font color="#a5b592">Explicitly</font></u></h4>
<p align="justify">Being Explicit sounds odd at first blush I know, but consider the example of the employee <em>position</em> changing as discussed previously, certainly its an explicit requirement and event; the promoting of an employee may well require the changing of the position held, its a desirable effect of making the promotion, however there could be exceptions and that indicates even greater need to be explicit. What if I were to be promoted notionally?…let’s say a pay rise with no title bump? But still, how do I do that explicitly, sure it sounds explicit but at a code level what makes it explicit? When it comes right down to it its all about interfaces, in particular what Martin Fowler refers to as ‘role’ interfaces. </p>
<h4><font color="#a5b592"><u>Roles</u></font></h4>
<p>Tasks can be very neatly described in a system by defining a <em>role</em> interface, for example I might name the role in our example as IPromoteAnEmployee. </p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">interface</span> IActInMakingPromotions: IRole {}</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>the Commands And Query for the Role</p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">interface</span> ILoadEmployeePositions : IQuery&lt;IActInMakingPromotions&gt;{}

<span class="kwrd">public</span> <span class="kwrd">interface</span> IPromoteAnEmployee : ICommand&lt;IActInMakingPromotions&gt;{}</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Executing this intent explicitly might look something like this:</p>
<pre class="csharpcode">Controller.Handle&lt;IPromoteAnEmployee&gt;();</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</p>
<p>OR </p>
<pre class="csharpcode">Controller.Query&lt;ILoadEmployeePositions&gt;();</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p align="justify">At this point the controller knows what it needs to do, or at least a container or some reflection code should be able to locate the applicative handler that will execute the logic for this command.</p>
<p align="justify">Note: that there are no data arguments to this command and I haven’t yet said anything about queries, certainly many commands will require facilitating data that is supportive to executing a given command. For example, lets consider that in promoting an employee we may well be expecting access to a list of <em>positions</em> to which any given employee might ascend to (or in the case of demotion descend): enter Command Query Segregation (CQS).</p>
<h4><font color="#a5b592"><u>CQRS</u></font></h4>
<p align="justify">Some of the significant benefits of using these roles (interfaces) are that it allows you to vary many of the actors in your system concordantly and we can split the handlers for the commands and queries at a code level by leveraging the CQRS pattern. What about DDD then? Well keeping queries and commands separate is something that jives well with DDD, however I should make it clear that in the case of a smart client where messaging is predominant, many of these commands will most likely re-dispatch their intent from the UI controller to an endpoint where the business logic will be handled and in my case that’s usually an <a href="http://www.nservicebus.com/" target="_blank">NServiceBus</a> endpoint. In the case of queries we could have our handlers do straight up RPC to the data store or via some http API that acts as a facade to a data store.</p>
<h5><font color="#a5b592"><u>Command</u></font></h5>
<p></p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> PromoteAnEmployeeHandler : IPromoteAnEmployee
{
    <span class="kwrd">public</span> <span class="kwrd">void</span> Execute()
    {
        var viewModel = Screen.ViewModel.etc;

        Bus.Send&lt;IPromoteAnEmployee&gt;(m =&gt;
        {
           <span class="rem">//&#8230;message properties set here using view model if required</span>
        });

        <span class="rem">//send a message to other views interested</span>
        Messenger.Default.Send(<span class="kwrd">new</span> EmployeePromotionMade()
        {
            <span class="rem">//&#8230;inter screen message properties set here</span>
        });
    }

    <span class="kwrd">public</span> IScreen&lt;IPromoteAnEmployee&gt; Screen { get; set; }
    <span class="kwrd">public</span> IBus Bus { get; set; }
}</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<h5><u><font color="#a5b592"></font></u></h5>
<p></p>
<p align="justify">If this were a typical client server system we <em><strong>could</strong></em> also do straight up RPC with the data store if applicable however in the example above I have dispatched a message on a bus (<a href="http://www.nservicebus.com/" target="_blank">NServiceBus</a>) to some logical endpoint within the HR service. </p>
<h5><u><font color="#a5b592">Query</font></u></h5>
<p></p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> LoadEmployeePositionsHandler : ILoadEmployeePositions
{
    <span class="kwrd">public</span> <span class="kwrd">void</span> Execute()
    {
        var ctx = <span class="kwrd">new</span> EmployeeViewCache(connectionString);
        var employeePosDescriptions= from p <span class="kwrd">in</span> ctx.PositionDescriptions
                                    select <span class="kwrd">new</span> EmployeePosition()
                                    {
                                        Name = p.PositionName,
                                        Id = p.PositionId
                                    };

        var items = <span class="kwrd">new</span> ObservableCollection&lt;EmployeePosition&gt;();

        Screen.ViewModel.PositionDescriptions = items;
    }

    <span class="kwrd">public</span> IScreen&lt;IPromoteAnEmployee&gt; Screen { get; set; }
}</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p></p>
<h4><font color="#a5b592"><u>What’s next?</u></font></h4>
<p align="justify">On the basis that brevity is the essence of wit and not wishing to overly tax the attention span of readers, part 2 &amp; 3 will look at pipelines and how that becomes useful, how SOLID principles are served by such an approach, the multi threaded smart client story and why I am happy to accept lots of small chunks of code spread over many files, little islands of single responsibility as I have come to know them. Finally I will look at afferent and efferent coupling and finish up with testability.</p>
<p><sup>1</sup>&#160;<a href="http://www.markharris.net.au/" target="_blank">Mark Harris</a> and I are co directors of QCAT (an ISV) and Lextrico (a consulting business)</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=Modelling%20Task%20based%20Smart%20Clients%20Explicitly%26ndash%3BPart%201&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2011%2F08%2F11%2Fmodelling-task-based-smart-clients-explicitlypart-1%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Modelling Task based Smart Clients Explicitly&ndash;Part 1";
		a2a_linkurl="http://www.simonsegal.net/blog/2011/08/11/modelling-task-based-smart-clients-explicitlypart-1/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2011/08/11/modelling-task-based-smart-clients-explicitlypart-1/">Modelling Task based Smart Clients Explicitly&ndash;Part 1</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2011/08/11/modelling-task-based-smart-clients-explicitlypart-1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Opinions</title>
		<link>http://www.simonsegal.net/blog/2011/08/03/opinions/</link>
		<comments>http://www.simonsegal.net/blog/2011/08/03/opinions/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 02:06:46 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[Introspection]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2011/08/03/opinions/</guid>
		<description><![CDATA[I recall some time ago I heard Scott Hanselman suggest that “strong opinions loosely held” were of little interest or consequence to him…at least that’s the sentiment I remember being expressed. That thought resonated strongly with me at the time and just today it occurred to me that the inverse of the sentiment might also [...]<p><a href="http://www.simonsegal.net/blog/2011/08/03/opinions/">Opinions</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p align="justify">I recall some time ago I heard <a href="http://www.hanselman.com/blog/">Scott Hanselman</a> suggest that “strong opinions loosely held” were of little interest or consequence to him…at least that’s the sentiment I remember being expressed. That thought resonated strongly with me at the time and just today it occurred to me that the inverse of the sentiment might also be true : “weak opinions firmly held”!</p>
<p align="justify">I am attracted naturally to people with strong opinions but the ones I admire the most are <a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/silosdanger.png"><img style="background-image: none; border-right-width: 0px; margin: 5px 5px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="silosdanger" border="0" alt="silosdanger" align="left" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/08/silosdanger-thumb.png" width="144" height="115" /></a>those who have “the tendency to doubt and the capacity to believe in equal measure”<sup>1</sup>, particularly when it comes to their own beliefs. In my previous career as a studio recording engineer I was (and remain) a follower and admirer of the works of Brian Eno who considered one of his talents to be the ability to liberally contradict himself, which has some foundation in artistic license, an ability to turn on a small piece of mental real estate…agility!</p>
<h5 align="justify"><span style="text-decoration: underline">Silos House Dangerous Materials</span></h5>
<p align="justify">The one thing that really sticks in my craw though is silo style thinking, blinkered intellectualisation, emotional investment in ones opinions where they themselves are short of any depth of investigation, whether that enquiry is introspective, empirical or studied.</p>
<p><sup>1</sup> <a href="http://westwing.bewarne.com/fifth/505one.html" target="_blank">From the West Wing Episode</a> Constituency of One.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=Opinions&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2011%2F08%2F03%2Fopinions%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Opinions";
		a2a_linkurl="http://www.simonsegal.net/blog/2011/08/03/opinions/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2011/08/03/opinions/">Opinions</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2011/08/03/opinions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JezebelScript, her followers and the downtrodden</title>
		<link>http://www.simonsegal.net/blog/2011/06/29/jezebelscript-her-followers-and-the-downtrodden/</link>
		<comments>http://www.simonsegal.net/blog/2011/06/29/jezebelscript-her-followers-and-the-downtrodden/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 02:45:48 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[HTML5]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2011/06/29/jezebelscript-her-followers-and-the-downtrodden/</guid>
		<description><![CDATA[In a time where mankind had come to think of itself as highly evolved, there was a technology princess known as JezebelScript. She was a Queen in waiting and in her latter years she strode throughout the land upon her faithful horse who went by the name High. 
JezebelScript roamed upon High Horse, preaching her [...]<p><a href="http://www.simonsegal.net/blog/2011/06/29/jezebelscript-her-followers-and-the-downtrodden/">JezebelScript, her followers and the downtrodden</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p align="justify">In a time where mankind had come to think of itself as highly evolved, there was a technology princess known as <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JezebelScript</a>. She was a Queen in waiting and in her latter years she strode throughout the land upon her faithful horse who went by the name High. </p>
<p align="justify">JezebelScript roamed upon High Horse, preaching her gospel to any and all that would listen; “free yourself from the hub of central control and lay seed at the root of communication” she cried. The arbiters of the peoples forums were locked in debate, a dark cloud of quandary hovered, alas so many prophets, so many gospels, even at the <a href="http://www.microsoft.com" target="_blank">seat of power</a> there seemed to be great <a href="http://thenextweb.com/dd/2011/06/02/windows-8-apps-to-be-built-in-html-javascript/" target="_blank">confusion</a> in how to best identify the “<a href="http://www.w3.org/TR/html5/" target="_blank">one true way</a>”<sup>1</sup>. </p>
<p align="justify">The Princesses message was simple, her key tenet was “freedom in Ubiquity” and as her powers grew as the message took root. The Oligarchs of the day were <a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/image1.png"><img style="background-image: none; border-right-width: 0px; margin: 11px 15px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="left" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/image-thumb1.png" width="215" height="170" /></a>seduced by her call and they too began to preach her message, concordantly&#160; it appeared to be reaching its crescendo, her followers gained strength in numbers, they began flexing muscles of vindication in the hallways of the <a href="http://www.twitter.com" target="_blank">propaganda machines</a>. And then a metamorphosis took shape…something unexpected in this rich time of spiritual and intellectual evolution, the followers of JezebelScript came to outnumber those who followed the false prophets, an ugly mob mentality which had been festering, manifested itself in an un-mandated charge to suppress the new minority. The airwaves became filled with bile, hatred and self serving pronouncements of worship to JezebelScript, they shouted her name as though it laid claim to legitimacy. Finally it seemed the oppressed were now becoming the oppressor.</p>
<p align="justify">Her story is ongoing, her epitaph yet to be written and who knows she just may end up capturing the hearts and minds of those who have until now ignored her dance of seduction.</p>
<p><sup>1</sup> Billy Hollis “<a href="http://www.dotnetrocks.com/default.aspx?showNum=659" target="_blank">Living in peaceful co-existence</a>”</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=JezebelScript%2C%20her%20followers%20and%20the%20downtrodden&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2011%2F06%2F29%2Fjezebelscript-her-followers-and-the-downtrodden%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="JezebelScript, her followers and the downtrodden";
		a2a_linkurl="http://www.simonsegal.net/blog/2011/06/29/jezebelscript-her-followers-and-the-downtrodden/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2011/06/29/jezebelscript-her-followers-and-the-downtrodden/">JezebelScript, her followers and the downtrodden</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2011/06/29/jezebelscript-her-followers-and-the-downtrodden/feed/</wfw:commentRss>
		</item>
		<item>
		<title>NServiceBus 1 Day Kick Start Event</title>
		<link>http://www.simonsegal.net/blog/2011/06/25/nservicebus-1-day-kick-start-event/</link>
		<comments>http://www.simonsegal.net/blog/2011/06/25/nservicebus-1-day-kick-start-event/#comments</comments>
		<pubDate>Sat, 25 Jun 2011 03:15:07 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[Courses]]></category>

		<category><![CDATA[NServiceBus]]></category>

		<category><![CDATA[SOA]]></category>

		<category><![CDATA[Training]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2011/06/25/nservicebus-1-day-kick-start-event/</guid>
		<description><![CDATA[On the back of running his ADSD course in Sydney this year Udi Dahan will be also running a one day NServiceBus introductory course. The one day course is a highly condensed event so its sure to pack a wallop and if you are interested in taking NServiceBus for a spin and see what all [...]<p><a href="http://www.simonsegal.net/blog/2011/06/25/nservicebus-1-day-kick-start-event/">NServiceBus 1 Day Kick Start Event</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p>On the back of running his ADSD course in Sydney this year <a href="http://www.udidahan.com/" mce_href="http://www.udidahan.com/" target="_blank">Udi Dahan</a> will be also <a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/image-thumb4.png" mce_href="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/image-thumb4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 6px 0px 0px 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" mce_style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 6px 0px 0px 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image_thumb4" alt="image_thumb4" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/image-thumb4-thumb.png" mce_src="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/image-thumb4-thumb.png" align="right" border="0" height="130" width="158"></a>running a <a href="http://www.udidahan.com/2011/06/21/udi-down-under-2011/" mce_href="http://www.udidahan.com/2011/06/21/udi-down-under-2011/" target="_blank">one day NServiceBus introductory course</a>. The one day course is a highly condensed event so its sure to pack a wallop and if you are interested in taking NServiceBus for a spin and see what all the fuss is about then I suggest you quickly <a href="http://www.eventbee.com/v/nservicebus-kickstart-sydney" mce_href="http://www.eventbee.com/v/nservicebus-kickstart-sydney" target="_blank">book yourself a place</a>.</p>
<p>Mark and I will also be sharing our experiences of how NServiceBus has served us as an enabler in designing and delivering successful solutions for our clients as an ISV and as consultants. </p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=NServiceBus%201%20Day%20Kick%20Start%20Event&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2011%2F06%2F25%2Fnservicebus-1-day-kick-start-event%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="NServiceBus 1 Day Kick Start Event";
		a2a_linkurl="http://www.simonsegal.net/blog/2011/06/25/nservicebus-1-day-kick-start-event/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2011/06/25/nservicebus-1-day-kick-start-event/">NServiceBus 1 Day Kick Start Event</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2011/06/25/nservicebus-1-day-kick-start-event/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hacking on the NServiceBus Generic Host with IronPython&#8211;TBC.</title>
		<link>http://www.simonsegal.net/blog/2011/06/21/hacking-on-the-nservicebus-generic-host-with-ironpythontbc/</link>
		<comments>http://www.simonsegal.net/blog/2011/06/21/hacking-on-the-nservicebus-generic-host-with-ironpythontbc/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 06:14:53 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[IronPython]]></category>

		<category><![CDATA[NServiceBus]]></category>

		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2011/06/21/hacking-on-the-nservicebus-generic-host-with-ironpythontbc/</guid>
		<description><![CDATA[This (now series of) posts(s) will be something of a stream of consciousness, an exploration that has no single objective, rather a journey of discovery with no guarantee (sought nor otherwise) of any practical application. Something tells me that there is some niche lurking behind the premise however beyond my initial instinct I am prepared [...]<p><a href="http://www.simonsegal.net/blog/2011/06/21/hacking-on-the-nservicebus-generic-host-with-ironpythontbc/">Hacking on the NServiceBus Generic Host with IronPython&ndash;TBC.</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p>This (now series of) posts(s) will be something of a stream of consciousness, an exploration that has no single objective, rather a journey of discovery with no guarantee (sought nor otherwise) of any practical application. Something tells me that there is some niche lurking behind the premise however beyond my initial instinct I am prepared to let any hidden benefits (if there are any) reveal themselves to me along the way.</p>
<p>A <a href="http://www.simonsegal.net/blog/2009/07/06/configuring-testing-and-probing-nservicebus-with-ironpython/">while back</a> I posted on how it was possible to self host an <a href="http://www.nservicebus.com/">NServiceBus</a> endpoint in a custom built IronPython / WPF REPL process. Since that time NServiceBus has experienced several feature enhancements and now supports a rich hosting model of its own, the Generic Host. I wont regurgitate what has already been written about the Generic Host as its been covered in several places and if you wont to know more about it I suggest you look at these links:</p>
<p><a href="http://www.nservicebus.com/GenericHost.aspx">The Generic Host</a></p>
<p><a href="http://www.nservicebus.com/Profiles.aspx">The Profiles</a></p>
<p><a href="http://www.nservicebus.com/docs/Samples/GenericHost.aspx">Sample</a></p>
<h3><u>So Why an IronPython Host</u></h3>
<p>In short, the ability to throw ad-hoc messages at your NServiceBus ecosystem and observe your systems behaviour (eye to eye) and some dynamic debugging! The typical debugging scenario has me sitting with four or more console windows open acting as either clients, servers and or publishers and some of those windows will be waiting for input (from me), the kind of input you typically see in a console application “Press y to send a message” (usually a fairly statically crafted and compiled one). When speaking about clients and subscribers sometimes (going into production) that just might be a windows desktop application.</p>
<p>In the world of dynamic languages developers have come to expect the ability to test / play with / mess with / debug their code in a Repeat Evaluate Print Loop which has some significant benefits. </p>
<h3><u>Start-up</u></h3>
<p>Using the NServiceBus Full Duplex sample I added a reference to my hacked version of the Generic Host and set the project to start-up the executable as per the usual approach (when you have chosen not to self host in your own executable).</p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/repl-host-debug-props.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="repl_host_debug_props" border="0" alt="repl_host_debug_props" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/repl-host-debug-props-thumb.png" width="465" height="223" /></a></p>
<p>After starting the Server project the console fires up as expected and is then followed by the IronPython console where the hosted Bus (instance) has been made available to the script scope context we have started in. </p>
<p>Next I proceed to hack out a message and send it on to the Bus. What isn’t clear below is that Message1 is actually an already dialled up instance of a RequestDataMessage as defined in the message project that is part of the Full Duplex sample that comes in the NServiceBus download.</p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/ipgenerichost.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="NService REPL" border="0" alt="NServiceBus REPL" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/ipgenerichost-thumb.png" width="442" height="405" /></a></p>
<p>Here is the Message Handler (in the Server project) for the RequestDataMessage (in the script above Message1 is an instance of this type.</p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/image-thumb.png" width="490" height="577" /></a></p>
<p>Once the script above gets executed then the REPL reports back to us (I have hijacked the STD/IO and redirected it to the REPL’s TextWriter.</p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/repl-host-first-results.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="repl_host_first_results" border="0" alt="repl_host_first_results" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/repl-host-first-results-thumb.png" width="429" height="482" /></a></p>
<p>Ok, so it seems obvious enough that the Generic Host is now starting up in the context of our Python REPL and I can adhoc hand craft messages and observe the behaviour of the hosted endpoint, but there are some still some issues, one immediate and obvious one is that the REPL Host is doing two things or rather taking on two independent roles namely the Client and Server. If you run the Full Duplex sample you will note that there are two processes in the solution, a client configured AsA_Client and another configured AsA_Server; when I run the Server project using the Generic Host Shell I am freeing the console window and instead running the REPL window in its place. What this means quite literally is that in this instance, the REPL Host is allowing me to send messages to the Server Endpoint (which it too is hosting), without the Client endpoint running at all, thereby effectively spoofing some of the behaviour found in the Client process (project) without actually loading the client endpoint at all.</p>
<p>Alternatively I can run both projects (Client and Server) as I normally would, with the exception that they are both being hosted in the IronPython host. This (arguably) offers more fidelity with respect to the two services operating entirely within their own process which is in line with a production deployment.</p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/clientandserver.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clientAndServer" border="0" alt="clientAndServer" src="http://www.simonsegal.net/blog/wp-content/uploads/2011/06/clientandserver-thumb.png" width="362" height="144" /></a></p>
<p>What the image above demonstrates is that we now have two REPL Hosts running simultaneously, one endpoint configured AsA_Client and the other AsA_Server endpoint.</p>
<p>I am going to leave part 1 here for now and end with an idea that has come to mind: perhaps it would be useful to run a solution (furnished with hosted endpoints) and have all the REPL hosts start up within a container, perhaps an MDI host where all the REPL windows tile / cascade? It also occurs that perhaps such this REPL host would be useful for inspecting and returning source messages to their queues or performing functions like those found in the Grid UI or perhaps even something akin to an integrated shell where an Administrator might walk up to a machine hosting NServiceBus endpoints and issue those endpoints with administrative messages? Anyway I will meditate on it for a while and perhaps stay open for some outside input.</p>
<p>In the next post I will talk about some of the issues facing me currently and should be able to include a link to the working example by then. In the meantime you can find the old post <a href="http://www.simonsegal.net/blog/2009/07/06/configuring-testing-and-probing-nservicebus-with-ironpython/">here</a> and download the REPL as it was back then.</p>
<p>Finally, the prototype IronPython console I built some time ago is really just that, a prototype and given that I plan to use it as a live runtime tool embedded in my commercial products (at some point in time) then its really time to take it from prototype to working draft and that means its time to get serious about styling the window beyond battleship grey.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=Hacking%20on%20the%20NServiceBus%20Generic%20Host%20with%20IronPython%26ndash%3BTBC.&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2011%2F06%2F21%2Fhacking-on-the-nservicebus-generic-host-with-ironpythontbc%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Hacking on the NServiceBus Generic Host with IronPython&ndash;TBC.";
		a2a_linkurl="http://www.simonsegal.net/blog/2011/06/21/hacking-on-the-nservicebus-generic-host-with-ironpythontbc/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2011/06/21/hacking-on-the-nservicebus-generic-host-with-ironpythontbc/">Hacking on the NServiceBus Generic Host with IronPython&ndash;TBC.</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2011/06/21/hacking-on-the-nservicebus-generic-host-with-ironpythontbc/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Developer Schadenfreude leaves me cold.</title>
		<link>http://www.simonsegal.net/blog/2011/06/03/developer-schadenfreude-leaves-me-cold/</link>
		<comments>http://www.simonsegal.net/blog/2011/06/03/developer-schadenfreude-leaves-me-cold/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 07:29:11 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[HTML5]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2011/06/03/developer-schadenfreude-leaves-me-cold/</guid>
		<description><![CDATA[Without discussing the merits of the argument as to whether or not HTML5 and its (potential) level of inclusion in Windows 8 is to the exclusion of Silverlight, I feel compelled to note the level of mean spiritedness of some members of the “community” (if one dare lay claim they are entitled membership to it).
Twitter [...]<p><a href="http://www.simonsegal.net/blog/2011/06/03/developer-schadenfreude-leaves-me-cold/">Developer Schadenfreude leaves me cold.</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Without discussing the merits of the argument as to whether or not HTML5 and its (potential) level of inclusion in Windows 8 is to the exclusion of Silverlight, I feel compelled to note the level of mean spiritedness of some members of the “community” (if one dare lay claim they are entitled membership to it).</p>
<p>Twitter is (again) abuzz with prognostication dressed in maven style authority; tweeters are delighting in the demise of Silverlight (largely) and to some extent WPF on the back of some Windows 8 announcements. Some of the tweets I have seen even include the suggestion by their authors that they would take delight in using the news to inform XAML Developers that their livelihoods are in imminent jeopardy. I wont even bother to address that assertion other than remark that I find it says a lot about the individuals who have nothing better to do than tweet their joy at the expense of someone else&#8217;s potential misfortune.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=Developer%20Schadenfreude%20leaves%20me%20cold.&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2011%2F06%2F03%2Fdeveloper-schadenfreude-leaves-me-cold%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Developer Schadenfreude leaves me cold.";
		a2a_linkurl="http://www.simonsegal.net/blog/2011/06/03/developer-schadenfreude-leaves-me-cold/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2011/06/03/developer-schadenfreude-leaves-me-cold/">Developer Schadenfreude leaves me cold.</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2011/06/03/developer-schadenfreude-leaves-me-cold/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MongoDB Training in Australia with 10Gen &#8211; be counted!</title>
		<link>http://www.simonsegal.net/blog/2010/05/19/mongodb-training-in-australia-with-10gen-be-counted/</link>
		<comments>http://www.simonsegal.net/blog/2010/05/19/mongodb-training-in-australia-with-10gen-be-counted/#comments</comments>
		<pubDate>Tue, 18 May 2010 22:09:08 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[MongoDB]]></category>

		<category><![CDATA[NOSQL]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2010/05/19/mongodb-training-in-australia-with-10gen-be-counted/</guid>
		<description><![CDATA[I’m super excited, 10Gen are currently taking a survey for registrations of interest for MongoDB training run by them in Australia. So, I would implore anyone with a eye on the NOSQL or MongoDB space to get over quickly to survey monkey to fill in the Survey and show your Mongo love!
 It’s been palpable [...]<p><a href="http://www.simonsegal.net/blog/2010/05/19/mongodb-training-in-australia-with-10gen-be-counted/">MongoDB Training in Australia with 10Gen &ndash; be counted!</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I’m super excited, <a href="http://www.10gen.com/" target="_blank">10Gen</a> are currently taking a survey for registrations of interest for <a href="http://www.mongodb.org/" target="_blank">MongoDB</a> training run by them in Australia. So, I would implore anyone with a eye on the NOSQL or MongoDB space to get over quickly to survey monkey to <a href="http://www.surveymonkey.com/s/SYGGJ3W" target="_blank">fill in the Survey</a> and show your Mongo love!</p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/05/logomongodbonwhite.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px 5px 0px 0px; display: inline; border-top: 0px; border-right: 0px" title="logo-mongodb-onwhite" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/05/logomongodbonwhite-thumb.png" border="0" alt="logo-mongodb-onwhite" width="110" height="52" align="left" /></a> It’s been palpable the level of interest and noise being made by the .NET community around MongoDB, however MongoDB has no special language affiliation and the Survey seeks to know your language preference  (with regards to the training), so if your simply interested in imbibing on the best MongoDB training around, then fill in the Survey and spread the word.</p>
<p>Here is <a href="http://www.surveymonkey.com/s/SYGGJ3W" target="_blank">the link to register your interest</a>.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=MongoDB%20Training%20in%20Australia%20with%2010Gen%20%26ndash%3B%20be%20counted%21&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2010%2F05%2F19%2Fmongodb-training-in-australia-with-10gen-be-counted%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="MongoDB Training in Australia with 10Gen &ndash; be counted!";
		a2a_linkurl="http://www.simonsegal.net/blog/2010/05/19/mongodb-training-in-australia-with-10gen-be-counted/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2010/05/19/mongodb-training-in-australia-with-10gen-be-counted/">MongoDB Training in Australia with 10Gen &ndash; be counted!</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2010/05/19/mongodb-training-in-australia-with-10gen-be-counted/feed/</wfw:commentRss>
		</item>
		<item>
		<title>IronPython Tools for Visual Studio with Expression Blend</title>
		<link>http://www.simonsegal.net/blog/2010/05/09/ironpython-tools-for-visual-studio-with-expression-blend/</link>
		<comments>http://www.simonsegal.net/blog/2010/05/09/ironpython-tools-for-visual-studio-with-expression-blend/#comments</comments>
		<pubDate>Sun, 09 May 2010 06:36:35 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[Expression Blend]]></category>

		<category><![CDATA[IronPython]]></category>

		<category><![CDATA[Visual Studio]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2010/05/09/ironpython-tools-for-visual-studio-with-expression-blend/</guid>
		<description><![CDATA[Just as I was about to embark on&#160; a new project (codenamed PONGO), the IronPython team announced a CTP 2.0 drop of the IronPython tools for Visual Studio 2010 which is exciting on a number of different levels. 
If IronRuby and IronPython eventually make it all the way to Visual Studio integration in the full [...]<p><a href="http://www.simonsegal.net/blog/2010/05/09/ironpython-tools-for-visual-studio-with-expression-blend/">IronPython Tools for Visual Studio with Expression Blend</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Just as I was about to embark on&#160; a new project (codenamed PONGO), the IronPython team announced a CTP 2.0 drop of the <a href="http://ironpython.net/tools/">IronPython tools for Visual Studio 2010</a> which is exciting on a number of different levels. </p>
<p>If IronRuby and IronPython eventually make it all the way to Visual Studio integration in the full sense (that is packaged as part of Visual Studio itself) that would be a mark of first class citizenry.</p>
<h2><u>What about Expression Blend?</u></h2>
<p>Personally I work in both Blend and Visual Studio and even though the Visual Studio designer is somewhat improved and it’s intellisense is far superior than that of Expression Blend, it still does not provide me with the same fidelity or fluency in the design experience as I get from Blend. This leaves me with a problem when it comes to building applications where IronPython is the choice language. </p>
<p>It would have been unrealistic (at this stage) to expect Blend to open IronPython projects created in Visual Studio and sure enough that is the not case. What might be useful is Blend having a “<strong><em>design XAML only mode</em></strong>”, enabling it to open <strong>XAML</strong> files individually, taking advantage of the design experience it has to offer. Still not ready to give up on using Blend with XAML files that were part of a Visual Studio IronPython project, I set out to find a way.</p>
<h2><u>Symbolic Links</u></h2>
<p>The first thing I tried out was to see if Symbolic and Hard linked files would make the difference? First up I tried a symbolic link using the MKLINK utility:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MKLINK [[/D] | [/H] | [/J]] Link Target</pre>
<p></div>
</p>
<p>Before doing this I created two projects, the first one an <a href="http://ironpython.net/tools/">IronPython Tools</a> project generated in Visual Studio and the second one a C# project created in Blend.</p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/05/pongoprojects.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="PongoProjects" border="0" alt="PongoProjects" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/05/pongoprojects-thumb.png" width="475" height="297" /></a></p>
<p>It should be obvious from the naming which project is which. In the blend project I removed the default XAML file generated by Blend.</p>
<p>Next came the file linking, I used only the <strong><em>Link</em></strong> and <strong><em>Target</em></strong> command line options, creating a symbolic link using the same name as the .XAML file in my IronPython project.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MKLINK pongo.xaml d:\temp\PongoBlend\pongo.xaml</pre>
<p></div>
<p>Having successfully created the soft linked symbolic file I tried to add it to the Blend project only to find that it would not open – which, to blunt I wasn’t expecting to work. I was a little more hopeful however when it came to the Hard Linked file which I setup as follows:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MKLINK \H pongo.xaml d:\temp\PongoBlend\pongo.xaml</pre>
<p></div>
<p>This did in fact open correctly in Blend and worked for a brief moment, when I changed something in Blend – Visual Studio would prompt me that the file had been changed outside the editor, unfortunately my celebrations were short lived when I found that the files were not updating in both locations when one or the other was subject to an edit. After some investigation and testing it appears that once opening the file in both the IDE’s the links would somehow eventually become broken and so the symbolic linking idea was now officially a lost prospect.</p>
<h2><u>Duelling Projects</u></h2>
<p>Finally I decided to synchronize two separate .XAML files in each of the two different projects, so the challenge was to find the most unobtrusive way of working in both IDE’s and easily syncing the the .XAML files after edits had been made. Given that one of the IDE’s was running a dynamic language with a REPL built in, I thought it shouldn’t prove too difficult. </p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/05/pongvsnet-interactive.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pongvsnet_interactive" border="0" alt="pongvsnet_interactive" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/05/pongvsnet-interactive-thumb.png" width="475" height="317" /></a> </p>
<p>What I did was to add two <strong><em>.py</em></strong> source files into the project, each one with some code that would sync in one direction, either from Blend to Visual Studio and vice versa. Sure its&#160; far from a perfect solution but it just might be a price I’m willing to pay in the short term to get the benefit of using Blend. In the long term I really do hope that as the dynamic languages gain support in Visual Studio we also get some integrated ways to work in both IDE’s.</p>
<h2></h2>
</p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/05/pongvsnet-with-xaml-ui.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pongvsnet_with_xaml_ui" border="0" alt="pongvsnet_with_xaml_ui" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/05/pongvsnet-with-xaml-ui-thumb.png" width="483" height="378" /></a></p>
<p>Here’s the very same Pongo.xaml file (or copy of it to be precise) in Expression Blend, but before you get too excited, the “send to interactive console” context menu option seems to suffer some kind of inconsistent behaviour (on my machine any way), causing the File copy operation in my .py files to work on only some occasions. </p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/05/pong-in-blend.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pong_in_blend" border="0" alt="pong_in_blend" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/05/pong-in-blend-thumb.png" width="485" height="366" /></a> </p>
<p>Undeterred I decided to fall back to an even more disintegrated experience and opt for running the synchronizing .py files in IPY.exe itself. This is easily achieved by associating <strong><em>.py</em></strong> files to the IPY.exe in Visual Studio using the context menu’s <strong><em>“open with”</em></strong> option, which is a something existing Visual Studio users will be very familiar with.</p>
<p>Like I said its far from a perfect solution and to be frank it’s somewhat annoying however my frustration is another thing altogether if I’m faced with doing all my layout and design in Visual Studio – so I will live with it for the moment. Hopefully the IronPython team and or the Expression Blend Team can find a solution that flows changes through more seamlessly in the short term and the perhaps in the long term allow us to open IronPython and IronRuby projects in Blend.</p>
<p>By the way if your wondering about the codename of the project that drove this adventure (PONGO) – the answer is yes if you guessed that it’s something that revolves around IronPython and MongoDB and I will be blogging about that more in the coming weeks.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=IronPython%20Tools%20for%20Visual%20Studio%20with%20Expression%20Blend&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2010%2F05%2F09%2Fironpython-tools-for-visual-studio-with-expression-blend%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="IronPython Tools for Visual Studio with Expression Blend";
		a2a_linkurl="http://www.simonsegal.net/blog/2010/05/09/ironpython-tools-for-visual-studio-with-expression-blend/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2010/05/09/ironpython-tools-for-visual-studio-with-expression-blend/">IronPython Tools for Visual Studio with Expression Blend</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2010/05/09/ironpython-tools-for-visual-studio-with-expression-blend/feed/</wfw:commentRss>
		</item>
		<item>
		<title>NFetchSpec Code &#8211; Entity Framework Repository, Fetching Strategies, Specifications, Code Only, Mapping, POCO and Making Roles Explicit.</title>
		<link>http://www.simonsegal.net/blog/2010/03/18/nfetchspec-code-entity-framework-repository-fetching-strategies-specifications-code-only-mapping-poco-and-making-roles-explicit/</link>
		<comments>http://www.simonsegal.net/blog/2010/03/18/nfetchspec-code-entity-framework-repository-fetching-strategies-specifications-code-only-mapping-poco-and-making-roles-explicit/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 10:56:02 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[DDD]]></category>

		<category><![CDATA[Design Patterns]]></category>

		<category><![CDATA[Entity Framework]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2010/03/18/nfetchspec-code-entity-framework-repository-fetching-strategies-specifications-code-only-mapping-poco-and-making-roles-explicit/</guid>
		<description><![CDATA[I have made the code from the NFetchSpec spiking / proof of concept available here. Be aware that it requires .NET Framework 4.0, Entity Framework 4.0 and the Feature CTP&#160; versions 2 or 3. I won’t be revising this code until the official release of version 4.0 and it will likely get some reworking. In [...]<p><a href="http://www.simonsegal.net/blog/2010/03/18/nfetchspec-code-entity-framework-repository-fetching-strategies-specifications-code-only-mapping-poco-and-making-roles-explicit/">NFetchSpec Code &ndash; Entity Framework Repository, Fetching Strategies, Specifications, Code Only, Mapping, POCO and Making Roles Explicit.</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I have made the code from the NFetchSpec spiking / proof of concept available <a href="http://www.simonsegal.net/blog/CodeDownloads/NFetchSpec.rar">here</a>. Be aware that it requires .NET Framework 4.0, Entity Framework 4.0 and the Feature CTP&#160; versions 2 or 3. I won’t be revising this code until the official release of version 4.0 and it will likely get some reworking. In the meantime if you want to understand the ideas in parts <a href="http://www.simonsegal.net/blog/2010/01/04/helping-entity-framework-v40-play-its-role-part-10/">1</a>, <a href="http://www.simonsegal.net/blog/2010/02/17/helping-entity-framework-v40-play-its-role-part-20/">2</a>, <a href="http://www.simonsegal.net/blog/2010/02/21/helping-entity-framework-v40-play-its-role-part-30/">3</a>, and <a href="http://www.simonsegal.net/blog/2010/03/15/helping-entity-framework-v40-play-its-role-part-40/">4</a> of <a href="http://www.simonsegal.net/blog/index.php?s=Helping+the+Entity+Framework+Play&amp;sbutt=Go">Helping the Entity Framework Play it’s &lt;ROLE&gt;</a> the you can feel free to pull the code apart and do with it what you will. Until then.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=NFetchSpec%20Code%20%26ndash%3B%20Entity%20Framework%20Repository%2C%20Fetching%20Strategies%2C%20Specifications%2C%20Code%20Only%2C%20Mapping%2C%20POCO%20and%20Making%20Roles%20Explicit.&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2010%2F03%2F18%2Fnfetchspec-code-entity-framework-repository-fetching-strategies-specifications-code-only-mapping-poco-and-making-roles-explicit%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="NFetchSpec Code &ndash; Entity Framework Repository, Fetching Strategies, Specifications, Code Only, Mapping, POCO and Making Roles Explicit.";
		a2a_linkurl="http://www.simonsegal.net/blog/2010/03/18/nfetchspec-code-entity-framework-repository-fetching-strategies-specifications-code-only-mapping-poco-and-making-roles-explicit/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2010/03/18/nfetchspec-code-entity-framework-repository-fetching-strategies-specifications-code-only-mapping-poco-and-making-roles-explicit/">NFetchSpec Code &ndash; Entity Framework Repository, Fetching Strategies, Specifications, Code Only, Mapping, POCO and Making Roles Explicit.</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2010/03/18/nfetchspec-code-entity-framework-repository-fetching-strategies-specifications-code-only-mapping-poco-and-making-roles-explicit/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Helping Entity Framework v4.0 play it&#8217;s &#60;ROLE&#62; &#8211; Part 4.0</title>
		<link>http://www.simonsegal.net/blog/2010/03/15/helping-entity-framework-v40-play-its-role-part-40/</link>
		<comments>http://www.simonsegal.net/blog/2010/03/15/helping-entity-framework-v40-play-its-role-part-40/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 01:11:30 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[DDD]]></category>

		<category><![CDATA[Entity Framework]]></category>

		<category><![CDATA[NServiceBus]]></category>

		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2010/03/15/helping-entity-framework-v40-play-its-role-part-40/</guid>
		<description><![CDATA[Before diving in you might like to read parts 1, 2 and 3 if you have come to this post out of sync. Also if you are not familiar with some of the newer aspects of the Code Only CTP for Entity Framework it might be worth looking here on the ADO.Net Team blog.
The Service [...]<p><a href="http://www.simonsegal.net/blog/2010/03/15/helping-entity-framework-v40-play-its-role-part-40/">Helping Entity Framework v4.0 play it&rsquo;s &lt;ROLE&gt; &ndash; Part 4.0</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Before diving in you might like to read parts <a href="http://www.simonsegal.net/blog/2010/01/04/helping-entity-framework-v40-play-its-role-part-10/">1</a>, <a href="http://www.simonsegal.net/blog/2010/02/17/helping-entity-framework-v40-play-its-role-part-20/">2</a> and <a href="http://www.simonsegal.net/blog/2010/02/21/helping-entity-framework-v40-play-its-role-part-30/">3</a> if you have come to this post out of sync. Also if you are not familiar with some of the newer aspects of the Code Only CTP for Entity Framework it might be worth looking here on the <a href="http://blogs.msdn.com/adonet/">ADO.Net Team blog</a>.</p>
<h2><span style="text-decoration: underline;">The Service Layer</span></h2>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/03/nfetchspec-servicelayer-2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="nfetchspec_serviceLayer_2" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/03/nfetchspec-servicelayer-2-thumb.png" border="0" alt="nfetchspec_serviceLayer_2" width="473" height="314" /></a></p>
<p>I want to point out that this approach in development is not restricted to a technology or architecture per`se and in discussing how it fits with a ‘Service Layer’ is equally valid for a Layered Request / Response style Architecture and asynchronous messaging systems with very well defined business components.</p>
<p>Let’s start with a run of the mill WCF approach – I have purposely elided the interface contract for the sake of brevity.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">[OperationContract(IsOneWay=<span style="color: #0000ff;">true</span>)]
[OperationBehaviour(TranactionScopeRequired=<span style="color: #0000ff;">true</span>,
                    TransactionScopeAutoComplete=<span style="color: #0000ff;">false</span>)]
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> DiscountRunOutProducts()
{
    IList&lt;IRunOutDiscountForProducts&gt; products = <span style="color: #0000ff;">null</span>;

    var compParams = <span style="color: #0000ff;">new</span> Dictionary&lt;<span style="color: #0000ff;">string</span>, <span style="color: #0000ff;">string</span>&gt;();
    compParams.Add(_conParamName, _connectionStringOnly);

    var repo = FetchSpec
                    .Configure
                    .With(<span style="color: #0000ff;">new</span> IoC())
                    .AndBuildSession&lt;IRunOutDiscountForProducts&gt;(compParams)
                    .ForRepository();

    <span style="color: #0000ff;">using</span> (var scope = <span style="color: #0000ff;">new</span> TransactionScope(TransactionScopeOption.Required,
        <span style="color: #0000ff;">new</span> TransactionOptions()
        {
            IsolationLevel =
                SessionBuilder&lt;IRunOutDiscountForProducts&gt;.ScopeIsolation()
        }))
    {
        products = repo.Get&lt;IRunOutDiscountForProducts&gt;();

        <span style="color: #0000ff;">foreach</span> (var product <span style="color: #0000ff;">in</span> products)
        {
            product.DiscountProductForRunOut();
        }

        scope.Complete();
    }
}</pre>
</div>
<p>Every expression of intent here is explicit, from the name of the service operation, all the way to the application of the ROLE to the ORM. From an ongoing maintenance perspective, when any of the given actors need to be varied through the life cycle of the software, this can be done independently. For example, we don’t have to revisit our service layers code when we profile the system and find that the fetching strategy should be eager fetching for a given scenario, instead we can build a new version of the existing Fetching Strategy and drop it in. This kind of flexibility ripples through the system, with the same said for Specifications, Message Handlers, so on and so forth. If of course you wanted to change the code to accept a Specification ‘in line’ rather than have it deployed and dynamically resolved, then you could probably have just implemented an overloaded version of the Service operation to begin with and pass in the parameters required to build those pieces at runtime. The example is a one way operation but you could easily be returning values and accepting parameters (think DTO’s) in a request / response scenario. Bear in mind these DTO’s are not being mapped and subsequently attached, they are either parameters for the ORM or return property buckets for binding or mapping to a presentation model.</p>
<p>For a point of difference, let’s take a look at how this might work if our Service Layer was implemented on top of the popular Open Source Framework <a href="http://www.nservicebus.com/">NServiceBus</a>.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> DiscountRunOutProductsMessage: IMessage
{
    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> DiscountedRegion{ get; set; }
    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">decimal</span> UnitPrice{ get; set; }
}

<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> DiscountRunOutProducts :
             IMessageHandler&lt;DiscountRunOutProductsMessage&gt;
{
    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> Handle(DiscountRunOutProductsMessage message)
    {
        IList&lt;IRunOutDiscountForProducts&gt; products = <span style="color: #0000ff;">null</span>;

        var compParams = <span style="color: #0000ff;">new</span> Dictionary&lt;<span style="color: #0000ff;">string</span>, <span style="color: #0000ff;">string</span>&gt;();
        compParams.Add(_conParamName, _connectionStringOnly);

        var repo = FetchSpec.Configure
                            .With(<span style="color: #0000ff;">new</span> IoC())
                            .AndBuildSession&lt;IRunOutDiscountForProducts&gt;
                                (compParams)
                            .ForRepository();

        <span style="color: #0000ff;">using</span> (var scope = <span style="color: #0000ff;">new</span> TransactionScope(TransactionScopeOption.Required,
            <span style="color: #0000ff;">new</span> TransactionOptions()
            {
                IsolationLevel =
                    SessionBuilder&lt;IRunOutDiscountForProducts&gt;.ScopeIsolation()
            }))
        {
            var spec = <span style="color: #0000ff;">new</span> Specification&lt;IRunOutDiscountForProducts&gt;
                            (p =&gt; p.UnitPrice &lt; message.UnitPrice &amp;&amp;
                             p.Supplier.Region = message.DiscountedRegion);

            products = repo.Get&lt;IRunOutDiscountForProducts&gt;(spec);

            <span style="color: #0000ff;">foreach</span> (var product <span style="color: #0000ff;">in</span> products)
            {
                product.DiscountProductForRunOut();
            }

            scope.Complete();
        }
    }
}</pre>
</div>
<p>Something worth pointing out in our NServiceBus example is that it too is quite explicit. The message handler, handles messages expressly for the purpose of discounting products to be ‘run out’, exemplifying how the pattern is becoming more entrenched in our style of working. Once again, if we don’t like anything about the way the handler is doing it’s work, we can throw it away in preference for a new implementation.</p>
<h2><span style="text-decoration: underline;">Not to be left out</span></h2>
<p><a href="http://blogger.forgottenskies.com/">Steve</a> left a <a href="http://www.simonsegal.net/blog/2010/02/21/helping-entity-framework-v40-play-its-role-part-30/#comments">comment</a> and asked me not to forgo examples that dealt with inserting and updating data, Steve also wanted to know about how I go about dealing with the Unit of Work and the ‘per session’ vs. &#8216;conversation’ and the differences that spring up and also when working with WCF and dealing with optimistic concurrency. Fortunately this part in the series takes aim squarely at how to go about using Entity Framework in concert with Roles from the Service Layer and we tackle those questions by necessity.</p>
<h3><span style="text-decoration: underline;">Listing 1.0 – Inserts</span></h3>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> add_a_product()
{
    var compParams = <span style="color: #0000ff;">new</span> Dictionary&lt;<span style="color: #0000ff;">string</span>, <span style="color: #0000ff;">string</span>&gt;();
    compParams.Add(_conParamName, _connectionStringOnly);

    var repo = FetchSpec.Configure
                        .With(<span style="color: #0000ff;">new</span> StubIoc() {
                            ScannedAssemblyPath = _scannedAssemblyPath })
                        .AndBuildSession&lt;ICustomerToAddOrder&gt;(compParams)
                        .ForRepository();

    var spec =
        <span style="color: #0000ff;">new</span> Specification&lt;ICustomerToAddOrder&gt;(c =&gt; c.CustomerID == <span style="color: #006080;">&#8220;ALFKI&#8221;</span>);
    var config = <span style="color: #0000ff;">new</span> IQueryConfigurable[] { spec };

    <span style="color: #0000ff;">using</span> (var scope = <span style="color: #0000ff;">new</span> TransactionScope(TransactionScopeOption.Required,
        <span style="color: #0000ff;">new</span> TransactionOptions()
        {
                IsolationLevel =
                    SessionBuilder&lt;ICustomerToAddOrder&gt;.ScopeIsolation()
        }))
    {
        dynamic customer = repo.Get&lt;ICustomerToAddOrder&gt;(config).First();

        var order = repo.IocContainer
                        .ConvertFromRoleToImpl&lt;IOrderToAddToCustomer&gt;();
        order.CustomerID = customer.CustomerID;
        order.Customer = customer;

        customer.AddOrder(order);

        repo.Save();

        scope.Complete();
    }
}</pre>
</div>
<h2><span style="text-decoration: underline;">Not entirely in the spirit of things</span></h2>
<p>Notice the use of the <span style="color: #0080ff;"><strong><em>dynamic</em></strong></span> keyword above (suggested by <a href="http://www.markharris.net.au/">Mark</a>) Let me explain. Due the Entity Frameworks hard and fast rule of only allowing EntityConfiguration&lt;T&gt; to specify a concrete class as it’s generic argument, the flow through effects have rippled out, with the customer variable and the order variable. The problem is that the IoC container can’t know ahead of time what the implementation type for the interface might be and order.Customer property is forced to use a concrete type (not interface) to satisfy the Entity Framework for mapping purposes enforced by EntityConfiguration&lt;T&gt;. After speaking to <a href="http://blogs.rev-net.com/ddewinter/">David DeWinter</a> (a Tester on the EF Team who responded to a tweet I made), he suggested that it was likely implemented this way to satisfy ObjectSet&lt;T&gt; which also constrains to a concrete implementation (makes sense).</p>
<p>Ultimately the <strong><em><span style="color: #0080ff;">dynamic</span></em></strong> keyword will get us over the line with respect to this one final hurdle, however my gut says that this work around isn’t entirely in the spirit of NFetchSpec and smacks a little of my old enemy the VARIANT, but I’m prepared to make this one allowance to get me working in a way that suits my needs. I can still read the code somewhat clearly because even when I’m using <em><strong><span style="color: #0080ff;">dynamic</span></strong></em> for assignment, I can reason about the type based on the interface specified to the repository and the IoC container. I would love to think that this is something that the Entity Framework team might address but I guess I will just have to wait and see.</p>
<h2><span style="text-decoration: underline;">Under the covers</span></h2>
<p>What code did I need to write to support this ‘adding a product to a customer’ scenario? First up I needed the role itself, then the entities, the mapping classes, the mapping role class and I also needed to write an implementation for IProvideIsolationLevelFor. The Specification I chose to write inline because the parameter value would be provided at run time. Here is the all of it:</p>
<h3><span style="text-decoration: underline;">The Roles</span></h3>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">interface</span> ICustomerToAddOrder
{
    <span style="color: #0000ff;">void</span> AddOrder(IOrderToAddToCustomer order);
    <span style="color: #0000ff;">string</span> CustomerID { get; set; }
    ICollection&lt;OrderToAddToCustomer&gt; Orders { get; set; }
}</pre>
</div>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">interface</span> IOrderToAddToCustomer
{
    <span style="color: #0000ff;">string</span> CustomerID { get; set; }
    CustomerToAddOrder Customer { get; set; }
    <span style="color: #0000ff;">int</span> OrderID { get; set; }
}</pre>
</div>
<h3><span style="text-decoration: underline;">The Entities</span></h3>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> CustomerToAddOrder : IEntity, ICustomerToAddOrder
{
    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> CustomerID { get; set; }
    <span style="color: #0000ff;">public</span> ICollection&lt;OrderToAddToCustomer&gt; Orders { get; set; }

    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> AddOrder(IOrderToAddToCustomer order)
    {
        <span style="color: #0000ff;">if</span> (Orders == <span style="color: #0000ff;">null</span>)
            Orders = <span style="color: #0000ff;">new</span> List&lt;OrderToAddToCustomer&gt;();

        Orders.Add(order <span style="color: #0000ff;">as</span> OrderToAddToCustomer);
    }
}

<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> OrderToAddToCustomer : IEntity, IOrderToAddToCustomer
{
    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> CustomerID
    {
        get;
        set;
    }

    <span style="color: #0000ff;">public</span> CustomerToAddOrder Customer
    {
        get;
        set;
    }

    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> OrderID
    {
        get;
        set;
    }
}</pre>
</div>
<h3><span style="text-decoration: underline;">The Mapping Classes</span></h3>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> CustomerToAddOrderMapping : Mapping&lt;CustomerToAddOrder&gt;
{
    <span style="color: #0000ff;">public</span> CustomerToAddOrderMapping(<span style="color: #0000ff;">string</span> objectSetName)
        : <span style="color: #0000ff;">base</span>(objectSetName)
    {
        Property(c =&gt; c.CustomerID).HasMaxLength(5).IsRequired();
        HasKey(c =&gt; c.CustomerID);
        Relationship(c =&gt; c.Orders).IsOptional();
    }
}

<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> OrderToAddToCustomerMapping : Mapping&lt;OrderToAddToCustomer&gt;
{
    <span style="color: #0000ff;">public</span> OrderToAddToCustomerMapping(<span style="color: #0000ff;">string</span> objectSetName)
        : <span style="color: #0000ff;">base</span>(objectSetName)
    {
        Property(o =&gt; o.OrderID).IsIdentity();
        Property(o =&gt; o.CustomerID).HasMaxLength(5).IsRequired();
        HasKey(o =&gt; o.OrderID);
        Relationship(o =&gt; o.Customer)
            .FromProperty(c =&gt; c.Orders)
            .HasConstraint((o, c) =&gt; o.CustomerID == c.CustomerID);
    }
}</pre>
</div>
<h3><span style="text-decoration: underline;">The Mapping Role</span></h3>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> CustomerToAddOrderMappingRole :
        IMappingRole&lt;ICustomerToAddOrder&gt;
{
    <span style="color: #0000ff;">private</span> IMapping[] _mappings;

    <span style="color: #0000ff;">public</span> CustomerToAddOrderMappingRole()
    {
        _mappings = <span style="color: #0000ff;">new</span> IMapping[]
        {
            <span style="color: #0000ff;">new</span> CustomerToAddOrderMapping(<span style="color: #006080;">&#8220;Customers&#8221;</span>),
            <span style="color: #0000ff;">new</span> OrderToAddToCustomerMapping(<span style="color: #006080;">&#8220;Orders&#8221;</span>)
        };
    }

    <span style="color: #0000ff;">public</span> IMapping[] Mappings
    {
        get { <span style="color: #0000ff;">return</span> _mappings; }
    }
}</pre>
</div>
<h3><span style="text-decoration: underline;">The Transaction Isolation Class</span></h3>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> AddOrderToCustomerIsolation :
        IProvideIsolationLevelFor&lt;ICustomerToAddOrder&gt;
{
    <span style="color: #0000ff;">public</span> IsolationLevel GetScopeIsolationForRole
    {
        get { <span style="color: #0000ff;">return</span> IsolationLevel.ReadCommitted; }
    }
}</pre>
</div>
<h2><span style="text-decoration: underline;">Piggy in the middle</span></h2>
<p>The issue of managing a short or extended session with an ObjectContext is something that I think a lot of people struggle with. Personally I have never had such an issue because they way I have always worked always involved fetching the most current version of the data I required to have my domain model work against it. This way of working has stayed with me through time immemorial, even in my dark old days of using an anaemic domain model.  To be clear I do not pass DTO’s around and reattach them to the ObjectContext, rather refreshing the data and letting the domain model’s business logic take care of the rest.</p>
<h2><span style="text-decoration: underline;">In Conclusion</span></h2>
<p>My initial planning for the series was that would be take up four posts and therefore it is expected that this may be the last in the series. However, given that Entity Framework 4.0 is still not at RTM and Code Only is still in CTP then it’s possible I may revisit it with a further post sometime in the future.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=Helping%20Entity%20Framework%20v4.0%20play%20it%26rsquo%3Bs%20%3CROLE%3E%20%26ndash%3B%20Part%204.0&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2010%2F03%2F15%2Fhelping-entity-framework-v40-play-its-role-part-40%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Helping Entity Framework v4.0 play it&rsquo;s <ROLE> &ndash; Part 4.0";
		a2a_linkurl="http://www.simonsegal.net/blog/2010/03/15/helping-entity-framework-v40-play-its-role-part-40/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2010/03/15/helping-entity-framework-v40-play-its-role-part-40/">Helping Entity Framework v4.0 play it&rsquo;s &lt;ROLE&gt; &ndash; Part 4.0</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2010/03/15/helping-entity-framework-v40-play-its-role-part-40/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Are we not men - we are Devo?</title>
		<link>http://www.simonsegal.net/blog/2010/03/12/are-we-not-men-we-are-devo/</link>
		<comments>http://www.simonsegal.net/blog/2010/03/12/are-we-not-men-we-are-devo/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 11:03:05 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[Career]]></category>

		<category><![CDATA[developers]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2010/03/12/are-we-not-men-we-are-devo/</guid>
		<description><![CDATA[ 
Does this look like you? Are you surrounded by like minded individuals, sharing a community experience at work with your fellow geeks? Perhaps you have even gone further than that and made a lasting friend or two out of your fellow developers. That certainly describes&#160; the kind of environment that I flourish in and [...]<p><a href="http://www.simonsegal.net/blog/2010/03/12/are-we-not-men-we-are-devo/">Are we not men - we are Devo?</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/03/image2.png"><img style="border-right-width: 0px; margin: 0px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/03/image-thumb2.png" width="151" height="167" /></a> </p>
<p>Does this look like you? Are you surrounded by like minded individuals, sharing a community experience at work with your fellow geeks? Perhaps you have even gone further than that and made a lasting friend or two out of your fellow developers. That certainly describes&#160; the kind of environment that I flourish in and in my more senior years, have worked hard to foster. It’s my experience that software developed in this environment is more cohesive and easier to maintain over the long haul. With he right personality types, social activity at work for geeks&#160; often means talking shop and this leads to a win – win situation for everyone. More ideas begat better ideas, common work patterns begin to evolve; other than that it’s just plain more enjoyable.</p>
<p>However I have struck the odd workplace that is the antithesis of what I have just described. Personality bereft work silos, with dead silence abounding throughout the organisation, lack of willingness to work together, fostering a cycle of suspicion and loss of preparedness to work as a team. I have seen enough of this type of work place to know that I can never work in one again.</p>
<p>Of course it’s possible that I have just described your workplace and perhaps even worse than that, it’s the way it is because you designed it to be that way? What kind of work environment do you have? Do the developers at your office communicate with one another vibrantly, rich in tone and timbre, taking coffee breaks together, occasionally going out for lunch and generally taking any office bound social opportunity to debate and discuss geeky things? Do you have a mate at work? </p>
<p>I would really be interested to hear the arguments (if there are any) that make a case for this almost <a href="http://en.wikipedia.org/wiki/Bertolt_Brecht">Brechtian</a> bleakness and minimalism in surroundings.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=Are%20we%20not%20men%20-%20we%20are%20Devo%3F&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2010%2F03%2F12%2Fare-we-not-men-we-are-devo%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Are we not men - we are Devo?";
		a2a_linkurl="http://www.simonsegal.net/blog/2010/03/12/are-we-not-men-we-are-devo/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2010/03/12/are-we-not-men-we-are-devo/">Are we not men - we are Devo?</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2010/03/12/are-we-not-men-we-are-devo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ADSD Course with Udi Dahan in Sydney Australia for November 2010</title>
		<link>http://www.simonsegal.net/blog/2010/03/04/adsd-course-with-udi-dahan-in-sydney-australia-for-november-2010/</link>
		<comments>http://www.simonsegal.net/blog/2010/03/04/adsd-course-with-udi-dahan-in-sydney-australia-for-november-2010/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 06:50:04 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[DDD]]></category>

		<category><![CDATA[Distributed]]></category>

		<category><![CDATA[NServiceBus]]></category>

		<category><![CDATA[Training]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2010/03/04/adsd-course-with-udi-dahan-in-sydney-australia-for-november-2010/</guid>
		<description><![CDATA[ Hot on the heels of Udi’s visit to Melbourne this year (in January), comes another chance to make good if you missed out. Plans are underway for Udi to visit us yet again, this time in Sydney. If your interested check out Udi’s post and register your interest using the link for the proposed [...]<p><a href="http://www.simonsegal.net/blog/2010/03/04/adsd-course-with-udi-dahan-in-sydney-australia-for-november-2010/">ADSD Course with Udi Dahan in Sydney Australia for November 2010</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/03/image1.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px 5px 0px 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="left" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/03/image-thumb1.png" width="157" height="75" /></a> Hot on the heels of Udi’s <a href="http://www.simonsegal.net/blog/guests-on-demand/">visit to Melbourne</a> this year (in January), comes another chance to make good if you missed out. Plans are underway for Udi to visit us yet again, this time in Sydney. If your interested check out Udi’s <a href="http://www.udidahan.com/2010/03/01/nservicebus-2-0-rtm/">post</a> and register your interest using the link for the proposed Sydney event. If you want to know more about the course you can see the course outline <a href="http://www.udidahan.com/training/">here</a> and read <a href="http://www.simonsegal.net/blog/2010/02/04/adsd-nservicebus-and-nuclear-armament-the-full-story/">my review</a> which contains links to some further reviews from other attendees in Melbourne earlier this year.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=ADSD%20Course%20with%20Udi%20Dahan%20in%20Sydney%20Australia%20for%20November%202010&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2010%2F03%2F04%2Fadsd-course-with-udi-dahan-in-sydney-australia-for-november-2010%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="ADSD Course with Udi Dahan in Sydney Australia for November 2010";
		a2a_linkurl="http://www.simonsegal.net/blog/2010/03/04/adsd-course-with-udi-dahan-in-sydney-australia-for-november-2010/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2010/03/04/adsd-course-with-udi-dahan-in-sydney-australia-for-november-2010/">ADSD Course with Udi Dahan in Sydney Australia for November 2010</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2010/03/04/adsd-course-with-udi-dahan-in-sydney-australia-for-november-2010/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Helping Entity Framework v4.0 play it&#8217;s &#60;ROLE&#62; &#8211; Part 3.0</title>
		<link>http://www.simonsegal.net/blog/2010/02/21/helping-entity-framework-v40-play-its-role-part-30/</link>
		<comments>http://www.simonsegal.net/blog/2010/02/21/helping-entity-framework-v40-play-its-role-part-30/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 11:33:23 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[DDD]]></category>

		<category><![CDATA[Entity Framework]]></category>

		<category><![CDATA[Patterns &amp; Practices]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2010/02/21/helping-entity-framework-v40-play-its-role-part-30/</guid>
		<description><![CDATA[In part 1.0 we laid the foundation and part 2.0 unravelled some of the internal details of how NFetchSpec (the libraries that are subject of this discussion) goes about enlisting the benefits that can be derived by using explicit roles in your system by collapsing a swathe of Entity Framework functionality into a somewhat compact [...]<p><a href="http://www.simonsegal.net/blog/2010/02/21/helping-entity-framework-v40-play-its-role-part-30/">Helping Entity Framework v4.0 play it&rsquo;s &lt;ROLE&gt; &ndash; Part 3.0</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.simonsegal.net/blog/2010/01/04/helping-entity-framework-v40-play-its-role-part-10/">part 1.0</a> we laid the foundation and <a href="http://www.simonsegal.net/blog/2010/02/17/helping-entity-framework-v40-play-its-role-part-20/">part 2.0</a> unravelled some of the internal details of how NFetchSpec (the libraries that are subject of this discussion) goes about enlisting the benefits that can be derived by using explicit roles in your system by collapsing a swathe of Entity Framework functionality into a somewhat compact approach to dealing with a Domain Model. First a quick recap of the underpinnings.</p>
<h3><span style="text-decoration: underline">Figure 1.0</span></h3>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/ef-roles-part3-nfetch-in-action-usage-quadrant.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ef_roles_part3_nfetch_in_action_usage_quadrant" border="0" alt="ef_roles_part3_nfetch_in_action_usage_quadrant" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/ef-roles-part3-nfetch-in-action-usage-quadrant-thumb.png" width="490" height="413" /></a></p>
<h4><span style="text-decoration: underline">Code from Figure 1.0</span></h4>
<p><span style="text-decoration: underline"></span></p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> resolves_everything_from_container()
{
    IList&lt;IRunOutDiscountForProducts&gt; products = <span style="color: #0000ff">null</span>;

    var compParams = <span style="color: #0000ff">new</span> Dictionary&lt;<span style="color: #0000ff">string</span>, <span style="color: #0000ff">string</span>&gt;();
    compParams.Add(_conParamName, _connectionStringOnly);

    var repo = FetchSpec.Configure
                            .With(<span style="color: #0000ff">new</span> IoC())
                            .AndBuildSession&lt;IRunOutDiscountForProducts&gt;
                                (compParams)
                            .ForRepository();

    <span style="color: #0000ff">using</span> (var scope = <span style="color: #0000ff">new</span> TransactionScope(TransactionScopeOption.Required,
        <span style="color: #0000ff">new</span> TransactionOptions()
        {
            IsolationLevel =
                SessionBuilder&lt;IRunOutDiscountForProducts&gt;.ScopeIsolation()
        }))
    {
        products = repo.Get&lt;IRunOutDiscountForProducts&gt;();
        <span style="color: #0000ff">foreach</span> (var product <span style="color: #0000ff">in</span> products)
        {
            product.DiscountProductForRunOut();
        }

        scope.Complete();
    }
}</pre>
</div>
<p>Figure 1.0 demonstrates how all the moving parts in the developer experience are put to use when using the NFetchSpec libraries to query and make changes to a persisted Domain Model. Let’s now examine in detail all the steps that make up the entire developer experience of composing all the discrete pieces needed in addressing the role of <strong><em>IRunOutDiscountForProducts</em></strong> (in our fictitious system).</p>
<h2><span style="text-decoration: underline">The Development Scenario</span></h2>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/image.png" target="_blank"><img style="border-right-width: 0px; margin: 0px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/image-thumb.png" width="37" height="38" /></a> The first outlined section in figure 1.0 demonstrates the building of an appropriate ObjectContext for the Repository that is instantiated by the fluent interface. From the developer experience perspective, nothing special needs to be done outside of specifying the role to the fluent interface in this manner.</p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/image1.png" target="_blank"><img style="border-right-width: 0px; margin: 0px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/image-thumb1.png" width="37" height="38" /></a> The second outlined section in figure 1.0 highlights how the role is leveraged to dynamically have NFetchSpec chose the ‘<strong>right</strong>’ isolation level. Being explicit in this way we can achieve a high degree of separation of concerns with respect to transaction isolation and thus exercise our control over the concurrency and throughput in the database on a role by role basis. In the example, we are discounting products earmarked for a run out sale, consequently changing their unit price, therefore we might like to choose a higher isolation level for that particular operation, depending on the volatility of the data that your dealing with and the normalization or lack thereof in your database schema. For the developer this means creating a concrete implementation of the interface <strong><em>IProvideIsolationLevelFor&lt;T&gt;</em></strong>, to support this automagic behaviour.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> interface IProvideIsolationLevelFor&lt;TRole&gt;
{
    IsolationLevel GetScopeIsolationForRole { <span style="color: #0000ff">get</span>;}
}

<span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> RunoutDiscountIsolation :
             IProvideIsolationLevelFor&lt;IRunOutDiscountForProducts&gt;
{
    <span style="color: #0000ff">public</span> IsolationLevel GetScopeIsolationForRole
    {
        <span style="color: #0000ff">get</span> { <span style="color: #0000ff">return</span> IsolationLevel.ReadCommitted; }
    }
}</pre>
</div>
<p>That’s it as far as getting your transaction set for the right Isolation Level within the scope of work for a given role. If we decide at some point that this Isolation Level is not the best fit, we can replace it with a new implementation.</p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/image2.png" target="_blank"><img style="border-right-width: 0px; margin: 0px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/image-thumb2.png" width="37" height="38" /></a> The Third outlined section in figure 1.0 highlights the use of the Repository to retrieve the Entities that we are interested in. This is where the NFetchSpec machinery goes to work to resolve all the purpose built artefacts that have been implemented for the given role, such as any applicative Fetching Strategy, Specification, Entity and Mapping.</p>
<h3><span style="text-decoration: underline">The Loaded Fetching Strategy</span></h3>
<p><span style="text-decoration: underline"></span></p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> ProductRunOutFetchingStrategy :
             FetchingStrategy&lt;IRunOutDiscountForProducts&gt;
{
    <span style="color: #0000ff">public</span> ProductRunOutFetchingStrategy()
        : base(<span style="color: #0000ff">false</span>)
    {
        var production_intentions =
            EagerFetchingIntention
            .CreateInstance&lt;IRunOutDiscountForProducts,
                            ISupplier&gt;(p =&gt; p.Supplier);

        this.AddIntentions(<span style="color: #0000ff">new</span> IEagerFetchingIntention[]
        {
            production_intentions
        });
    }
}</pre>
</div>
<p>The intent of the developer in building this Fetching Strategy is to load Products eagerly with their reference Supplier.</p>
<h3><span style="text-decoration: underline">The Loaded Specification</span></h3>
<p><span style="text-decoration: underline"></span></p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> RunOutProductDiscountSpecification :
             Specification&lt;IRunOutDiscountForProducts&gt;
{
    <span style="color: #0000ff">public</span> RunOutProductDiscountSpecification()
        : base(p =&gt; p.UnitPrice &gt; 5M) { }
}</pre>
</div>
<p>The Specification is really quite simple and self evident – setting up the applicative Expression that will ultimately be translated into a ‘where’ predicate.</p>
<h3><span style="text-decoration: underline">The Loaded Mapping</span></h3>
<p>First up we need to map our Entities and that requires a Mapping&lt;T&gt;.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> ProductMapping : Mapping&lt;Product&gt;
{
    <span style="color: #0000ff">public</span> ProductMapping(string objectSetName) : base(objectSetName)
    {
        Property(p =&gt; p.ProductID).IsIdentity();
        Property(p =&gt; p.ProductName).HasMaxLength(50).IsRequired();
        Property(p =&gt; p.UnitPrice).<span style="color: #0000ff">Precision</span> = 19;
        Property(p =&gt; p.UnitPrice).Scale = 4;
        Relationship(p =&gt; p.Supplier).IsOptional();
        Relationship(p =&gt; p.Supplier).IsOptional().FromProperty(s =&gt; s.Products);
    }
}</pre>
</div>
<p>And because our example has a reference Entity in the root we require the following <strong><em>Supplier</em></strong> Entity Mapping also.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> SupplierMapping : Mapping&lt;Supplier&gt;
{
    <span style="color: #0000ff">public</span> SupplierMapping(string objectSetName)
        : base(objectSetName)
    {
        Property(s =&gt;  s.SupplierID).IsIdentity();
        Property(s =&gt; s.CompanyName).HasMaxLength(40).IsRequired();
        Property(s =&gt; s.Region).HasMaxLength(15);
        Relationship(s =&gt; s.Products).IsOptional().FromProperty(p =&gt; p.Supplier);
    }
}</pre>
</div>
<p>The last requirement of the developer with respect to mapping is to create a MappingRole&lt;T&gt;, the purpose of which is to indicate to the infrastructure which mappings are applicable to the Role.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> RunOutDiscountMappingRole :
             IMappingRole&lt;IRunOutDiscountForProducts&gt;
{
    private IMapping[] _mappings;

    <span style="color: #0000ff">public</span> RunOutDiscountMappingRole()
    {
        _mappings = <span style="color: #0000ff">new</span> IMapping[]
                    {
                        <span style="color: #0000ff">new</span> ProductMapping(&quot;Products&quot;),
                        <span style="color: #0000ff">new</span> SupplierMapping(&quot;Suppliers&quot;)
                    };
    }

    <span style="color: #0000ff">public</span> IMapping[] Mappings
    {
        <span style="color: #0000ff">get</span> { <span style="color: #0000ff">return</span> _mappings; }
    }
}</pre>
</div>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/image3.png" target="_blank"><img style="border-right-width: 0px; margin: 0px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/image-thumb3.png" width="37" height="38" /></a> The fourth and final outlined section in figure 1.0 is really the essence of what is going on here, it is entirely the reason this code is being invoked – it is the purpose (discounting products) of the system for this role. When developing in this way we need to specify the behaviour of the Role through the stable abstraction of it’s interface, and implement that behaviour in a concrete Entity.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> interface IRunOutDiscountForProducts : IProductData
{
    void DiscountProductForRunOut();
}</pre>
</div>
<p><span style="text-decoration: underline"></span></p>
<h2><span style="text-decoration: underline">The Bang and Crash</span></h2>
<p>So with all that done, we need to deploy our “Role inspired” artefacts to the executing processes assemblies folder and when it’s all said and done the code from Figure 1.0 executes, enlisting the service of NFetchSpec in applying the combined intent and customised behaviours described in all of the deployed pieces.</p>
<p>From the database perspective, SQL Profiler tells us that our intent for this ROLE has been met and the system has behaved precisely as expected.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">SELECT</span>
    [Extent1].[ProductID] <span style="color: #0000ff">AS</span> [ProductID],
    [Extent1].[ProductName] <span style="color: #0000ff">AS</span> [ProductName],
    [Extent1].[UnitPrice] <span style="color: #0000ff">AS</span> [UnitPrice],
    [Extent2].[CompanyName] <span style="color: #0000ff">AS</span> [CompanyName],
    [Extent2].[Region] <span style="color: #0000ff">AS</span> [Region],
    [Extent2].[SupplierID] <span style="color: #0000ff">AS</span> [SupplierID]
<span style="color: #0000ff">FROM</span>
    [dbo].[Products] <span style="color: #0000ff">AS</span> [Extent1]
<span style="color: #0000ff">LEFT</span> <span style="color: #0000ff">OUTER</span> <span style="color: #0000ff">JOIN</span>
    [dbo].[Suppliers] <span style="color: #0000ff">AS</span> [Extent2]
<span style="color: #0000ff">ON</span>
    [Extent1].[SupplierID] = [Extent2].[SupplierID]
<span style="color: #0000ff">WHERE</span>
    [Extent1].[UnitPrice] &gt; <span style="color: #0000ff">cast</span>(5 <span style="color: #0000ff">as</span> <span style="color: #0000ff">decimal</span>(18))</pre>
</div>
<p><strong><u></u></strong></p>
<table border="1" cellspacing="0" cellpadding="2" width="400">
<tbody>
<tr>
<td valign="top" width="400">
<p><strong><u>UPDATE: 14th March 2010</u></strong> </p>
<p>The query above was pasted in error previously. The current text for the TSQL here is correct as of the date listed here in this update.</p>
</td>
</tr>
</tbody>
</table>
<p>We can see that Fetching Strategy and Specification have been successful in shaping the TSQL sent to the server to retrieve the data. Below we can also see the effect of applying the business rules through our Domain Model.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">exec</span> sp_executesql N<span style="color: #006080">&#8216;update [dbo].[Products]
set [UnitPrice] = @0
where ([ProductID] = @1)
&#8216;</span>,N<span style="color: #006080">&#8216;@0 decimal(19,4),@1 int&#8217;</span>,@0=3.2960,@1=1</pre>
</div>
<p><span style="text-decoration: underline"></span></p>
<h2><span style="text-decoration: underline">Just one more thing</span></h2>
<p>Part 4.0 will be the final part in the series and will focus on how this approach blends into a service layer in a Service Oriented Architecture and also make the code for NFetchSpec available for download.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=Helping%20Entity%20Framework%20v4.0%20play%20it%26rsquo%3Bs%20%3CROLE%3E%20%26ndash%3B%20Part%203.0&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2010%2F02%2F21%2Fhelping-entity-framework-v40-play-its-role-part-30%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Helping Entity Framework v4.0 play it&rsquo;s <ROLE> &ndash; Part 3.0";
		a2a_linkurl="http://www.simonsegal.net/blog/2010/02/21/helping-entity-framework-v40-play-its-role-part-30/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2010/02/21/helping-entity-framework-v40-play-its-role-part-30/">Helping Entity Framework v4.0 play it&rsquo;s &lt;ROLE&gt; &ndash; Part 3.0</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2010/02/21/helping-entity-framework-v40-play-its-role-part-30/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Doing .NET Days March 6th Fully Booked.</title>
		<link>http://www.simonsegal.net/blog/2010/02/18/doing-net-days-march-6th-fully-booked/</link>
		<comments>http://www.simonsegal.net/blog/2010/02/18/doing-net-days-march-6th-fully-booked/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 14:13:00 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[doing .Net Days]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2010/02/17/doing-net-days-march-6th-fully-booked/</guid>
		<description><![CDATA[ Doing .Net Days for March 6th 2010 is now fully booked. Thanks to all those who have registered. It’s becoming apparent that the current venue may not be large enough to accommodate the interest moving forward so we are exploring alternative venues and will keep you up date as news comes to hand.
We are [...]<p><a href="http://www.simonsegal.net/blog/2010/02/18/doing-net-days-march-6th-fully-booked/">Doing .NET Days March 6th Fully Booked.</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/20pc-black1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="20pc_black" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/20pc-black-thumb1.png" border="0" alt="20pc_black" width="96" height="81" align="left" /></a> Doing .Net Days for March 6th 2010 is now <a href="http://www.simonsegal.net/blog/training/">fully booked</a>. Thanks to all those who have registered. It’s becoming apparent that the current venue may not be large enough to accommodate the interest moving forward so we are exploring alternative venues and will keep you up date as news comes to hand.</p>
<p>We are also in the throws of putting together the web site for the event which will be announce shortly.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=Doing%20.NET%20Days%20March%206th%20Fully%20Booked.&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2010%2F02%2F18%2Fdoing-net-days-march-6th-fully-booked%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Doing .NET Days March 6th Fully Booked.";
		a2a_linkurl="http://www.simonsegal.net/blog/2010/02/18/doing-net-days-march-6th-fully-booked/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2010/02/18/doing-net-days-march-6th-fully-booked/">Doing .NET Days March 6th Fully Booked.</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2010/02/18/doing-net-days-march-6th-fully-booked/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Helping Entity Framework v4.0 play it&#8217;s &#60;ROLE&#62; - Part 2.0</title>
		<link>http://www.simonsegal.net/blog/2010/02/17/helping-entity-framework-v40-play-its-role-part-20/</link>
		<comments>http://www.simonsegal.net/blog/2010/02/17/helping-entity-framework-v40-play-its-role-part-20/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 01:53:59 +0000</pubDate>
		<dc:creator>Simon Segal</dc:creator>
		
		<category><![CDATA[DDD]]></category>

		<category><![CDATA[Entity Framework]]></category>

		<category><![CDATA[Patterns &amp; Practices]]></category>

		<guid isPermaLink="false">http://www.simonsegal.net/blog/2010/02/17/helping-entity-framework-v40-play-its-role-part-20/</guid>
		<description><![CDATA[The content of this series of posts is based around a spiking effort / proof of concept that aims to modularize (I am avoiding the word framework) a set of libraries for the express purpose of addressing business intent for Domain models persisted with the Entity Framework. In part 1.0 we laid the groundwork and [...]<p><a href="http://www.simonsegal.net/blog/2010/02/17/helping-entity-framework-v40-play-its-role-part-20/">Helping Entity Framework v4.0 play it&rsquo;s &lt;ROLE&gt; - Part 2.0</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></description>
			<content:encoded><![CDATA[<p>The content of this series of posts is based around a spiking effort / proof of concept that aims to modularize (I am avoiding the word framework) a set of libraries for the express purpose of addressing business intent for Domain models persisted with the Entity Framework. In <a href="http://www.simonsegal.net/blog/2010/01/04/helping-entity-framework-v40-play-its-role-part-10/">part 1.0</a> we laid the groundwork and now we dig deeper.</p>
<p>I’m going to start this post at the end and then rewind all the way to beginning and step through how we got here. Here is some code that will return a list of products and in so doing, will dynamically determine the correct Entity type to return (a Product), will eagerly fetch their reference supplier and will apply a ‘where’ predicate to the LINQ To Entities query. All this will happen out of clear view as a result of being explicit and specifying a role / interface to the ORM when we ask it do something.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> Some_Method_In_My_Service_Layer
{
    var products = Repository.Get&lt;IRunOutDiscountForProducts&gt;();
}</pre>
</div>
<p>Now let’s briefly forget we saw this code and go back to the start.</p>
<p>Lets start by imagining some simple data access code that’s enormously compact and equally deceptive in it’s apparent simplicity. For a scenario, let’s propose that we want to get all the products in our system that are eligible for applying a run out discount. The business logic in achieving this function, specifies that a Products Unit Price Price  be greater 20.50 dollars and is purchased from suppliers in a given enumerable list of regions. For the sake of the example we will also say that this would require a Product entity and Supplier Entity in the following relationship.</p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/product-supplier-class-diag.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="product_supplier_class_diag" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/product-supplier-class-diag-thumb.png" border="0" alt="product_supplier_class_diag" width="447" height="253" /></a></p>
<p>So given our the scenario we would be required to map the Entities appropriately, choose an appropriate method of loading (lazy or eager) and apply a suitable predicate to the SQL query. Let’s now imagine that by specifying a role (in this case the interface <strong><em>IRunOutDiscountForProducts</em></strong>), that we have provided the infrastructure code enough information to query the database for products and do so in a way that meets the proposed scenario requirements enumerated above.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">var conParams = <span style="color: #0000ff;">new</span> Dictionary&lt;<span style="color: #0000ff;">string</span>, <span style="color: #0000ff;">string</span>&gt;();
conParams .Add(_conParamName, _connectionStringOnly);

var repository = FetchSpec.Configure
                    .With(<span style="color: #0000ff;">new</span> StubIoc()
                        { ScannedAssemblyPath = _scannedAssemblyPath })
                    .AndBuildSession&lt;IRunOutDiscountForProducts&gt;(conParams)
                    .ForRepository();

var products = repository.Get&lt;IRunOutDiscountForProducts&gt;();</pre>
</div>
<p>The line of code that interests us most at this point is the last one. By applying the role of <strong><em>IRunOutDiscountForProducts </em></strong>to the GET&lt;T&gt; function<strong><em>,</em></strong> we are able to indicate to the infrastructure that our intent is to retrieve a list of Products for the express reason to apply a ‘run out’ discount to them. The next line of code you might expect to see would logically be something like:</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">products = repo.Get&lt;IRunOutDiscountForProducts&gt;();
<span style="color: #0000ff;">foreach</span> (var product <span style="color: #0000ff;">in</span> products)
{
    product.DiscountProductForRunOut();
}

repo.Save();</pre>
</div>
<p>What figure 1.0 shows is that we would like our Repository to be smart enough to know exactly what and how to fetch based on the role (the generic parameterized interface).</p>
<h3><span style="text-decoration: underline;">Figure 1.0</span></h3>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/explicit-concerns.gif" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="explicit_concerns" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/explicit-concerns-thumb.gif" border="0" alt="explicit_concerns" width="448" height="208" /></a></p>
<p>I promise we will get to the end soon enough but bear with me for a minute or two. One thing about being explicit with roles, it makes understanding code all the more simple. The less ambiguity the less likely someone misunderstands intent. In the realm of software development the humble interface (not the UI kind) has carried the torch ably in helping us declare our intent more explicitly, make our code better understood and free of concrete dependencies / coupling. With reverence and honour for my past (COM programming veteran status), I apologise in advance for the ubiquitous IDog example but it makes a point.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> Poodle : IDog
{
    <span style="color: #008000;">//&#8230;.etc</span>
}</pre>
</div>
<p>Explicitly a Poodle must now conform polymorphically et al to the contract specified by IDog – real 101 stuff no doubt. What about a marker interface? True enough, a very useful construct, bereft of polymorphic intent and largely a utility to express membership to a conceptual entity group of some kind, often put to use in frameworks to support dynamism of some description. Let’s use an NServiceBus IMessage as an example:</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">interface</span> IMessage {}

<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> OrderCancelledMessage : IMessage
{
    <span style="color: #008000;">//&#8230;.etc</span>
}</pre>
</div>
<p>Without going too deep into this at a code level, suffice to say that the NServiceBus infrastructure will behave in certain ways when it comes across types that implement the IMessage interface, in other words the framework is directing us to ‘mark’ a given class (or interface) as being recognizable as a ‘Message’, making it identifiable to the frameworks internal workings.</p>
<p>The virtues of programming by interface are now well documented and for .NET developers the advent and popularity of generics has encouraged our creativity in placing stable abstractions  around things to make code more explicit. For example, a while back I wrote in the abstract on the use of interfaces to define roles; roles describe the polymorphic nature of a business domain command and arguably event. This series of posts is an extension of <a href="http://www.simonsegal.net/index.php?s=roles&amp;sbutt=Go">those made in the past</a>, the focus however now moves to a proof of concept for the up coming Entity Framework 4.0.</p>
<h3><span style="text-decoration: underline;">What is a Role?</span></h3>
<p>Roles identify or describe commands / behaviours in the domain, an level of intent that can be be nicely defined by an interface.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">interface</span> IRunOutDiscountForProducts : IProductData
{
    <span style="color: #0000ff;">void</span> DiscountProductForRunOut();
}</pre>
</div>
<p>We can use these roles (interfaces) to indicate to our infrastructure (an ORM in this case) what our intent is and have the infrastructure behave appropriately based on configuration and / or convention.</p>
<p>Since we started with an example that focused around products, lets continue with that subject for a moment. It may be that my system needs to fetch Products for a variety of reasons and not always with the same intent. We shouldn’t be asking for a generic list of Products, considering that we are interested in them with a very specific context in mind and its the context determines the behaviour and describes the a role.</p>
<p>Once our system becomes explicit in this way through the use of roles in our domain, we can do some interesting things. We can instruct the ORM how to load the entity graph by implementing Fetching Strategies, dynamically resolve the most appropriate Entity Mapping to use and which predicate to apply to the query for the purpose of business logic filtering. Not only does the the role provide a stable abstraction, it insulates other parts of the architecture, perhaps a service layer or controller, from changes, allowing the actors to vary independently.</p>
<h3><span style="text-decoration: underline;">The Roles Quadrant:</span></h3>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/quadrant-roles.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="quadrant_roles" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/quadrant-roles-thumb.png" border="0" alt="quadrant_roles" width="456" height="212" /></a></p>
<p>Whilst working on this proof of concept in my attempts at cajoling the Entity Framework to work in this fashion, it became evident that there were four main pieces of the puzzle, Fetching Strategies, Specifications, Mapping, and Repositories. One thing that I haven’t mentioned yet, is the effect on concurrency, scale and throughput that this approach can have. Through the use of roles we can plug into the architecture yet again and explicitly pick an isolation level for the operation at hand.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">using</span> (var scope = <span style="color: #0000ff;">new</span> TransactionScope(TransactionScopeOption.Required,
    <span style="color: #0000ff;">new</span> TransactionOptions()
    {
        IsolationLevel =
            SessionBuilder&lt;IRunOutDiscountForProducts&gt;.ScopeIsolation()
    }))
{
    <span style="color: #008000;">//&#8230;..do some stuff here like load data </span>
    <span style="color: #008000;">//&#8230;..change data by calling into your domain model</span>
    <span style="color: #008000;">//&#8230;..and finally save the changes</span>

    scope.Complete();
}</pre>
</div>
<p>Notice that in constructing the Transaction scope we use the SessionBuilder and ask it to supply an Isolation Level for the role specified. Of course their is some IOC magic involved here but essentially the only thing required to make work is the following interface. Here is an example implementation.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">interface</span> IProvideIsolationLevelFor&lt;TRole&gt;
{
    IsolationLevel GetScopeIsolationForRole { get;}
}

<span style="color: #008000;">///Implementation</span>

<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> RunoutDiscountIsolation :
    IProvideIsolationLevelFor&lt;IRunOutDiscountForProducts&gt;
{
    <span style="color: #0000ff;">public</span> IsolationLevel GetScopeIsolationForRole
    {
        get { <span style="color: #0000ff;">return</span> IsolationLevel.ReadCommitted; }
    }
}</pre>
</div>
<div>This concrete class is responsible (explicitly) for providing the correct isolation level for the <strong><em>IRunOutDiscountForProducts</em></strong> role.</div>
<h3><span style="text-decoration: underline;">Loaded Up</span></h3>
<div>Before looking at each of the four corners of the quadrant, I quickly want to draw your attention to the fact that Specifications, Fetching Strategies, Isolation Levels (for Transactions), Entities and indeed even their Mappings, can all be resolved from a container at runtime, based on the given role.</div>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">_container.Register(AllTypes
    .Of(<span style="color: #0000ff;">typeof</span>(IFetchingStrategy&lt;&gt;))
    .FromAssembly(assembly)
    .Configure(c =&gt; c.LifeStyle.Singleton).WithService.FirstInterface());

_container.Register(AllTypes
    .Of(<span style="color: #0000ff;">typeof</span>(ISpecification&lt;&gt;))
    .FromAssembly(assembly)
    .Configure(c =&gt; c.LifeStyle.Singleton).WithService.FirstInterface());

_container.Register(AllTypes
    .Of(<span style="color: #0000ff;">typeof</span>(IMappingRole&lt;&gt;))
    .FromAssembly(assembly)
    .Configure(c =&gt; c.LifeStyle.Singleton).WithService.FirstInterface());

_container.Register(AllTypes
    .Of(<span style="color: #0000ff;">typeof</span>(IProvideIsolationLevelFor&lt;&gt;))
    .FromAssembly(assembly)
    .Configure(c =&gt; c.LifeStyle.Singleton).WithService.FirstInterface());

_container.Register(AllTypes
    .Of(<span style="color: #0000ff;">typeof</span>(IEntity))
    .FromAssembly(assembly));</pre>
</div>
<div>This will make the understanding an little easier as we move through the rest of the post.</div>
<h3><span style="text-decoration: underline;">Quadrant Position 1.0 – Fetching Strategies</span></h3>
<p>Fetching strategies encapsulate our expression of requirement with respect to Eager and Lazy Loading. This feature is useful, when one considers that the Entity Framework (and most ORM’s for that matter) do not provide these capabilities with a consistent API experience, nor allow for an out of box experience friendly to a configurable or convention based approach to specifying loading characteristics for a given expression of intent. Wouldn’t it be nice if we could ask the ORM to fetch an Entity using a role, one specific to a command that exists within a given business capability? This functionality does exist with NHibernate but not currently with either version of Entity Framework, but the good news is that it is possible. There are a couple of ways of doing this and I have <a href="http://www.simonsegal.net/index.php?s=Fetching+strategy&amp;sbutt=Go">blogged</a> about it more than once. At this point of the discussion it would be useful to show some code and how to configure a Fetching Strategy. First the interface:</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">interface</span> IFetchingStrategy&lt;TRole&gt; : IQueryConfigurable
{
    IEnumerable&lt;IEagerFetchingIntention&gt; Intentions { get; }
    IEnumerable&lt;<span style="color: #0000ff;">string</span>&gt; Includes { get; }
    <span style="color: #0000ff;">void</span> AddIntentions(IEagerFetchingIntention[] intentions);
    <span style="color: #0000ff;">bool</span> ShouldLazyLoad { get; }
    <span style="color: #0000ff;">bool</span> HasInstructions { get; }
}</pre>
</div>
<p>Next let’s look at an implementation (we will skip the base class for now).</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> CustomerPreferedFetchingStratey :
             FetchingStrategy&lt;IMakeCustomerPrefered&gt;
{
    <span style="color: #0000ff;">public</span> CustomerPreferedFetchingStratey()
        : <span style="color: #0000ff;">base</span>(<span style="color: #0000ff;">false</span>) {

            var orders_intention =
                EagerFetchingIntention
                .CreateInstance&lt;IMakeCustomerPrefered,
                                ICollection&lt;IOrder&gt;&gt;(c =&gt; c.Orders);
            var orderlines_intention =
                EagerFetchingIntention
                .CreateInstance&lt;IOrder,
                                ICollection&lt;IOrderLine&gt;&gt;(o =&gt; o.OrderLines);

            <span style="color: #0000ff;">this</span>.AddIntentions(<span style="color: #0000ff;">new</span> IEagerFetchingIntention[]
            {
                orders_intention,
                orders_intention.And(orderlines_intention)
            });
    }
}</pre>
</div>
<div>Without dwelling on all the moving parts, let’s summarise here by saying that this code has the responsibility of building up the ‘includes’ strings<strong><em> </em></strong>(<strong><em>see ObjectContext&lt;T&gt;.Include()</em></strong>) for eager fetching. No more magic strings applied to the ObjectContext.Include(“magic.more.magic”) method. With a Fetching Strategy we can determine our eager fetching in a strongly type fashion by explicitly specify a role to the Fetching Strategy. In this case above, we are using the <strong><em>IMakeCustomerPrefered</em></strong> role.</div>
<h3><span style="text-decoration: underline;"><span style="text-decoration: underline;"><span style="text-decoration: underline;">Quadrant </span>Position</span> 2.0 – Specification</span></h3>
<p>The <a href="http://en.wikipedia.org/wiki/Specification_pattern">Specification pattern</a> evolved around the problem of testing that the state condition of an object is met according to a given specification. This pattern has taken on some new potential with the help of LINQ. Using LINQ Expressions it’s possible to massage this pattern into something of a predicate store and when we think about developing with roles it becomes potentially more powerful again. Here is a quick look at a Specification and some usage:</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">var spec = <span style="color: #0000ff;">new</span> Specification&lt;IRunOutDiscountForProducts&gt;
              (p =&gt; p.UnitPrice &lt; 20M &amp;&amp; p.Supplier.Region == “London”);</pre>
</div>
<p>Pretty simple, the constructor takes the Expression to initialise the boolean test for the specified state. The classical purpose of the pattern is to provide a single function, commonly named “IsSatisfied” to carry out the test against a given object to see if it’s state indeed meets that that has been specified.</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">var productToTest = <span style="color: #0000ff;">new</span> Product(){Supplier = <span style="color: #0000ff;">new</span> Supplier()};
var satisfied = spec.IsSatisfiedBy(productToTest);</pre>
</div>
<p>This will code will obviously fail the specification test and IsSatisfiedBy() will return false. Whilst very useful in and of itself, the LINQ Expression enabled version / implementation of this pattern has some features that can be harnessed to apply a level of dynamism to the resolution of query predicates. Let’s have a closer look:</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">interface</span> ISpecification&lt;T&gt; : IQueryConfigurable
{
    Expression&lt;Func&lt;T, <span style="color: #0000ff;">bool</span>&gt;&gt; EvalPredicate { get; }
    Func&lt;T, <span style="color: #0000ff;">bool</span>&gt; EvalFunc { get; }
    <span style="color: #0000ff;">bool</span> IsSatisfiedBy(T entity);
}</pre>
</div>
<p>The interface details the contract to provide both the Expression and Func that will provide the computation required to discern whether a specification has been satisfied. Further to that, these new properties give us opportunities to plug predicates or lambdas into the machinery as well. Looking a little deeper under the covers of the proof of concept code we will find this in operation:</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">return</span> _ctx
       .CreateObjectSet&lt;TRole&gt;()
       .Where(predicate.EvalPredicate)
       .ToList();</pre>
</div>
<p>Through operator overloading, Specifications can also be combined for OR and AND conditions:</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">Specification&lt;Customer&gt; german_customer_spec =
    <span style="color: #0000ff;">new</span> Specification&lt;Customer&gt;(c =&gt; c.Country == “Germany”);

Specification&lt;Customer&gt; us_customer_spec =
    <span style="color: #0000ff;">new</span> Specification&lt;Customer&gt;(c =&gt; c.Country == “Usa”);

var comb_country_spec = (german_customer_spec | us_customer_spec);</pre>
</div>
<p>In the case where query predicates help to form a semi static business rule at the query level through filtering, it becomes a reasonably trivial task to deploy a new version or entirely new Specification for any given role, simply by deploying the library.</p>
<h3><span style="text-decoration: underline;"><span style="text-decoration: underline;"><span style="text-decoration: underline;">Quadrant </span>Position</span> 3.0 – Mapping</span></h3>
<p>Now to the latest part of the puzzle to be rolled into the Proof of concept, mapping. Entity Framework 4.0 (sometime after initial release) will be augmented by code only mapping (hallelujah). When one looks at the (current CTP) API for this functionality it becomes immediately evident that this too is something that can be very easily made deterministic by adding a layer of indirection to accommodate this role based approach. The out of the box mapping in EF 4.0 makes working in this manner quite simple given the possibilities provided by the EntityConfiguration&lt;T&gt; class. Here is a simple example:</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> CustomerMapping : EntityConfiguration&lt;ICustomer&gt;
{
    <span style="color: #0000ff;">public</span> CustomerMapping()
    {
        Property(c =&gt; c.CustomerId).IsIdentity();
        Property(c =&gt; c.FirstName).HasMaxLength(50).IsRequired();
        Property(c =&gt; c.LastName).HasMaxLength(50).IsRequired();
        Relationship(c =&gt; c.Orders).IsOptional();
        Relationship(c =&gt; c.Orders).FromProperty(o =&gt; o.Customer);
    }
}</pre>
</div>
<p>What’s required is to take this out of the box solution and add a layer of indirection requiring only a few new actors, an IMapping, an IMappingRole&lt;T&gt;  and a Mapping&lt;T&gt;.</p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/mappingrolesconcept.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="mappingRolesConcept" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/mappingrolesconcept-thumb.png" border="0" alt="mappingRolesConcept" width="397" height="365" /></a></p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">interface</span> IMapping
{
    Type EntityType { get; }
    <span style="color: #0000ff;">string</span> ObjectSetName { get; }
    StructuralTypeConfiguration Configuration { get; }
}

<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">interface</span> IMappingRole&lt;TRole&gt;
{
    IMapping[] Mappings { get; }
}

<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">abstract</span> <span style="color: #0000ff;">class</span> Mapping&lt;TEntity&gt; :
                      EntityConfiguration&lt;TEntity&gt;, IMapping
{
    <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">string</span> _objectSetName;

    <span style="color: #0000ff;">public</span> Type EntityType
    {
        get { <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">typeof</span>(TEntity); }
    }

    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> ObjectSetName
    {
        get { <span style="color: #0000ff;">return</span> _objectSetName; }
    }

    <span style="color: #0000ff;">public</span> Mapping(<span style="color: #0000ff;">string</span> objectSetName)
    {
        _objectSetName = objectSetName;
    }

    <span style="color: #0000ff;">public</span> StructuralTypeConfiguration Configuration
    {
        get { <span style="color: #0000ff;">return</span> (StructuralTypeConfiguration)<span style="color: #0000ff;">this</span>; }
    }
}</pre>
</div>
<p>The aggregation of IMapping’s in the Mapping Role will accommodate mapping an aggregate root with reference and collection entities. Here’s a more complete look that includes some implementing Mapping classes.</p>
<p><a href="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/mappingrolesclassdiag.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="mappingRolesClassDiag" src="http://www.simonsegal.net/blog/wp-content/uploads/2010/02/mappingrolesclassdiag-thumb.png" border="0" alt="mappingRolesClassDiag" width="496" height="517" /></a></p>
<p>Below is an example Mapping class, notice that we still need to use the actual Entity Type and not an interface. This is due to EntityConfiguration&lt;T&gt; lacking in support for interfaces (as of today, perhaps that will change or already has with RC 1).</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> ProductMapping : Mapping&lt;Product&gt;
{
    <span style="color: #0000ff;">public</span> ProductMapping(<span style="color: #0000ff;">string</span> objectSetName) : <span style="color: #0000ff;">base</span>(objectSetName)
    {
        Property(p =&gt; p.ProductID).IsIdentity();
        Property(p =&gt; p.ProductName).HasMaxLength(50).IsRequired();
        Property(p =&gt; p.UnitPrice).Precision = 19;
        Property(p =&gt; p.UnitPrice).Scale = 4;
        Relationship(p =&gt; p.Supplier).IsOptional();
        Relationship(p =&gt; p.Supplier).IsOptional().FromProperty(s =&gt; s.Products);
    }
}</pre>
</div>
<h3></h3>
<h3></h3>
<h3><span style="text-decoration: underline;"><span style="text-decoration: underline;"><span style="text-decoration: underline;">Quadrant </span>Position</span> 4.0 – The Repository</span></h3>
<p>The final square on the grid is the Repository. The repository offers nothing more than five overrides of the one method, Get&lt;T&gt;. The five versions of the method are to cover the variable requirements that might crop up when consumers wish to provide Fetching Strategies, Specifications and Entities (concrete ones) inline and directly to the infrastructure. Fetching Strategies are probably the least likely candidate for this requirement but it may come in useful, Specifications on the other hand will from time to time no doubt be populated dynamically from user input, served as part of a request or message and subsequently used as a filter parameter. Let’s have a brief look at the Interface:</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">interface</span> IRepository : IUnitOfWork
{
    IList&lt;TRole&gt; Get&lt;TRole&gt;();
    IList&lt;TRole&gt; Get&lt;TRole&gt;(IQueryConfigurable[] configurables);
    IList&lt;TRole&gt; Get&lt;TRole&gt;(ISpecification&lt;TRole&gt; predicateWhere)
                            <span style="color: #0000ff;">where</span> TRole : <span style="color: #0000ff;">class</span>;
    IList&lt;TRole&gt; Get&lt;TRole&gt;(IFetchingStrategy&lt;TRole&gt; strategy)
                            <span style="color: #0000ff;">where</span> TRole : <span style="color: #0000ff;">class</span>;
    IList&lt;TRole&gt; Get&lt;TRole&gt;(ISpecification&lt;TRole&gt; predicateWhere,
                            IFetchingStrategy&lt;TRole&gt; strategy)
                            <span style="color: #0000ff;">where</span> TRole : <span style="color: #0000ff;">class</span>;
    IoC IocContainer { set; }
    ObjectContext Session { set; }
}</pre>
</div>
<p>The first two versions of Get&lt;T&gt; will resolve as much as they can from the container, a Fetching Strategy, a Specification, the Mapping and will use the closest adjacent Entity type, all based on the identity of the generic parameter – that is, the ROLE. The last three versions of the Get&lt;T&gt; function is provided to work with the Entity Framework in a more familiar mode where and EDMX file can be specified, the concrete Entity Type itself is provided as the role parameter, we can also push through Fetching Strategies and Specifications ‘in-line’ in these scenarios. Probably not my preferred method but it’s available.</p>
<h2><span style="text-decoration: underline;">Configuration</span></h2>
<p>I decided at the death to implement a fluent configuration to prime the infrastructure and create a Repository. The fluent interface is designed with the view to keeping things compact and easy to setup.</p>
<h4><span style="text-decoration: underline;">Resolve it all</span></h4>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> resolves_everything_from_container()
{
    var compParams = <span style="color: #0000ff;">new</span> Dictionary&lt;<span style="color: #0000ff;">string</span>, <span style="color: #0000ff;">string</span>&gt;();
    compParams.Add(_conParamName, _connectionStringOnly);

    var repo = FetchSpec.Configure
                        .With(<span style="color: #0000ff;">new</span> StubIoc()
                            { ScannedAssemblyPath = _scannedAssemblyPath })
                        .AndBuildSession&lt;IRunOutDiscountForProducts&gt;(compParams)
                        .ForRepository();

    var products = repo.Get&lt;IRunOutDiscountForProducts&gt;();
}</pre>
<p>In this example above, we are using a stub for IoC, and hard wiring the scanned assembly path to find all the implementing Fetching Strategies, Specifications, Mappings etc. The default behaviour in the spiking code is to enumerate the assemblies with the executing processes deployment.</p>
<h3><span style="text-decoration: underline;">Provide it all</span></h3>
<p>For those that like the EDMX way of doing things and want to provide all the Fetching and Speciation instructions in line, this is the way to go about it:</p>
<div>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> CustomerBuyingStatusRepository : Repository
{
    <span style="color: #0000ff;">public</span> CustomerBuyingStatusRepository()
    {
        <span style="color: #008000;">//BEWARE THIS STRING WONT COMPILE ITS MESSED UP</span>
        <span style="color: #008000;">//FOR THE PURPOSE OF VIEWING IN THE BROWSER.</span>
        <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">string</span> constring = <span style="color: #006080;">&#8220;metadata=res://*/Northwind.csdl|res://*/&#8221;</span> +
                                 <span style="color: #006080;">&#8220;Northwind.ssdl|res://*/Northwind.msl;&#8221;</span> +
                                 <span style="color: #006080;">&#8220;provider=System.Data.SqlClient;provider &#8220;</span> +
                                 <span style="color: #006080;">&#8220;etc, etc, etc&#8221;</span>;

        <span style="color: #0000ff;">this</span>.IocContainer = <span style="color: #0000ff;">new</span> IoC();
        <span style="color: #0000ff;">this</span>.Session = <span style="color: #0000ff;">new</span> NorthwindEntities(constring);
    }
}

<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> using_concrete_repository_entity_and_inline_spec_and_fetching()
{
    var customersStartWithA =
        <span style="color: #0000ff;">new</span> Specification&lt;Customer&gt;(c =&gt; c.CompanyName.StartsWith(<span style="color: #006080;">&#8220;A&#8221;</span>));

    var fetch = <span style="color: #0000ff;">new</span> FetchingStrategy&lt;Customer&gt;(<span style="color: #0000ff;">true</span>);

    fetch.AddIntentions(<span style="color: #0000ff;">new</span> IEagerFetchingIntention[]
    {
        EagerFetchingIntention.CreateInstance&lt;Customer,
                                              ICollection&lt;IOrder&gt;&gt;(c =&gt; c.Orders)
    });

    var repo = <span style="color: #0000ff;">new</span> CustomerBuyingStatusRepository();

    var custs = repo.Get&lt;Customer&gt;(customersStartWithA, fetch);

    <span style="color: #0000ff;">foreach</span> (var cust <span style="color: #0000ff;">in</span> custs)
    {
        Console.WriteLine(cust.CompanyName);
        cust.MakePrefered();
    }
}</pre>
</div>
<p>I could have easily left out the ability to support this in-line method, given that the purpose of the spike was to proof the role based approach, having it’s greatest value proposition in being resolved dynamically against the Role. Nonetheless it is possible to mix and match or exclusively do either if you absolutely must. No prizes for guessing which mode I am more partial to, however I will reserve final judgement until it gets a good hit out in the real world, remember this is all the result of a brute force spiking effort.</p>
<h3><span style="text-decoration: underline;">What’s Left?</span></h3>
<p>In part 3.0 we will look at concurrency and throughput through the lens of a service layer. I will also make the code download available in part 3.0.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Living%20in%20the%20Tech%20Avalanche%20Generation&amp;siteurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F&amp;linkname=Helping%20Entity%20Framework%20v4.0%20play%20it%26rsquo%3Bs%20%3CROLE%3E%20-%20Part%202.0&amp;linkurl=http%3A%2F%2Fwww.simonsegal.net%2Fblog%2F2010%2F02%2F17%2Fhelping-entity-framework-v40-play-its-role-part-20%2F"><img src="http://www.simonsegal.net/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Helping Entity Framework v4.0 play it&rsquo;s <ROLE> - Part 2.0";
		a2a_linkurl="http://www.simonsegal.net/blog/2010/02/17/helping-entity-framework-v40-play-its-role-part-20/";
				a2a_show_title=1;    </script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p><p><a href="http://www.simonsegal.net/blog/2010/02/17/helping-entity-framework-v40-play-its-role-part-20/">Helping Entity Framework v4.0 play it&rsquo;s &lt;ROLE&gt; - Part 2.0</a> is a post from: <a href="http://www.simonsegal.net/blog">Living in the Tech Avalanche Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonsegal.net/blog/2010/02/17/helping-entity-framework-v40-play-its-role-part-20/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.966 seconds -->
<!-- Cached page served by WP-Cache -->

