<?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:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Kris.NET</title>
	<atom:link href="http://krisvandermotten.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://krisvandermotten.wordpress.com</link>
	<description>Kris Vandermotten's blog</description>
	<lastBuildDate>Tue, 06 Sep 2011 20:18:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='krisvandermotten.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Kris.NET</title>
		<link>http://krisvandermotten.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://krisvandermotten.wordpress.com/osd.xml" title="Kris.NET" />
	<atom:link rel='hub' href='http://krisvandermotten.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Properties with property changed event, part 3</title>
		<link>http://krisvandermotten.wordpress.com/2007/07/19/properties-with-property-changed-event-part-3/</link>
		<comments>http://krisvandermotten.wordpress.com/2007/07/19/properties-with-property-changed-event-part-3/#comments</comments>
		<pubDate>Thu, 19 Jul 2007 12:23:19 +0000</pubDate>
		<dc:creator>Kris Vandermotten</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2007/07/19/properties-with-property-changed-event-part-3/</guid>
		<description><![CDATA[A while ago, I talked about how to write basic events for changed properties, and about the INotifyPropertyChanged interface. There is a third way to manage events, which is especially useful when your class has many events, but you expect a very low number of them to be actually handled. As discussed before, every EventHandler [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=32&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div class="ExternalClassF882BC5F28834C288E355F4EBDFEC376">
<p>A while ago, I talked about how to write <a href="/Blogs/Kris/Lists/Posts/Post.aspx?ID=3">basic events for changed properties</a>, and about the <a href="/Blogs/Kris/Lists/Posts/Post.aspx?ID=5">INotifyPropertyChanged</a> interface. There is a third way to manage events, which is especially useful when your class has many events, but you expect a very low number of them to be actually handled.</p>
<p>As discussed before, every EventHandler stored in your object takes up space, which is a bit of a waste if most of those will be null. But events allow you to implement the add and remove methods yourself, so you can choose where to store the EventHandler delegate.</p>
<p>One way to do that is through the System.ComponentModel.EventHandlerList class. System.ComponentModel.Component exposes an Events property of this type, which is used by all classes inheriting from Component, including all Windows Forms controls.</p>
<p><a href="http://www.u2u.info/Blogs/Kris/Lists/Posts/Post.aspx?ID=13">See my U2U blog for a complete example</a>, featuring a CueBannerTextBox&nbsp;(like the Internet Explorer 7 search box)&nbsp;with a CueBanner property and a CueBannerChanged event.</p>
<div class="wlWriterSmartContent" style="display:inline;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/.NET" rel="tag">.NET</a>, <a href="http://technorati.com/tags/C#" rel="tag">C#</a>, <a href="http://technorati.com/tags/property" rel="tag">property</a>, <a href="http://technorati.com/tags/event" rel="tag">event</a>, <a href="http://technorati.com/tags/Vista" rel="tag">Vista</a>, <a href="http://technorati.com/tags/control" rel="tag">control</a></div>
</div>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/krisvandermotten.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/krisvandermotten.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/krisvandermotten.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/krisvandermotten.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/krisvandermotten.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/krisvandermotten.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/krisvandermotten.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/krisvandermotten.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/krisvandermotten.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/krisvandermotten.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/krisvandermotten.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/krisvandermotten.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/krisvandermotten.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/krisvandermotten.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/krisvandermotten.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/krisvandermotten.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=32&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://krisvandermotten.wordpress.com/2007/07/19/properties-with-property-changed-event-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2d1420515a7407d0b5867ad3fe6f37f0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Kris Vandermotten</media:title>
		</media:content>
	</item>
		<item>
		<title>Sending the LINQ To SQL log to the debugger output window</title>
		<link>http://krisvandermotten.wordpress.com/2007/05/06/sending-the-linq-to-sql-log-to-the-debugger-output-window/</link>
		<comments>http://krisvandermotten.wordpress.com/2007/05/06/sending-the-linq-to-sql-log-to-the-debugger-output-window/#comments</comments>
		<pubDate>Sat, 05 May 2007 23:39:53 +0000</pubDate>
		<dc:creator>Kris Vandermotten</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2007/05/06/sending-the-linq-to-sql-log-to-the-debugger-output-window/</guid>
		<description><![CDATA[I was playing with LINQ To SQL (again) this evening, and I thought: why can&#8217;t I see the generated SQL statments in my debugger output window? The DataContext.Log property is a great help to learn writing LINQ To SQL queries. All you need to do is assign a TextWriter to it, and you get to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=31&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was playing with LINQ To SQL (again) this evening, and I thought: why can&#8217;t I see the generated SQL statments in my debugger output window?</p>
<p>The DataContext.Log property is a great help to learn writing LINQ To SQL queries. All you need to do is assign a TextWriter to it, and you get to see al the SQL statements generated by the data context. But where do you send them to? Console.Out is an option, but you probably don&#8217;t want that in a release build. Furthermore, it doesn&#8217;t quite work for Windows services or ASP.NET applications. That&#8217;s why I wrote DebuggerWriter, an implementation of TextWriter that writes to the debugger log.</p>
<p>Find the code at <a href="http://blogs.u2u.net/kris/post/2007/03/14/Sending-the-LINQ-To-SQL-log-to-the-debugger-output-window.aspx">my U2U Blog</a>.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/krisvandermotten.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/krisvandermotten.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/krisvandermotten.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/krisvandermotten.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/krisvandermotten.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/krisvandermotten.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/krisvandermotten.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/krisvandermotten.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/krisvandermotten.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/krisvandermotten.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/krisvandermotten.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/krisvandermotten.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/krisvandermotten.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/krisvandermotten.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/krisvandermotten.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/krisvandermotten.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=31&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://krisvandermotten.wordpress.com/2007/05/06/sending-the-linq-to-sql-log-to-the-debugger-output-window/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2d1420515a7407d0b5867ad3fe6f37f0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Kris Vandermotten</media:title>
		</media:content>
	</item>
		<item>
		<title>Compiling Regular Expressions</title>
		<link>http://krisvandermotten.wordpress.com/2007/03/07/compiling-regular-expressions/</link>
		<comments>http://krisvandermotten.wordpress.com/2007/03/07/compiling-regular-expressions/#comments</comments>
		<pubDate>Tue, 06 Mar 2007 22:31:06 +0000</pubDate>
		<dc:creator>Kris Vandermotten</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2007/03/07/compiling-regular-expressions/</guid>
		<description><![CDATA[Update your bookmarks, new posts on .NET related stuff will be posted to http://www.u2u.info/Blogs/Kris/. The first new one to appear there is all about compiling regular expressions in .NET, with a free compiler tool to download. Enjoy reading.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=29&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Update your bookmarks, new posts on .NET related stuff will be posted to <a title="http://www.u2u.info/Blogs/Kris/" href="http://www.u2u.info/Blogs/Kris/">http://www.u2u.info/Blogs/Kris/</a>. The first new one to appear there is all about <a href="http://www.u2u.info/Blogs/Kris/Lists/Posts/Post.aspx?ID=10" target="_blank">compiling regular expressions</a> in .NET, with a free compiler tool to download. Enjoy reading.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/krisvandermotten.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/krisvandermotten.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/krisvandermotten.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/krisvandermotten.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/krisvandermotten.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/krisvandermotten.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/krisvandermotten.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/krisvandermotten.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/krisvandermotten.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/krisvandermotten.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/krisvandermotten.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/krisvandermotten.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/krisvandermotten.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/krisvandermotten.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/krisvandermotten.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/krisvandermotten.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=29&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://krisvandermotten.wordpress.com/2007/03/07/compiling-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2d1420515a7407d0b5867ad3fe6f37f0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Kris Vandermotten</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF/E preview and new Expression designers released</title>
		<link>http://krisvandermotten.wordpress.com/2006/12/05/wpfe-preview-and-new-expression-designers-released/</link>
		<comments>http://krisvandermotten.wordpress.com/2006/12/05/wpfe-preview-and-new-expression-designers-released/#comments</comments>
		<pubDate>Tue, 05 Dec 2006 20:45:35 +0000</pubDate>
		<dc:creator>Kris Vandermotten</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Internet Links]]></category>

		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/12/05/wpfe-preview-and-new-expression-designers-released/</guid>
		<description><![CDATA[Microsoft released the first CTP for WPF/E,&#160;short for&#160;Windows Presentation Foundation/Everywhere, a WPF&#160;subset to run in browsers (Firefox and IE on Windows, Firefox and Safari on the Mac). Broadly available for customers in the first half of 2007, “WPF/E” experiences will require a lightweight browser plug-in made freely available by Microsoft. Just in case you haven&#8217;t [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=28&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Microsoft <a href="http://msdn2.microsoft.com/en-us/asp.net/bb187358.aspx">released the first CTP for WPF/E</a>,&nbsp;short for&nbsp;Windows Presentation Foundation/Everywhere, a WPF&nbsp;subset to run in browsers (Firefox and IE on Windows, Firefox and Safari on the Mac). <em>Broadly available for customers in the first half of 2007, “WPF/E” experiences will require a lightweight browser plug-in made freely available by Microsoft.</em></p>
<p>Just in case you haven&#8217;t figured out yet who they are competing against, <a href="http://blogs.msdn.com/mswanson/">Michael Swanson</a> released a <a href="http://www.mikeswanson.com/swf2xaml/">free Macromedia Flash to WPF/E converter</a>&#8230;</p>
<p>Also this week, Microsoft released <a href="http://www.microsoft.com/products/expression/en/expression-blend/try.mspx">Expression Blend Beta 1</a> (formerly known as <em>Expression Interactive Designer</em>, a graphical WPF XAML editor) and <a href="http://www.microsoft.com/products/expression/en/expression-design/free-trial.mspx">Expression Design December 2006 CTP</a> (formerly known as <em>Expression Graphic Designer</em>).</p>
<p>Expression Blend looks good, though the first thing I did was&nbsp;change the default dark theme to the light theme, and decrease the workspace zoom to 90%. I need a bigger screen&#8230;</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/krisvandermotten.wordpress.com/28/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/krisvandermotten.wordpress.com/28/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/krisvandermotten.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/krisvandermotten.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/krisvandermotten.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/krisvandermotten.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/krisvandermotten.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/krisvandermotten.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/krisvandermotten.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/krisvandermotten.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/krisvandermotten.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/krisvandermotten.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/krisvandermotten.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/krisvandermotten.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/krisvandermotten.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/krisvandermotten.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=28&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://krisvandermotten.wordpress.com/2006/12/05/wpfe-preview-and-new-expression-designers-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2d1420515a7407d0b5867ad3fe6f37f0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Kris Vandermotten</media:title>
		</media:content>
	</item>
		<item>
		<title>Paint.NET V3 Beta 1 available</title>
		<link>http://krisvandermotten.wordpress.com/2006/12/01/paintnet-v3-beta-1-available/</link>
		<comments>http://krisvandermotten.wordpress.com/2006/12/01/paintnet-v3-beta-1-available/#comments</comments>
		<pubDate>Fri, 01 Dec 2006 17:54:30 +0000</pubDate>
		<dc:creator>Kris Vandermotten</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Internet Links]]></category>

		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/12/01/paintnet-v3-beta-1-available/</guid>
		<description><![CDATA[Rick released the first beta for Paint.NET V3. This version is now feature complete, and all known&#160;bugs have been fixed. The coolest new feature in this release is a Perlin noise based clouds renderer, with &#8211; as usual &#8211; a very easy to use configuration panel. I&#8217;d say it&#8217;s about time you uninstall that cracked [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=26&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Rick <a href="http://blogs.msdn.com/rickbrew/archive/2006/11/30/paint-net-v3-0-beta-1-is-now-available.aspx">released the first beta for Paint.NET V3</a>. This version is now feature complete, and all known&nbsp;bugs have been fixed. The coolest new feature in this release is a Perlin noise based clouds renderer, with &#8211; as usual &#8211; a very easy to use configuration panel.</p>
<p align="center"><a href="http://www.getpaint.net/screenshots/pdn30_camaro.jpg"><img src="http://www.getpaint.net/screenshots/pdn30_camaro_thumb.jpg"></a></p>
<p align="left">I&#8217;d say it&#8217;s about time you uninstall that cracked Photoshop!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/krisvandermotten.wordpress.com/26/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/krisvandermotten.wordpress.com/26/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/krisvandermotten.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/krisvandermotten.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/krisvandermotten.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/krisvandermotten.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/krisvandermotten.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/krisvandermotten.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/krisvandermotten.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/krisvandermotten.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/krisvandermotten.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/krisvandermotten.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/krisvandermotten.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/krisvandermotten.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/krisvandermotten.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/krisvandermotten.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=26&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://krisvandermotten.wordpress.com/2006/12/01/paintnet-v3-beta-1-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2d1420515a7407d0b5867ad3fe6f37f0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Kris Vandermotten</media:title>
		</media:content>

		<media:content url="http://www.getpaint.net/screenshots/pdn30_camaro_thumb.jpg" medium="image" />
	</item>
		<item>
		<title>Linq to XSD preview released</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/30/linq-to-xsd-preview-released/</link>
		<comments>http://krisvandermotten.wordpress.com/2006/11/30/linq-to-xsd-preview-released/#comments</comments>
		<pubDate>Wed, 29 Nov 2006 22:43:50 +0000</pubDate>
		<dc:creator>Kris Vandermotten</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Internet Links]]></category>
		<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/30/linq-to-xsd-preview-released/</guid>
		<description><![CDATA[Last Monday, the Microsoft XML Team released the first&#160;Linq to XSD preview. While the LINQ to XML programmer operates on generic XML trees, the LINQ to XSD programmer operates on typed XML trees &#8212; instances of .NET types that model the XML types of a specific XML schema (XSD). [...]&#160;LINQ to XSD is integrated into [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=23&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last Monday, the Microsoft XML Team <a href="http://blogs.msdn.com/xmlteam/archive/2006/11/27/typed-xml-programmer-welcome-to-linq.aspx" target="_blank">released the first&nbsp;Linq to XSD preview</a>.</p>
<p><em>While the LINQ to XML programmer operates on generic XML trees, the LINQ to XSD programmer operates on typed XML trees &#8212; instances of .NET types that model the XML types of a specific XML schema (XSD). [...]&nbsp;LINQ to XSD is integrated into Visual Studio; so you just tag an XML schema as [a] ‘LINQ to XSD schema’, build your project, and the automatically derived object model is then part of your solution &#8212; just as if XML schemas were .NET types.</em></p>
<p>I only had a quick look, but I have to say it looks very promissing! Send them your feedback, but hurry, I want this to be included in Visual Studio Orcas.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/krisvandermotten.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/krisvandermotten.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/krisvandermotten.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/krisvandermotten.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/krisvandermotten.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/krisvandermotten.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/krisvandermotten.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/krisvandermotten.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/krisvandermotten.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/krisvandermotten.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/krisvandermotten.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/krisvandermotten.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/krisvandermotten.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/krisvandermotten.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/krisvandermotten.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/krisvandermotten.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=23&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://krisvandermotten.wordpress.com/2006/11/30/linq-to-xsd-preview-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2d1420515a7407d0b5867ad3fe6f37f0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Kris Vandermotten</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a Data Access Layer with Linq to SQL, part 2</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/</link>
		<comments>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comments</comments>
		<pubDate>Wed, 29 Nov 2006 22:15:00 +0000</pubDate>
		<dc:creator>Kris Vandermotten</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/</guid>
		<description><![CDATA[Last time, we looked at how Linq To SQL might impact how we think about what a Data Access Layer (DAL) is, based on the dependencies between assemblies. This time, we&#8217;ll take a different approach: let&#8217;s look at typical Linq to SQL code, and try to decide where to put it. I&#8217;ll use a code [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=22&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://krisvandermotten.wordpress.com/2006/11/19/creating-a-data-access-layer-with-linq-to-sql-part-1/">Last time</a>, we looked at how Linq To SQL might impact how we think about what a Data Access Layer (DAL) is, based on the dependencies between assemblies. This time, we&#8217;ll take a different approach: let&#8217;s look at typical Linq to SQL code, and try to decide where to put it. I&#8217;ll use a code sample from the &#8220;DLinq Overview for CSharp Developers&#8221; document included in the Linq May CTP (in C# 3.0, but the same applies to VB9).</p>
<p><span id="more-22"></span><br />
<h3>A simple start</h3>
<p>Let&#8217;s take a look at the following code:</p>
<pre><font color="#408080">Northwind</font> db = <span style="color:#0000ff;">new</span> <font color="#408080">Northwind</font>(@"<span style="color:#8b0000;">c:\\northwind\\northwnd.mdf</span>");

<font color="#0000ff">var</font> q = <font color="#0000ff">from</font> c <span style="color:#0000ff;">in</span> db.Customers
<font color="#0000ff">        where</font> c.City == "<span style="color:#8b0000;">London</span>"
<font color="#0000ff">        select</font> c;

<span style="color:#0000ff;">foreach</span> (<font color="#0000ff">var</font> cust <span style="color:#0000ff;">in</span> q)
<font color="#408080">  Console</font>.WriteLine("<span style="color:#8b0000;">id = {0}, City = {1}</span>", cust.CustomerID, cust.City);</pre>
<p>It should be clear that the first line belongs in the DAL. The DataContext encapsulates a database connection, and knows about the physical location of the database. That is not something that higher layers should know about.</p>
<p>Let&#8217;s say the actual query definition belongs in the DAL too, but clearly, the foreach loop sits in some higher layer. That means the two first statements need to be encapsulated in some function in the DAL, for example as follows (sticking with the &#8220;Entity Access Layer&#8221; terminology <a href="http://krisvandermotten.wordpress.com/2006/11/19/creating-a-data-access-layer-with-linq-to-sql-part-1/">introduced before</a>):</p>
<pre><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> CustomersEal
{
  <span style="color:#0000ff;">private</span> <font color="#408080">Northwind</font> db = <span style="color:#0000ff;">new</span> <font color="#408080">Northwind</font>(@"<span style="color:#8b0000;">c:\\northwind\\northwnd.mdf</span>");

  <span style="color:#0000ff;">public</span> <font color="#408080">IQueryable&lt;Customer&gt;</font> GetCustomersByCity(<span style="color:#0000ff;">string</span> city)
  {
    <span style="color:#0000ff;">return</span> <font color="#0000ff">from</font> c <span style="color:#0000ff;">in</span> db.Customers
           <font color="#0000ff">where</font> c.City == city
           <font color="#0000ff">select</font> c;
  }
}</pre>
<p>The business layer then contains the following code:</p>
<pre><font color="#408080">CustomersEal</font> customersEal = <span style="color:#0000ff;">new</span> <font color="#408080">CustomersEal</font>();

<span style="color:#0000ff;">foreach</span> (<font color="#0000ff">var</font> cust <span style="color:#0000ff;">in</span> customersEal.GetCustomersByCity("<span style="color:#8b0000;">London</span>"))
<font color="#408080">  Console</font>.WriteLine("<span style="color:#8b0000;">id = {0}, City = {1}</span>", cust.CustomerID, cust.City);</pre>
<p>Looks good, doesn&#8217;t it? All the business layer knows about the database, is that it can return Customer objects.</p>
<h3>Problems</h3>
<p>But wait, what if I write the following in my business layer:</p>
<pre>CustomersEal customersEal = <span style="color:#0000ff;">new</span> CustomersEal();

<font color="#0000ff">var</font> q = <font color="#0000ff">from</font> c <span style="color:#0000ff;">in</span> customersEal.GetCustomersByCity("<span style="color:#8b0000;">London</span>")
        <font color="#0000ff">orderby</font> c.ContactNamer
        <font color="#0000ff">select new</font> { c.CustomerID, c.City }; 

<span style="color:#0000ff;">foreach</span> (var cust <span style="color:#0000ff;">in</span> q)
<font color="#408080">  Console</font>.WriteLine("<span style="color:#8b0000;">id = {0}, City = {1}</span>", cust.CustomerID, cust.City);</pre>
<p>This code highlights a few interesting facts.</p>
<p>First of all, it wasn&#8217;t the DAL that executed the query, at least not in the traditional sense of the word. The DAL (CustomersEal to be precise) merely <em>supplied the definition</em> for the query. The query got <em>executed</em> when the foreach statement started looping over the result! In a traditional DAL, a call to a method like GetCustomersByCity would have executed the query, but not with Linq, at least not if we implement our code like this.</p>
<p>Secondly, the business layer can <em>refine the query definition</em>. This definitely has some advantages, but I realize some might argue that this is really bad. Note though, that the business layer cannot <em>redefine</em> the query, or execute just any query it wants. Or can it?&nbsp;You need the DataContext to start the process, and only the DAL has access to that, right? In fact, the Entity Layer generated by SQLMetal is referenced by the business layer too, it needs it to get to the definitions of the entities!</p>
<p>Thirdly, it is absolutely not clear where a developer should draw the line between what&#8217;s business logic, and what belongs in the DAL. I could have moved the orderby into the DAL (especially if I always want customers to be ordered by their ContactName). But likewise, I could have moved the where clause to the business layer! How do I decide what to do?</p>
<p>I hate it when developers have to make choices like that during routine development. Choosing takes time, and that&#8217;s not likely to improve productivity. But much worse is the fact that different developers will make different choices. Even a single developer may make different choices from one day to the next. That leads to inconsistencies in the code. Developers will spend more time trying to understand the code they&#8217;re reading, because it doesn&#8217;t always follow the same pattern. That&#8217;s bad for productivity. In the worst case scenario, developers start rewriting each other&#8217;s code, just so it matches their choice of the day. That kills productivity. (Wasn&#8217;t Linq all about <em>improving</em> productivity?)</p>
<h3>The solution?</h3>
<p>We need a clear and simple criterion to decide which code goes where.</p>
<p>Note that the absolute minimum for a DAL is the following:</p>
</p>
<pre><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> CustomersEal
{
  <span style="color:#0000ff;">private</span> <font color="#408080">Northwind</font> db = <span style="color:#0000ff;">new</span> <font color="#408080">Northwind</font>(@"<span style="color:#8b0000;">c:\\northwind\\northwnd.mdf</span>");

  <span style="color:#0000ff;">public</span> <font color="#408080">IQueryable&lt;Customer&gt;</font> GetCustomers()
  {
    <span style="color:#0000ff;">return</span> db.Customers;
  }
}</pre>
<p>It&#8217;s a bit silly of course, if that&#8217;s all this layer does, we might just as well skip it (the&nbsp;connection string should be externalized in a configuration file anyway, and a default constructor that reads the connection string from the config file should be added to the Northwind DataContext in a partial class).&nbsp;Silly or not,&nbsp;it is a &#8220;lower bound&#8221; to an EAL as we have defined it here. I believe there&#8217;s an &#8220;upper bound&#8221; too:&nbsp;I think the DAL shouldn&#8217;t do projections (well, it definitely&nbsp;should not expose anonymous types). But that still leaves us with a very broad range. How to make a choice?</p>
<p>I&#8217;m inclined to say that the only way to make a clear and simple choice once and for all, it to go with the minimalist approach. And indeed, that means we don&#8217;t need/write/use an Entity Access Layer. The business logic directly accesses the one assembly generated by SQLMetal.</p>
<p>How&#8217;s that for a DAL?</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/krisvandermotten.wordpress.com/22/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/krisvandermotten.wordpress.com/22/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/krisvandermotten.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/krisvandermotten.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/krisvandermotten.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/krisvandermotten.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/krisvandermotten.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/krisvandermotten.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/krisvandermotten.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/krisvandermotten.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/krisvandermotten.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/krisvandermotten.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/krisvandermotten.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/krisvandermotten.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/krisvandermotten.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/krisvandermotten.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=22&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2d1420515a7407d0b5867ad3fe6f37f0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Kris Vandermotten</media:title>
		</media:content>
	</item>
		<item>
		<title>Amazing XAML</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/24/amazing-xaml/</link>
		<comments>http://krisvandermotten.wordpress.com/2006/11/24/amazing-xaml/#comments</comments>
		<pubDate>Fri, 24 Nov 2006 08:31:36 +0000</pubDate>
		<dc:creator>Kris Vandermotten</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Internet Links]]></category>

		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/24/amazing-xaml/</guid>
		<description><![CDATA[Since the .NET Framework 3.0 has been released, the interest is Windows Presentation Foundation (WPF) and XAML is growing. A good understanding of XAML and how it works is essential to understand WPF. A while back, Peter Himschoot wrote an excellent article about it: Amazing XAML.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=21&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Since the .NET Framework 3.0 has been released, the interest is Windows Presentation Foundation (WPF) and XAML is growing. A good understanding of XAML and how it works is essential to understand WPF. A while back, <a href="http://www.u2u.be/res/Peter.aspx">Peter Himschoot</a> wrote an excellent article about it: <a href="http://www.u2u.be/Article.aspx?ART=Amazing%20XAML">Amazing XAML</a>.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/krisvandermotten.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/krisvandermotten.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/krisvandermotten.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/krisvandermotten.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/krisvandermotten.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/krisvandermotten.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/krisvandermotten.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/krisvandermotten.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/krisvandermotten.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/krisvandermotten.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/krisvandermotten.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/krisvandermotten.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/krisvandermotten.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/krisvandermotten.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/krisvandermotten.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/krisvandermotten.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=21&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://krisvandermotten.wordpress.com/2006/11/24/amazing-xaml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2d1420515a7407d0b5867ad3fe6f37f0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Kris Vandermotten</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting started with Windows Presentation Foundation (WPF)</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/21/getting-started-with-windows-presentation-foundation-wpf/</link>
		<comments>http://krisvandermotten.wordpress.com/2006/11/21/getting-started-with-windows-presentation-foundation-wpf/#comments</comments>
		<pubDate>Mon, 20 Nov 2006 22:25:54 +0000</pubDate>
		<dc:creator>Kris Vandermotten</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Internet Links]]></category>

		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/21/getting-started-with-windows-presentation-foundation-wpf/</guid>
		<description><![CDATA[Josh Smith compiled a list of links to WPF resources to help you get started. Oddly enough, he didn&#8217;t mention Microsoft&#8217;s Expression Interactive Designer, you might want to take a look at that as well.&#160;Thanks for the list Josh.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=20&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Josh Smith compiled a <a href="http://www.infusionblogs.com/blogs/jsmith/archive/2006/11/12/1703.aspx">list of links to WPF resources</a> to help you get started. Oddly enough, he didn&#8217;t mention Microsoft&#8217;s <a href="http://www.microsoft.com/products/expression/en/interactive_designer/default.mspx">Expression Interactive Designer</a>, you might want to take a look at that as well.&nbsp;Thanks for the list Josh.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/krisvandermotten.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/krisvandermotten.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/krisvandermotten.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/krisvandermotten.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/krisvandermotten.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/krisvandermotten.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/krisvandermotten.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/krisvandermotten.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/krisvandermotten.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/krisvandermotten.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/krisvandermotten.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/krisvandermotten.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/krisvandermotten.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/krisvandermotten.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/krisvandermotten.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/krisvandermotten.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=20&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://krisvandermotten.wordpress.com/2006/11/21/getting-started-with-windows-presentation-foundation-wpf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2d1420515a7407d0b5867ad3fe6f37f0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Kris Vandermotten</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a Data Access Layer with Linq to SQL, part 1</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/19/creating-a-data-access-layer-with-linq-to-sql-part-1/</link>
		<comments>http://krisvandermotten.wordpress.com/2006/11/19/creating-a-data-access-layer-with-linq-to-sql-part-1/#comments</comments>
		<pubDate>Sun, 19 Nov 2006 14:36:23 +0000</pubDate>
		<dc:creator>Kris Vandermotten</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/19/creating-a-data-access-layer-with-linq-to-sql-part-1/</guid>
		<description><![CDATA[There is no doubt that Linq to SQL will have an enormous impact on the way we write data access layers. I wouldn&#8217;t be surprised to find out that the impact is so profound, that we might even have to reconsider the very nature of a data access layer. In fact, what is a data [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=19&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There is no doubt that <a href="http://msdn.microsoft.com/data/ref/linq/">Linq to SQL</a> will have an enormous impact on the way we write data access layers. I wouldn&#8217;t be surprised to find out that the impact is so profound, that we might even have to reconsider the very nature of a data access layer. In fact, what is a data access layer (DAL) anyway?</p>
<p><span id="more-19"></span>
<p>Let&#8217;s start by trying to create a (working) definition of a DAL. Wikipedia is usually a good place to start, but you&#8217;ll find that the <a href="http://en.wikipedia.org/wiki/Data_access_layer">Wikipedia article on DAL&#8217;s</a> doesn&#8217;t exactly contain all the answers. So let&#8217; give it a try ourselves.</p>
<p>A DAL is a <em>layer</em>. That means its part of a layered architecture. Other layers use the DAL to do <em>data access</em>. Indeed, the DAL is the layer accessing the data (and in the context of Linq to SQL, that&#8217;s relational data), and no other layers access the data directly.</p>
<p>That&#8217;s a good start, but what is layer? Is that a special kind of component? Not in my mind it isn&#8217;t. To me, a layer can contain multiple components, and that applies to a DAL as well. Let&#8217;s say I have a simple banking system. It contains functionality on clients, their accounts, and the operations (such as money transfers) they do on those accounts. That might result in a vertical partitioning of the application in three modules, &#8220;Clients&#8221;, &#8220;Accounts&#8221; and &#8220;Operations&#8221;. Each of those would be layered, and you&#8217;d find components at the intersections of the vertical modules and the horizontal layers. So you&#8217;d have&nbsp;&#8221;Clients DAL&#8221;, &#8220;Accounts DAL&#8221; and &#8220;Operations DAL&#8221; components. Obviously, these components are related, they have dependencies between them. The Operations DAL depends upon the Accounts DAL (and possibly the Clients DAL as well), and the&nbsp;accounts DAL&nbsp;depends on the Clients DAL.</p>
<p>In .NET, components like these correspond to assemblies. So our DAL would consist of several assemblies, with (non-circular) references (dependencies)&nbsp;to each other. Which part of the functionality do we put where?</p>
<p>The Clients DAL doesn&#8217;t know about accounts, that&#8217;s the responsibility of the Accounts DAL. That one knows about accounts, and about clients as well. After all, accounts are owned by clients. So that means the function to retrieve the list of accounts belonging to a given client sits in the Accounts DAL, not in the Clients DAL. Since this function has a client as a parameter (or at least a client id), the Accounts DAL may indeed need a reference to the Clients DAL. Each object returned by this function has a reference to the client owning the account, or at least the id of that client.</p>
<p>But wait, what&#8217;s the impact of Linq to SQL on what I said so far? If I have a database with Clients and Accounts tables (amongst many others) with a foreign key between them, the typical Client and Account entity classes will have a relationship between them as well. The Account class will have a delay-loaded Client property, and the Client class will have an Accounts property. That&#8217;s a mutual dependency, so these two classes need to sit in the same assembly. But where does that lead us to? Typically, all tables in a database are somehow related to each other, i.e. there are no disconnected islands of tables with relations between them, but no relations to other islands&nbsp;in the database. But that leads us to just one DAL per database! Is that what we want?</p>
<p>Well, SQLMetal, the Linq to SQL tool that generates an entity model based on a database schema, definitely pushes us in that direction. Typically, it generates one source code file containing one DataContext and all the entities in your data model. But that&#8217;s just the entities though, that code doesn&#8217;t do any data access! To actually access the data, you need to write queries! And those queries are the responsibility of our DAL components.</p>
<p>In our example above, we had three DAL components, and all three of them would access the same DataContext. That implies that the DataContext should exist in an assembly of its own, an assembly underlying all DAL assemblies. But that&#8217;s an additional layer, isn&#8217;t it?</p>
<p>Well maybe it is. Maybe we need to split our traditional Data Access Layer into two distinct sublayers. For lack of better terms, I&#8217;ll call them the &#8220;Entity Layer&#8221; and the &#8220;Entity Access Layer&#8221;.</p>
<p>The Entity Layer has just one assembly in it, so we might just as well refer to that assembly as the Entity Layer as well. The entire assembly is compiled from just one code file (and some housekeeping stuff perhaps, like an AssemblyInfo.cs file), generated by SQLMetal.</p>
<p>The Entity Access Layer (EAL) has several assemblies (three in our example), all using the Entity Layer. The EAL assemblies contain the actual queries.</p>
<p align="center"><img style="border-width:0;" height="204" src="http://krisvandermotten.files.wordpress.com/2006/11/WindowsLiveWriter/CreatingaDataAccessLayerwithLinqtoSQLpar_13D46/DAL%5B4%5D.png?w=400&#038;h=204" width="400" border="0"> </p>
<p>Next time, we&#8217;ll look at the interface between the EAL assemblies and the business layer: what parameters are used, what results are returned? Do we expose the Entity Layer types? Do we expose query expressions or query results only? </p>
<p>That&#8217;s enough food for thought right now, and comments are more than welcome. </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/krisvandermotten.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/krisvandermotten.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/krisvandermotten.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/krisvandermotten.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/krisvandermotten.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/krisvandermotten.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/krisvandermotten.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/krisvandermotten.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/krisvandermotten.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/krisvandermotten.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/krisvandermotten.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/krisvandermotten.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/krisvandermotten.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/krisvandermotten.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/krisvandermotten.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/krisvandermotten.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=krisvandermotten.wordpress.com&amp;blog=484055&amp;post=19&amp;subd=krisvandermotten&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://krisvandermotten.wordpress.com/2006/11/19/creating-a-data-access-layer-with-linq-to-sql-part-1/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2d1420515a7407d0b5867ad3fe6f37f0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Kris Vandermotten</media:title>
		</media:content>

		<media:content url="http://krisvandermotten.files.wordpress.com/2006/11/WindowsLiveWriter/CreatingaDataAccessLayerwithLinqtoSQLpar_13D46/DAL%5B4%5D.png" medium="image" />
	</item>
	</channel>
</rss>
