<?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/"
	>

<channel>
	<title>Brian Hartsock&#039;s Blog &#187; ASP.NET</title>
	<atom:link href="http://blog.brianhartsock.com/category/programming/aspnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.brianhartsock.com</link>
	<description>The exciting life of a software developer and nerd</description>
	<lastBuildDate>Thu, 29 Jul 2010 02:40:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to actually use trigonometry in web applications</title>
		<link>http://blog.brianhartsock.com/2008/06/18/how-to-actually-use-trigonometry-in-web-applications/</link>
		<comments>http://blog.brianhartsock.com/2008/06/18/how-to-actually-use-trigonometry-in-web-applications/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 14:37:47 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/?p=100</guid>
		<description><![CDATA[Disclaimer: my teammate Dellanoce actually coded this, but is too cool to blog, so I am blogging for him. Mailtrust has many different customers, some of which like to have their own branded control panel or webmail interface. We allow them to customize many different facets of the user interface, including colors. This has some [...]]]></description>
			<content:encoded><![CDATA[<p>Disclaimer: my teammate Dellanoce actually coded this, but is too cool to blog, so I am blogging for him.</p>
<p><a href="http://www.mailtrust.com">Mailtrust</a> has many different customers, some of which like to have their own branded control panel or webmail interface.  We allow them to customize many different facets of the user interface, including colors.  This has some unintended consequences though.  Sometimes, a user might select a white font color on top of a white background.  This in turns causes support to get involved in fixing the problem, which wastes time on such a trivial problem.</p>
<p>But there is a better way.  Use trigonometry, or more specifically the Pythagorean theorem!  I had no idea how this worked, but Dellanoce coded up a few lines of C# to compare two colors.  It returns a distance value which can be compared to a threshold value you can set.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">double</span> ColorDifference<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> htmlColor1, <span style="color: #FF0000;">string</span> htmlColor2<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            Color color1 <span style="color: #008000;">=</span> ColorTranslator.<span style="color: #0000FF;">FromHtml</span><span style="color: #000000;">&#40;</span>htmlColor1<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            Color color2 <span style="color: #008000;">=</span> ColorTranslator.<span style="color: #0000FF;">FromHtml</span><span style="color: #000000;">&#40;</span>htmlColor2<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #FF0000;">double</span> rDiff <span style="color: #008000;">=</span> Convert.<span style="color: #0000FF;">ToDouble</span><span style="color: #000000;">&#40;</span>color1.<span style="color: #0000FF;">R</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">-</span> Convert.<span style="color: #0000FF;">ToDouble</span><span style="color: #000000;">&#40;</span>color2.<span style="color: #0000FF;">R</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">double</span> gDiff <span style="color: #008000;">=</span> Convert.<span style="color: #0000FF;">ToDouble</span><span style="color: #000000;">&#40;</span>color1.<span style="color: #0000FF;">G</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">-</span> Convert.<span style="color: #0000FF;">ToDouble</span><span style="color: #000000;">&#40;</span>color2.<span style="color: #0000FF;">G</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">double</span> bDiff <span style="color: #008000;">=</span> Convert.<span style="color: #0000FF;">ToDouble</span><span style="color: #000000;">&#40;</span>color1.<span style="color: #0000FF;">B</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">-</span> Convert.<span style="color: #0000FF;">ToDouble</span><span style="color: #000000;">&#40;</span>color2.<span style="color: #0000FF;">B</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF;">return</span> Math.<span style="color: #0000FF;">Sqrt</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>rDiff <span style="color: #008000;">*</span> rDiff<span style="color: #000000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #000000;">&#40;</span>gDiff <span style="color: #008000;">*</span> gDiff<span style="color: #000000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #000000;">&#40;</span>bDiff <span style="color: #008000;">*</span> bDiff<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>I was quite impressed with the simplicity and elegance this solution provided.  I should probably go give my, or his, trig teacher a hug.  </p>
<p>If you want to learn more about how powerful Pythagorean theorem is to compare distance values of really any type of object, check this <a href="http://betterexplained.com/articles/measure-any-distance-with-the-pythagorean-theorem/">article</a> out.</p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+How+to+actually+use+trigonometry+in+web+applications+http://bit.ly/2kTrvq" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2008/06/18/how-to-actually-use-trigonometry-in-web-applications/&amp;title=How+to+actually+use+trigonometry+in+web+applications" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2008/06/18/how-to-actually-use-trigonometry-in-web-applications/&amp;t=How+to+actually+use+trigonometry+in+web+applications" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2008/06/18/how-to-actually-use-trigonometry-in-web-applications/&amp;title=How+to+actually+use+trigonometry+in+web+applications" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2008/06/18/how-to-actually-use-trigonometry-in-web-applications/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CallContext isn&#8217;t the greatest thing since sliced bread</title>
		<link>http://blog.brianhartsock.com/2008/06/12/callcontext-isnt-the-greatest-thing-since-sliced-bread/</link>
		<comments>http://blog.brianhartsock.com/2008/06/12/callcontext-isnt-the-greatest-thing-since-sliced-bread/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 14:57:55 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/?p=99</guid>
		<description><![CDATA[In ASP.NET, it is quite common to need to store information in the context of a single web request. For example, a NHibernate session should usually exist for one web request. HttpContext is the tool for accomplishing this. But what happens when you have code embedded in business logic that might not always be running [...]]]></description>
			<content:encoded><![CDATA[<p>In ASP.NET, it is quite common to need to store information in the context of a single web request.  For example, a NHibernate session should usually exist for one web request.  <em>HttpContext</em> is the tool for accomplishing this.</p>
<p>But what happens when you have code embedded in business logic that might not always be running in an ASP.NET web application?  <em>HttpContext</em> isn&#8217;t valid, so you can&#8217;t use it.  Why not use <em>CallContext</em>, since <em>HttpContext</em> uses this anyways? </p>
<p>I was starting to convert some of my code to use this, when I found this <a href="http://piers7.blogspot.com/2005/11/threadstatic-callcontext-and_02.html">article</a>.  Apparently doing this works most of the time but can cause some nasty bugs since ASP.NET can switch <em>HttpContext</em>&#8216;s without switching <em>CallContext</em>&#8216;s.</p>
<p>Instead, code that could be called from ASP.NET and other applications should first check for context.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">if</span><span style="color: #000000;">&#40;</span>HttpContext.<span style="color: #0000FF;">Current</span> <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
     <span style="color: #008080; font-style: italic;">//Using CallContext example since not in ASP.NET</span>
     CallContext.<span style="color: #0000FF;">SetData</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;blah&quot;</span>, <span style="color: #008000;">new</span> <span style="color: #FF0000;">object</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
     <span style="color: #FF0000;">object</span> contextData <span style="color: #008000;">=</span> CallContext.<span style="color: #0000FF;">GetData</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;blah&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #0600FF;">else</span>
<span style="color: #000000;">&#123;</span>
     <span style="color: #008080; font-style: italic;">//Using HttpContext example since in ASP.NET</span>
     HttpContext.<span style="color: #0000FF;">Current</span>.<span style="color: #0000FF;">Items</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;blah&quot;</span>, <span style="color: #008000;">new</span> <span style="color: #FF0000;">object</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
     <span style="color: #FF0000;">object</span> contextData <span style="color: #008000;">=</span> HttpContext.<span style="color: #0000FF;">Current</span>.<span style="color: #0000FF;">Items</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;blah&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>In fact, I will probably end up writing a static class to implement this so code doesn&#8217;t have to constantly check whether or not in an ASP.NET session.</p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+CallContext+isn%E2%80%99t+the+greatest+thing+since+sliced+bread+http://bit.ly/d5q0R" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2008/06/12/callcontext-isnt-the-greatest-thing-since-sliced-bread/&amp;title=CallContext+isn%E2%80%99t+the+greatest+thing+since+sliced+bread" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2008/06/12/callcontext-isnt-the-greatest-thing-since-sliced-bread/&amp;t=CallContext+isn%E2%80%99t+the+greatest+thing+since+sliced+bread" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2008/06/12/callcontext-isnt-the-greatest-thing-since-sliced-bread/&amp;title=CallContext+isn%E2%80%99t+the+greatest+thing+since+sliced+bread" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2008/06/12/callcontext-isnt-the-greatest-thing-since-sliced-bread/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Policy Inject Me</title>
		<link>http://blog.brianhartsock.com/2008/05/01/policy-inject-me/</link>
		<comments>http://blog.brianhartsock.com/2008/05/01/policy-inject-me/#comments</comments>
		<pubDate>Thu, 01 May 2008 17:00:35 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/?p=95</guid>
		<description><![CDATA[I just started using the Policy Injection Application Block from Microsoft&#8217;s Enterprise library. At first, I thought it was worthless and overly complex. I was wrong. It is a very powerful programming tool that allows me to develop a lot faster and cleaner. Policy Injection is similar to aspect-oriented programming in that it helps to [...]]]></description>
			<content:encoded><![CDATA[<p>I just started using the Policy Injection Application Block from Microsoft&#8217;s <a href="http://www.codeplex.com/entlib">Enterprise library</a>.  At first, I thought it was worthless and overly complex.  I was wrong.  It is a very powerful programming tool that allows me to develop a lot faster and cleaner.</p>
<p>Policy Injection is similar to <a href="http://en.wikipedia.org/wiki/Aspect_%28computer_science%29">aspect-oriented programming</a> in that it helps to break away <a href="http://en.wikipedia.org/wiki/Cross-cutting_concern">cross-cutting concerns</a> (authorization, logging) from the actual business logic.  And yes, I basically copied that from the documentation.</p>
<p>Here is what policy injection means for me.  I can build business logic, which performs only what I want it to.  So I can have a function called <em>AddUser</em> and all that is done is the actual operation of adding that user.  I can then attach policies to that function, which specify how to authorize and log it.  This has a couple effects.  One, it reduces the amount of code which in turn cleans up the code.  Second, it allows me to customize cross-cutting concerns for different projects.  If I have an administrative application, I need to authorize differently than a user application.  Policy injection makes this possible without dirtying up the code.</p>
<p>After the initial few hours of getting used to using it, I am a huge proponent.  I definitely recommend checking it out.</p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+Policy+Inject+Me+http://bit.ly/xd6uu" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2008/05/01/policy-inject-me/&amp;title=Policy+Inject+Me" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2008/05/01/policy-inject-me/&amp;t=Policy+Inject+Me" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2008/05/01/policy-inject-me/&amp;title=Policy+Inject+Me" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2008/05/01/policy-inject-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NHibernate O/R Mapper: Part 2</title>
		<link>http://blog.brianhartsock.com/2008/02/10/nhibernate-or-mapper-part-2/</link>
		<comments>http://blog.brianhartsock.com/2008/02/10/nhibernate-or-mapper-part-2/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 00:32:01 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/2008/02/10/nhibernate-or-mapper-part-2/</guid>
		<description><![CDATA[In a previous post I talked about my first impressions of NHibernate. Not a whole lot has changed since then, except I have learned a lot more. But, I said I would discuss what I didn&#8217;t like about NHibernate so here it goes. Session Management The biggest thing that I don&#8217;t like is the session [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous <a href="http://blog.brianhartsock.com/2007/12/10/nhibernate-or-mapper-part-1/">post</a> I talked about my first impressions of <a href="http://www.nhibernate.org/">NHibernate</a>.  Not a whole lot has changed since then, except I have learned a lot more.  But, I said I would discuss what I didn&#8217;t like about NHibernate so here it goes.</p>
<h4>Session Management</h4>
<p>The biggest thing that I don&#8217;t like is the session management aspect.  Although I have come to understand why NHibernate sessions are so valuable and critical to its functionality, it doesn&#8217;t stop the fact that persistent objects are tied to a single database.  For a project that follows the patterns and practices set forth in ivory towers, this works great.  All business entities are stored in a database in 6th <a href="http://en.wikipedia.org/wiki/Database_normalization#Normal_forms">normal form</a> and everyone is happy.  Well, when working with legacy and enterprise systems, that usually isn&#8217;t the case.  There are many different databases that are used and objects are stored across a variety of them.</p>
<p>In order to get my system to use NHibernate, the first challenge was incorporating multiple sessions.  A session is basically a connection to a single database that manages persistent objects.  This <a href="http://www.codeproject.com/KB/aspnet/NHibernateMultipleDBs.aspx">article</a> describes a really complex way to accomplish it, but all you really need to pay attention to is the <em>NHibernateSessionModule</em> and <em>NHibernateSessionManager.</em>  Using the outline described in the article, I successfully got multiple sessions to work fairly painlessly.</p>
<p>The second challenge was storing a persistent object in multiple database.  Since persistent objects in NHibernate can&#8217;t span multiple sessions, some data massaging has to be performed.  As I see it, there are two possibilities for storing an object in multiple database. </p>
<ol>
<li>Different objects for each database with type conversion operators</li>
<li>The same object for all databases with extra session logic</li>
</ol>
<p>The latter is obviously easier from a domain model perspective, but not from an implementation perspective.  For a persistent object from one session to be stored in another session, all references must be removed from the session.  This means unproxying the object and unpersisting any collections contained within the object.  Looking through the NHibernate source code, I was able to accomplish this with only a few lines of code.</p>
<h4>Setup &#038; Documentation</h4>
<p>Most of the getting started guides for NHibernate are no where near complete or up-to-date.  It took a couple days to get my environment up and running.  This isn&#8217;t really a problem with the library itself, but is still a problem for first time users.  In all reality, there seems to be a lack of documentation in general.  Three example mappings in the documentation is no where near enough for what is marketed as an enterprise ORM solution.</p>
<h4>Conclusion</h4>
<p>NHibernate is awesome.  Even with these minor issues, it is one of the greatest tools for web development I have ever used.  I hope that the development of this library continues to improve, and hopefully some of these issues will be resolved.</p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+NHibernate+O%2FR+Mapper%3A+Part+2+http://bit.ly/2jl38j" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2008/02/10/nhibernate-or-mapper-part-2/&amp;title=NHibernate+O%2FR+Mapper%3A+Part+2" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2008/02/10/nhibernate-or-mapper-part-2/&amp;t=NHibernate+O%2FR+Mapper%3A+Part+2" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2008/02/10/nhibernate-or-mapper-part-2/&amp;title=NHibernate+O%2FR+Mapper%3A+Part+2" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2008/02/10/nhibernate-or-mapper-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>NHibernate O/R Mapper: Part 1</title>
		<link>http://blog.brianhartsock.com/2007/12/10/nhibernate-or-mapper-part-1/</link>
		<comments>http://blog.brianhartsock.com/2007/12/10/nhibernate-or-mapper-part-1/#comments</comments>
		<pubDate>Mon, 10 Dec 2007 21:13:01 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Design Patterns]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/2007/12/10/nhibernate-or-mapper-part-1/</guid>
		<description><![CDATA[As most of you know, the data access layer is my favorite application layer to work with. For a while, I worked on my own active record implementation in PHP. After switching to .NET, my outlook has strayed away from the active record pattern though. I like using business entity objects that have no coupling [...]]]></description>
			<content:encoded><![CDATA[<p>As most of you know, the data access layer is my favorite application layer to work with.  For a while, I worked on my own active record implementation in PHP.  After switching to .NET, my outlook has strayed away from the active record pattern though.  I like using business entity objects that have no coupling to a database.  Instead, I use an object/relational mapper to translate from business entity to persisted database object.</p>
<p>At first, I started working on my own implementation again, which provided a simple, in code, mapping technique.  I quickly realized that mapping business entity relationships wasn&#8217;t easy though.  After a couple hours of staring at my monitor hoping I could come up with an elegant solution, I decided to look at some 3rd party mappers.  I had heard about <a href="http://www.nhibernate.org">NHibernate</a> before and decided to give it a shot.</p>
<p>I spent about two days prototyping part of my database in NHibernate and my first impression is wow.  Everything I could think of adding in an o/r mapper exists in NHibernate.  Lazy loading, relationships, inheritance, component mapping, and so much more is possible.  Over the past few weeks, my entire data access layer has been converted to NHibernate with overwhelming success.  Like any library, it has its own quarks, but for the most part it speeds up development time while adding lots of power to my applications.  I would recommend it to anyone.</p>
<p>NHibernate uses XML documents or .NET attributes to map an entity class to a database.  I never thought I would use XML again after painful VB6 experiences, but I decided to give it another shot.  To my surprise, I loved it.  It allows for really clean separation of the database and code, which basically means cleaner code and a happier Brian.  The only really annoying part of NHibernate is session management, but I&#8217;ll save that for part 2.</p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+NHibernate+O%2FR+Mapper%3A+Part+1+http://bit.ly/SHTd9" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2007/12/10/nhibernate-or-mapper-part-1/&amp;title=NHibernate+O%2FR+Mapper%3A+Part+1" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2007/12/10/nhibernate-or-mapper-part-1/&amp;t=NHibernate+O%2FR+Mapper%3A+Part+1" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2007/12/10/nhibernate-or-mapper-part-1/&amp;title=NHibernate+O%2FR+Mapper%3A+Part+1" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2007/12/10/nhibernate-or-mapper-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IIS 6.0 and ASP.NET 2.0 on Windows Server 2003 x64</title>
		<link>http://blog.brianhartsock.com/2007/10/25/iis-60-and-aspnet-20-on-windows-server-2003-x64/</link>
		<comments>http://blog.brianhartsock.com/2007/10/25/iis-60-and-aspnet-20-on-windows-server-2003-x64/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 14:45:44 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/2007/10/25/iis-60-and-aspnet-20-on-windows-server-2003-x64/</guid>
		<description><![CDATA[Today, I ran into an interesting issue trying to run an ASP.NET 2.0 web application through IIS 6.0. Usually, it isn&#8217;t a problem, but since the host machine is running 64 bit windows, some issues were encountered. The first symptom I ran into was a 503 Service Unavailable response when accessing the website from a [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I ran into an interesting issue trying to run an ASP.NET 2.0 web application through IIS 6.0.  Usually, it isn&#8217;t a problem, but since the host machine is running 64 bit windows, some issues were encountered.</p>
<p>The first symptom I ran into was a 503 <em>Service Unavailable</em> response when accessing the website from a browser.  Checking the IIS error logs showed a <em>AppOffline DefaultAppPool </em>error description, not very helpful.  The event log had a better message:</p>
<blockquote><p>ISAPI Filter &#8216;C:\Program Files (x86)\Common Files\Microsoft Shared\Web Server Extensions\50\bin\fpexedll.dll&#8217; could not be loaded due to a configuration problem. The current configuration only supports loading images built for a x86 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349.</p></blockquote>
<p>Googling found two related articles, <a href="http://blogs.msdn.com/david.wang/archive/2005/09/23/HOWTO_Diagnose_one_cause_of_503_Service_Unavailable_on_IIS6.aspx" class="broken_link">one</a> on the 503, and <a href="http://blogs.msdn.com/david.wang/archive/2005/10/06/HOWTO_Diagnose_one_cause_of_503_Service_Unavailable_on_IIS6_on_64bit_Windows.aspx" class="broken_link">another</a> on the ISAPI issue.</p>
<p>The solution recommended running the following command:<br />
<code>CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1</code></p>
<p>When this command was ran, nothing was fixed.  I tried running the inverse, and setting to only allow 64 bit applications, and it worked.<br />
<code>CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 0</code></p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+IIS+6.0+and+ASP.NET+2.0+on+Windows+Server+2003+x64+http://bit.ly/Ef9RE" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2007/10/25/iis-60-and-aspnet-20-on-windows-server-2003-x64/&amp;title=IIS+6.0+and+ASP.NET+2.0+on+Windows+Server+2003+x64" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2007/10/25/iis-60-and-aspnet-20-on-windows-server-2003-x64/&amp;t=IIS+6.0+and+ASP.NET+2.0+on+Windows+Server+2003+x64" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2007/10/25/iis-60-and-aspnet-20-on-windows-server-2003-x64/&amp;title=IIS+6.0+and+ASP.NET+2.0+on+Windows+Server+2003+x64" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2007/10/25/iis-60-and-aspnet-20-on-windows-server-2003-x64/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Thoughts on ASP.NET</title>
		<link>http://blog.brianhartsock.com/2007/10/11/thoughts-on-aspnet/</link>
		<comments>http://blog.brianhartsock.com/2007/10/11/thoughts-on-aspnet/#comments</comments>
		<pubDate>Thu, 11 Oct 2007 14:11:57 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/2007/10/11/thoughts-on-aspnet/</guid>
		<description><![CDATA[Originally, I had planned on blogging about each major ASP.NET 2.0 feature independently. Themes, Membership, Roles, ADO.NET, Controls, and many more were already on my list, but I began to realize I had the same thoughts on most of them. Although I still plan to give a detailed review of each feature, I wanted to [...]]]></description>
			<content:encoded><![CDATA[<p>Originally, I had planned on blogging about each major ASP.NET 2.0 feature independently.  Themes, Membership, Roles, ADO.NET, Controls, and many more were already on my list, but I began to realize I had the same thoughts on most of them. Although I still plan to give a detailed review of each feature, I wanted to go ahead on voice my opinions on ASP.NET.</p>
<h4>The Bad</h4>
<p>ASP.NET, in my opinion, attempts to provide a RAD environment for developing new applications.  DataSets, Membership, Roles, and Data-bound controls all show how ASP.NET doesn&#8217;t want the developer to waste time on mundane tasks.  What I hate is the lack of flexibility with these approaches.  For the same reason I dislike <a href="http://blog.brianhartsock.com/2007/09/23/rails-vs-php/">Rails</a>, I dislike many of the extras ASP.NET has to offer.</p>
<p>For example, I don&#8217;t want to use the Membership API because I am porting an existing application to ASP.NET.  Membership has a strict set properties a MembershipUser must have.  This is inflexible.  I don&#8217;t want to adapt my application to fit with Membership, I want Membership to adapt to my application.  The same goes for many of the other tools in ASP.NET.</p>
<h4>The Good</h4>
<p>ASP.NET is a great foundation.  It provides all the necessary tools to create a great web application.  Although ASP.NET is a framework, it lets you pick the tools you need and want for your application.  If you want to implement a custom authentication system, you don&#8217;t have to use Membership.  If you <a href="http://blog.brianhartsock.com/2007/09/06/adonet/">hate DataSets</a>, don&#8217;t use them.  </p>
<p>For developing new Web 2.0 applications, I have no doubt that using all the built-in ASP.NET tools could greatly speed up development.  For existing applications, or enterprise applications, many of the tools probably won&#8217;t work.  But at least you have the option to pick and choose.</p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+Thoughts+on+ASP.NET+http://bit.ly/BHOfs" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2007/10/11/thoughts-on-aspnet/&amp;title=Thoughts+on+ASP.NET" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2007/10/11/thoughts-on-aspnet/&amp;t=Thoughts+on+ASP.NET" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2007/10/11/thoughts-on-aspnet/&amp;title=Thoughts+on+ASP.NET" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2007/10/11/thoughts-on-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.NET Slave Blog</title>
		<link>http://blog.brianhartsock.com/2007/09/24/net-slave-blog/</link>
		<comments>http://blog.brianhartsock.com/2007/09/24/net-slave-blog/#comments</comments>
		<pubDate>Tue, 25 Sep 2007 03:18:59 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/2007/09/24/net-slave-blog/</guid>
		<description><![CDATA[While googling for some ASP.NET answers, I came across one of the best blogs I have ever seen. Any aspiring ASP.NET programmer should read every single article on his site. Mads Kristensen is the man. He truly uses his blog to share the wealth of knowledge he has accumulated.]]></description>
			<content:encoded><![CDATA[<p>While googling for some ASP.NET answers, I came across one of the best <a href="http://madskristensen.net/">blogs</a> I have ever seen. Any aspiring ASP.NET programmer should read every single article on his site.  Mads Kristensen is the man.  He truly uses his blog to share the wealth of knowledge he has accumulated.</p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+.NET+Slave+Blog+http://bit.ly/1uSvDk" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2007/09/24/net-slave-blog/&amp;title=.NET+Slave+Blog" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2007/09/24/net-slave-blog/&amp;t=.NET+Slave+Blog" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2007/09/24/net-slave-blog/&amp;title=.NET+Slave+Blog" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2007/09/24/net-slave-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data Access Application Blocks</title>
		<link>http://blog.brianhartsock.com/2007/09/18/data-access-application-blocks/</link>
		<comments>http://blog.brianhartsock.com/2007/09/18/data-access-application-blocks/#comments</comments>
		<pubDate>Tue, 18 Sep 2007 14:13:01 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/2007/09/18/data-access-application-blocks/</guid>
		<description><![CDATA[Last week I discussed using ADO.NET in enterprise applications. A good part of the article was explaining the negatives of using the DataSet class. Although I stand by that conclusion, I also want to say that I like ADO.net overall. Some of the tools it provides are good for enterprise applications, while others are better [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I discussed using ADO.NET in enterprise applications.  A good part of the article was explaining the negatives of using the DataSet class.  Although I stand by that conclusion, I also want to say that I like ADO.net overall.  Some of the tools it provides are good for enterprise applications, while others are better for smaller applications.</p>
<p>ADO.NET provides common interfaces and base classes that can be used with different database providers.  While some companies use everything Microsoft, we do not.  In all honesty, I would choose MySQL over SQL Server for almost any project but that is an argument for another day.  Like I was saying, ADO.NET is good, but can have some very repetitive code.  Managing connections, creating commands, adding parameters, and executing readers is pretty annoying.  But, the worst thing about ADO.NET is having to create database provider specific code.  To create a connection to an Odbc database, you have to actually load the OdbcConnection class.</p>
<p>Luckily, Microsoft realized that ADO.NET had these short comings and created Data Access Application blocks, which are part of their Enterprise Library.  I have been using them for a couple weeks and am definitely a fan.  The greatest thing about it is the ability to completely abstract out the database provider.  For example (Copied from the Microsoft website):</p>
<pre lang="c#" line="1">
Database db = DatabaseFactory.CreateDatabase();
DbCommand dbCommand = db.GetStoredProcCommand("GetProductsByCategory"); 

// Retrieve products from category 7.
db.AddInParameter(dbCommand, "CategoryID", DbType.Int32, 7);
DataSet productDataSet = db.ExecuteDataSet(dbCommand);
</pre>
<p>If you didn&#8217;t notice, there was no mention about an Ole, SQL, Oracle, or Odbc provider.  Also, I think it is a really clean and logical way to abstract the database.  I definitely recommend checking out Data Access Application blocks, as well as the entire Enterprise library. </p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+Data+Access+Application+Blocks+http://bit.ly/13Vh7h" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2007/09/18/data-access-application-blocks/&amp;title=Data+Access+Application+Blocks" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2007/09/18/data-access-application-blocks/&amp;t=Data+Access+Application+Blocks" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2007/09/18/data-access-application-blocks/&amp;title=Data+Access+Application+Blocks" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2007/09/18/data-access-application-blocks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ADO.NET</title>
		<link>http://blog.brianhartsock.com/2007/09/06/adonet/</link>
		<comments>http://blog.brianhartsock.com/2007/09/06/adonet/#comments</comments>
		<pubDate>Thu, 06 Sep 2007 16:08:15 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/2007/09/06/adonet/</guid>
		<description><![CDATA[I recently started a new project here at Webmail.us which will be a .NET based web application. One of the core pieces of .NET web apps is, not surprisingly, ADO.NET. It is Microsoft&#8217;s upgrade from ADO, but it is more of a rewrite. Almost everything has been refactored, with many new abstractions and paradigms for [...]]]></description>
			<content:encoded><![CDATA[<p>I recently started a new project here at Webmail.us which will be a .NET based web application.  One of the core pieces of .NET web apps is, not surprisingly, ADO.NET.  It is Microsoft&#8217;s upgrade from ADO, but it is more of a rewrite.  Almost everything has been refactored, with many new abstractions and paradigms for how to access data.  When I first read about ADO.NET, I was very skeptical.  I didn&#8217;t understand the need for these complex, hard to understand abstractions like DataTable&#8217;s and DataRelation&#8217;s and DataSet&#8217;s.  It all seemed foreign to me for a multitude of reasons.  Unfortunately, Microsoft seems to be pushing DataSet&#8217;s so loudly, its hard to see what else is out there.</p>
<p>After a few days of digging though, I found a few great articles (<a href="http://www.informit.com/articles/article.aspx?p=31099">Choosing Data Containers for .NET</a>, <a href="http://msdn2.microsoft.com/En-US/library/aa479317.aspx">On the Way to Mastering ASP.NET: Introducing Custom Entity Classes</a>) on why not to use DataSets, as well as why you should.  DataSets were designed for rapid application development, and seems to be Microsoft&#8217;s answer to the Rails ActiveRecord pattern.  It is a quick and dirty way to build the data access layer for web applications.  To be more specific, by quick I mean it allows version 1.0 of a product to be released quickly, because a data abstraction already exists.  By dirty, I mean it isn&#8217;t an abstraction created for your application, it is a data abstraction created for any application.  </p>
<h4>Pro&#8217;s of ADO.net</h4>
<ul>
<li>Fast development time</li>
<li>In place architecture.<br />
Developing custom data access solutions can be very powerful, and very risky.  A bad design can lead to bad performance and is inherently error prone</li>
<li>Feature rich
<ul>
<li>Disconnected data</li>
<li>Concurrency</li>
<li>Many more&#8230;</li>
</ul>
</li>
<li>Easily serializable</li>
</ul>
<h4>Con&#8217;s of DataSets</h4>
<ul>
<li>Large memory footprint</li>
<li>Not object oriented.<br />
DataSet&#8217;s represent relation data, just like a database.  But I don&#8217;t want an in-memory representation of the Employee table, I want Employee objects.  <a href="http://www.hanselman.com/blog/PermaLink.aspx?guid=d88f7539-10d8-4697-8c6e-1badb08bb3f5">Scott Hanselman</a> sums it up pretty nicely:</p>
<blockquote><p>A DataSet is an object, right?  But it&#8217;s not a Domain Object, it&#8217;s not an &#8220;Apple&#8221; or &#8220;Orange&#8221; &#8211; it&#8217;s an object of type &#8220;DataSet.&#8221;  A DataSet is a bowl (one that knows about the backing Data Store).  A DataSet is an object that knows how to HOLD Rows and Columns.  It&#8217;s an object that knows a LOT about the Database.  But I don&#8217;t want to return bowls.  I want to return Domain Objects, like &#8220;Apples.&#8221;
</p></blockquote>
</li>
<li>Not abstracted.<br />
Directly connected with database data and structure.  So, any change to the database schema, could trickle down to the presentation layer.</li>
</ul>
<h4>Conclusion</h4>
<p>ADO.NET is a huge improvement from old ADO, but don&#8217;t buy into the entire framework.  Microsoft is trying to push DataSets but they might not always be the best solution.  For enterprise applications, I don&#8217;t think DataSet&#8217;s are the answer.  On the other hand, for smaller web application, it might be a perfect fit. </p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+ADO.NET+http://bit.ly/2lsN65" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2007/09/06/adonet/&amp;title=ADO.NET" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2007/09/06/adonet/&amp;t=ADO.NET" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2007/09/06/adonet/&amp;title=ADO.NET" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2007/09/06/adonet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
