<?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>Garrett&#039;s Tech Musings &#187; .NET</title>
	<atom:link href="http://garrettvlieger.com/blog/category/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://garrettvlieger.com/blog</link>
	<description>Thoughts on technology, programming, and the industry</description>
	<lastBuildDate>Thu, 11 Mar 2010 02:04:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Top 10 Upcoming Microsoft Releases That Developers Should be Excited About</title>
		<link>http://garrettvlieger.com/blog/2009/10/top-10-upcoming-microsoft-releases-that-developers-should-be-excited-about/</link>
		<comments>http://garrettvlieger.com/blog/2009/10/top-10-upcoming-microsoft-releases-that-developers-should-be-excited-about/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 14:18:57 +0000</pubDate>
		<dc:creator>Garrett</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[entity framework]]></category>
		<category><![CDATA[f#]]></category>
		<category><![CDATA[geneva]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[ria]]></category>
		<category><![CDATA[visual studio 2010]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[wf]]></category>
		<category><![CDATA[windows communication foundation]]></category>
		<category><![CDATA[windows workflow foundation]]></category>

		<guid isPermaLink="false">http://garrettvlieger.com/blog/?p=101</guid>
		<description><![CDATA[1. Visual Studio 2010 It all starts with the IDE. While the tool has been built to provide a development environment for the new .NET 4.0 framework, there are several other features that make Visual Studio 2010 something to look forward to: Microsoft has cleaned up the user interface a bit, which will be the [...]]]></description>
			<content:encoded><![CDATA[<h3>1. Visual Studio 2010</h3>
<p>It all starts with the IDE.  While the tool has been built to provide a development environment for the new .NET 4.0 framework, there are several other features that make Visual Studio 2010 something to look forward to:</p>
<ul>
<li>Microsoft has cleaned up the user interface a bit, which will be the most obvious change when you first run VS 2010.  For the first time, Visual Studio is now a full-fledged WPF application.
<div id="attachment_103" class="wp-caption aligncenter" style="width: 573px"><a rel="attachment wp-att-103" href="http://garrettvlieger.com/blog/2009/10/top-10-upcoming-microsoft-releases-that-developers-should-be-excited-about/vs2010/"><img class="size-large wp-image-103" title="Visual Studio 2010" src="http://garrettvlieger.com/blog/wp-content/uploads/2009/10/vs2010-1024x569.PNG" alt="The new welcome screen in Visual Studio 2010" width="563" height="312" /></a><p class="wp-caption-text">The new welcome screen in Visual Studio 2010</p></div></li>
<li>There are several enhancements to better support new languages such as F# and parallel programming.</li>
<li>Most exciting to many developers will be the full IntelliSense support for JavaScript (finally!)</li>
<li>A new visual editor for XAML-based Silverlight applications has been added.  It&#8217;s no longer necessary to use Microsoft Blend to do front-end visual design, which is a big win for Silverlight developers.</li>
<li>Several tools have been either added or enriched: new built-in modeling capabilities, better testing options, and some really nice improvements to TFS.</li>
</ul>
<p>I&#8217;ve had the beta version installed for a while now, and I would have used it more had it not blue-screened my computer a few times.  Regardless, the best development IDE out there has added a number of nice additions to keep it ahead of the game.</p>
<p><em>Projected Release:</em> March 22, 2010<br />
<em> Further Reading</em>: <a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx">http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx</a></p>
<h3>2. .NET 4.0/C# 4.0</h3>
<p>There is a laundry list of new features in the upcoming .NET Framework 4.0 and C# 4.0 (VB.NET has new features as well, but mostly they either mimic C# enhancements or add abilities that were already in C#).  The .NET Framework has numerous additions, which are detailed throughout this list.</p>
<p>C# adds several new abilities that I&#8217;m sure a lot of developers can&#8217;t wait to start using, namely:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/dd264736(VS.100).aspx">Dynamically typed objects</a></li>
<li>Optional parameters &#8211; Visual Basic has had this forever and now C# finally adds this ability!</li>
<li>Better interoperability with COM objects &#8211; Not that anyone wants to deal with COM anymore, but its out there.</li>
</ul>
<p><em>Projected Release</em>: March 22, 2010<br />
<em> Further Reading</em>: <a href="http://msdn.microsoft.com/en-us/netframework/default.aspx">http://msdn.microsoft.com/en-us/netframework/default.aspx</a></p>
<h3>3. Windows Identity Foundation/Active Directory Federation Services (formerly codename &#8220;Geneva&#8221;)</h3>
<p>The new identity offerings from Microsoft present a means for ASP.NET developers to jump into the world of claims-based security and federated authentication.  While the approach isn&#8217;t new, the tools to make all of this relatively seamless in ASP.NET are a significant advancement for enterprises.  See my <a href="http://garrettvlieger.com/blog/2009/10/a-mind-shift-on-identity-management-with-geneva/">previous posting</a> about some of the advantages that come along with this shift in security thinking.</p>
<p><em>Projected Release</em>: Windows Identity Foundation: Released, Active Directory Federation Services: Q1 2010<br />
<em> Further Reading</em>: <a href="http://msdn.microsoft.com/en-us/security/aa570351.aspx">http://msdn.microsoft.com/en-us/security/aa570351.aspx</a></p>
<h3>4. Windows Azure Platform</h3>
<p><a rel="attachment wp-att-115" href="http://garrettvlieger.com/blog/2009/10/top-10-upcoming-microsoft-releases-that-developers-should-be-excited-about/azure/"><img class="size-full wp-image-115 alignnone" title="azure" src="http://garrettvlieger.com/blog/wp-content/uploads/2009/10/azure.png" alt="azure" width="280" height="74" /></a></p>
<p><em>The Cloud &#8211;</em> we&#8217;ve been hearing about it in articles, TV commercials, and just about everywhere.  Microsoft will be doing the hard sell on their cloud-based services platform in the coming months with the release of Azure.</p>
<p>What does it mean to developers?  Well, for one it&#8217;s part of the ongoing move to Internet-based services.  As architects plan out their systems, it may not be a matter of installing a new SQL Server or setting up an Active Directory server.  Instead, the company may opt to host their systems on the Azure platform, which will present its own set of challenges dealing with latency, network concerns, and system interoperability.  [Insert your own rain cloud analogy here.]
<p><em>Projected Release</em>: November 2009<br />
<em> Further Reading</em>: <a href="http://www.microsoft.com/windowsazure/">http://www.microsoft.com/windowsazure/</a></p>
<h3>5. ASP.NET MVC 2</h3>
<p>No, MVC doesn&#8217;t stand for Microsoft Voluminous Code, although some web forms developers may feel that way after they first get into ASP.NET MVC.  Since MVC ditches server controls, some long-time ASP.NET programmers may see MVC as adding a lot of work and extra code.  While this fear is somewhat unjustified, the next version of MVC hopes to ease the transition to MVC with some nice improvements.</p>
<p><em>Projected Release</em>: March 22, 2010<br />
<em> Further Reading</em>: <a href="http://aspnet.codeplex.com/wikipage?title=Road%20Map&amp;referringTitle=MVC">http://aspnet.codeplex.com/wikipage?title=Road%20Map&amp;referringTitle=MVC</a></p>
<h3>6. Entity Framework 4.0</h3>
<p>With the ADO.NET Entity Framework, Microsoft stepped up to bat in the ORM (Object Relational Mapping) marketplace, and according to many people, swung and missed.  With NHibernate, .netTiers, and their own LINQ to SQL already out there as better ORM options, Microsoft&#8217;s first version of the Entity Framework left a lot to be desired.</p>
<p>Thankfully, Microsoft has taken the hint and the next version of the Entity Framework fills in a lot of gaps.  For one, you can now easily customize the code generated by the tool using T4 templates.</p>
<p>Another complaint was the ability to deal with disconnected entity objects in an n-tier architecture.  Since the Entity Framework relies on the state of an object to determine whether a record should be updated, deleted, or inserted; dealing with stateless entity objects passed over a WCF service was a bit of a chore.  Microsoft corrects this with &#8220;self-tracking&#8221; entities that will set their own state on the client side.</p>
<p><em>Projected Release</em>: Q1 2010<br />
<em> Further Reading</em>: <a href="http://blogs.msdn.com/efdesign/">http://blogs.msdn.com/efdesign/</a></p>
<h3>7. WCF 4, WF 4, and Windows Server &#8220;Dublin&#8221;</h3>
<p>Yes, another European city codename for Microsoft.  With the .NET 4.0 framework, Microsoft has made significant improvements to Windows Communication Foundation (WCF) and Windows Worflow Foundation (WF).  &#8221;Dublin&#8221; meanwhile is a set of enhancements to Windows Server and IIS that provides a standard host for WCF and WF applications.</p>
<p>One of the biggest headaches with WCF is configuration.  The range of web.config or app.config settings that need to be specified for WCF negates the ease with which the rest of a WCF service can be developed.  With .NET 4.0, WCF now has a default endpoint configuration so you don&#8217;t actually need to configure anything if you don&#8217;t need to.  In addition, WCF now supports a more simplified REST interface.  This was available before with the WCF REST Starter Kit, but the new version of WCF makes this a lot easier.</p>
<p>On the Workflow side of things, Microsoft has greatly improved the visual designer for WF in Visual Studio while also completely revamping the programming model to be more robust.  They&#8217;ve also made enhancements to the interaction between WCF and WF, which brings both of these technologies more in line with each other.</p>
<p><em>Projected Release</em>: Q1 2010<br />
<em> Further Reading</em>: <a href="http://www.microsoft.com/NET/Dublin.aspx">http://www.microsoft.com/NET/Dublin.aspx</a></p>
<h3>8. F#</h3>
<p>Like many developers out there, I got my first taste of functional programming in college with LISP, and that was enough to scare me away forever.  Recently however, there&#8217;s been a resurgence in functional programming interest, stemming partly from the introduction of LINQ in .NET and leading to the development of F#.  What started out as a research project within Microsoft is now the fully-realized F# language that will be available with Visual Studio 2010.</p>
<p>Here is a quick sample program in F#:</p>
<blockquote><p><code>(* Sample Windows Forms Program *)</code></p>
<p><code>(* We need to open the Windows Forms library *)<br />
open System.Windows.Forms</code></p>
<p><code>(* Create a window and set a few properties *)<br />
let form = new Form(Visible=true, TopMost=true, Text="Welcome to F#")</code></p>
<p><code>(* Create a label to show some text in the form *)<br />
let label =<br />
let temp = new Label()<br />
let x = 3 + (4 * 5)<br />
(* Set the value of the Text*)<br />
temp.Text &amp;lt;- sprintf "x = %d" x<br />
(* Remember to return a value! *)<br />
temp</code></p>
<p><code>(* Add the label to the form *)<br />
do form.Controls.Add(label)</code></p>
<p><code> </code><code>(* Finally, run the form *)<br />
[]<br />
do Application.Run(form)</code></p></blockquote>
<p>So why consider F# over object-oriented languages such as C# and Java?  That can be better summed up by someone else so check out <a href="http://www.hanselman.com/blog/TheWeeklySourceCode34TheRiseOfF.aspx">Scott Hanselman&#8217;s write-up</a>.</p>
<p><em>Projected Release</em>: March 22, 2010<br />
<em> Further Reading</em>: <a href="http://msdn.microsoft.com/en-us/fsharp/default.aspx">http://msdn.microsoft.com/en-us/fsharp/default.aspx</a></p>
<h3>9. ASP.NET AJAX v4.0</h3>
<p>If you do web development these days, odds are that you&#8217;re designing much better user interfaces than were written 5 years ago before the advent of AJAX and rich JavaScript libraries like jQuery.  Within ASP.NET web forms, the ability to do asynchronous operations gets more complicated when you&#8217;re dealing with ViewState and generated HTML elements.  To remedy this, Microsoft introduced ASP.NET AJAX in 2007.</p>
<p>The previous versions of ASP.NET AJAX used the UpdatePanel control to define a region of &#8220;AJAX-enabled&#8221; content that could be replaced using asynchronous updates.  The data sent back and forth in these calls was a large block of ViewState and HTML content, which is clearly inefficient.  With v4.0, ASP.NET AJAX introduces client-side templating, which provides an easier and simpler method of displaying dynamic data.  Take a look at this <a href="http://encosia.com/2008/07/23/sneak-peak-aspnet-ajax-4-client-side-templating/">overview</a> to get an idea of how this all works and how this brings pure AJAX and JSON data interaction into ASP.NET AJAX.</p>
<p><em>Projected Release</em>: March 22, 2010<br />
<em>Further Reading</em>: <a href="http://aspnet.codeplex.com/wikipage?title=AJAX&amp;ProjectName=aspnet">http://aspnet.codeplex.com/wikipage?title=AJAX&amp;ProjectName=aspnet</a></p>
<h3>10. .NET RIA Services</h3>
<blockquote><p>Microsoft .NET RIA (Rich Internet Application) Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms. The RIA Services provides a pattern to write application logic that runs on the mid-tier and controls access to data for queries, changes and custom operations. It also provides end-to-end support for common tasks such as data<strong> </strong>validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier.</p></blockquote>
<p>Put simply, .NET RIA bridges the gap between Silverlight and data access by providing a middle tier layer for defining business and application logic.</p>
<p><em>Projected Release</em>: Q1 2010<br />
<em>Further Reading</em>: <a href="http://go.microsoft.com/fwlink/?LinkID=144687">http://go.microsoft.com/fwlink/?LinkID=144687</a></p>
]]></content:encoded>
			<wfw:commentRss>http://garrettvlieger.com/blog/2009/10/top-10-upcoming-microsoft-releases-that-developers-should-be-excited-about/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>A Mind-Shift on Identity Management with Geneva</title>
		<link>http://garrettvlieger.com/blog/2009/10/a-mind-shift-on-identity-management-with-geneva/</link>
		<comments>http://garrettvlieger.com/blog/2009/10/a-mind-shift-on-identity-management-with-geneva/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 03:09:03 +0000</pubDate>
		<dc:creator>Garrett</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Identity Management]]></category>
		<category><![CDATA[Active Directory Federation Services]]></category>
		<category><![CDATA[ADFS v2]]></category>
		<category><![CDATA[Geneva Server]]></category>
		<category><![CDATA[windows identity foundation]]></category>

		<guid isPermaLink="false">http://garrettvlieger.com/blog/?p=63</guid>
		<description><![CDATA[With the pending introduction of Microsoft&#8217;s Geneva Framework and Geneva Server (now officially named Windows Identify Foundation and Active Directory Federation Services, respectively), a claims-based and federated security model is now available to the .NET world.  The use of SAML-based authentication tokens distributed by Secure Token Servers (STS&#8217;s) is primed to be the next step [...]]]></description>
			<content:encoded><![CDATA[<p>With the pending introduction of Microsoft&#8217;s Geneva Framework and Geneva Server (now officially named Windows Identify Foundation and Active Directory Federation Services, respectively), a claims-based and federated security model is now available to the .NET world.  The use of SAML-based authentication tokens distributed by Secure Token Servers (STS&#8217;s) is primed to be the next step in providing a more simplified identity management scheme throughout organizations and beyond into the &#8220;cloud&#8221; of Azure and Internet-based systems.</p>
<div id="attachment_69" class="wp-caption aligncenter" style="width: 482px"><a rel="attachment wp-att-69" href="http://garrettvlieger.com/blog/2009/10/a-mind-shift-on-identity-management-with-geneva/geneva/"><img class="size-full wp-image-69" title="geneva" src="http://garrettvlieger.com/blog/wp-content/uploads/2009/10/geneva.PNG" alt="Claims-based authentication scenario" width="472" height="434" /></a><p class="wp-caption-text">Claims-based authentication scenario</p></div>
<p>If you haven&#8217;t been exposed to the concept of claims-based security, it&#8217;s a bit of a mind-shift from how application rights and user properties have been typically implemented so it may take some time to fully grasp.  A claim, to put it simply, is any attribute that can be ascribed to a user (or any resource).  For example, a user&#8217;s claims may consist of his name, birth date, gender, and role within an organization.</p>
<p>What makes this different from traditional role-based security is that these claims are authenticated by a trusted third-party.  One of the best analogies is to think of a person going to buy alcohol at a bar.  The bartender must prove that the person is of legal age so he asks for an authenticated record from a trusted third-party, which in this case is a driver&#8217;s license from the DMV.  The claim is that this person is over 21 years old, and the identity provider is the Department of Motor Vehicles.</p>
<h3>A Boon to Developers and Organizations</h3>
<p>OK, so this is all well and good but how does this make developing applications easier?  The short answer is that claims alone don&#8217;t make things much easier, but what does simplify matters is the use of federated authentication.  In our previous example, the bar knew nothing about the person buying a drink.  There was no big filing cabinet with everybody&#8217;s name and birth records stored in the back room of the bar (at least you hope not).  The problem is that this is how many applications work today.  Each application stores off its own set of users and profile data, and therefore, the application (and consequently, the application developers) must be responsible for authenticating users.</p>
<p>By utilizing federation, the job of validating that a user is who he claims to be is now handed off to a third party, and a trust is established between our application (the relying party, or RP).  If our identity provider (IP) says that Joe Smith is really Joe Smith, we can trust that this is true.  Immediately, you can probably see that this is a boon for developers everywhere, who are tired of creating user login pages and databases.  In addition, this now enables Single Sign-On (SSO) within a network of applications that share the same IP.</p>
<h3>Putting it All Together</h3>
<p>Now that you can probably see how claims and federated security can be of benefit, the next question is how all of this works within the current world of application security.  The good news is that Microsoft seems to have done an admirable job of building on top of existing technologies (e.g., Active Directory and ASP.NET authentication) and providing flexibility to leverage existing security mechanisms (e.g., OpenID, Live ID, etc.).</p>
<p>The Geneva Framework is a set of assemblies that forms the foundation of the entire security suite.  Using the Framework (otherwise known as Windows Identity Foundation, or WIF), developers can claims-enable their ASP.NET applications with just a handful of configuration settings.  In addition, WIF can be used to create a custom Secure Token Server (STS) that can perform user authentication and claims look-ups using any technique imaginable.  This open foundation will encourage developers and IT organizations to move towards this model.  In addition, Geneva Server is a robust and freely available STS that can be rolled out within an organization, making federated security a reality in fairly short order.</p>
<h3><strong>Further Reading</strong></h3>
<p>This discussion barely scratches the surface and depth of Geneva so I would encourage you to read more on the blogs and Microsoft sites out there:</p>
<ul>
<li><a title="Vibro.NET" href="http://blogs.msdn.com/vbertocci/" target="_blank">Vibro.Net</a> &#8211; Vittorio Bertocci is a Microsoft architect/evangelist and a prolific blogger on Geneva</li>
<li><a title="Geneva Whitepaper" href="http://download.microsoft.com/download/7/D/0/7D0B5166-6A8A-418A-ADDD-95EE9B046994/GenevaFramework-WhitepaperForDevelopers-Beta2.pdf" target="_blank">Geneva Framework Whitepaper for Developers</a></li>
<li><a title="Identity Management" href="http://msdn.microsoft.com/en-us/security/aa570351.aspx" target="_blank">Microsoft Identity Management Developer Center</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://garrettvlieger.com/blog/2009/10/a-mind-shift-on-identity-management-with-geneva/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft Releases ASP.NET MVC 2 Preview 2</title>
		<link>http://garrettvlieger.com/blog/2009/10/microsoft-releases-asp-net-mvc-2-preview-2/</link>
		<comments>http://garrettvlieger.com/blog/2009/10/microsoft-releases-asp-net-mvc-2-preview-2/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 14:18:34 +0000</pubDate>
		<dc:creator>Garrett</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[ASP.NET MVC 2]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://garrettvlieger.com/blog/?p=56</guid>
		<description><![CDATA[Today, Microsoft released ASP.NET MVC 2 Preview 2, the latest beta version of the MVC framework. Along with a lot of the great new additions already seen in the first preview release, it looks like they&#8217;ve added a lot of flexibility in extending the validation processing, both on the client and server sides. Having worked [...]]]></description>
			<content:encoded><![CDATA[<p>Today, Microsoft released <a href="http://haacked.com/archive/2009/10/01/asp.net-mvc-preview-2-released.aspx" target="_blank">ASP.NET MVC 2 Preview 2</a>, the latest beta version of the MVC framework.</p>
<p>Along with a lot of the great new additions already seen in the <a href="http://weblogs.asp.net/scottgu/archive/2009/07/31/asp-net-mvc-v2-preview-1-released.aspx" target="_blank">first preview release</a>, it looks like they&#8217;ve added a lot of flexibility in extending the validation processing, both on the client and server sides.</p>
<p>Having worked with the first version of ASP.NET MVC, I&#8217;m excited to see how much work they continue to put into the framework.  Much like other Microsoft technologies, the product will get much better in version 2 and beyond once they&#8217;ve gotten feedback from the user community and they&#8217;ve had time to refine the product.  I expect more and more developers will start looking to MVC as a genuine option since I know many people have been scared to move away from the comfort of ASP.NET web forms.</p>
]]></content:encoded>
			<wfw:commentRss>http://garrettvlieger.com/blog/2009/10/microsoft-releases-asp-net-mvc-2-preview-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Configuring Multiple Attribute Stores in Geneva Server</title>
		<link>http://garrettvlieger.com/blog/2009/09/configuring-multiple-attribute-stores-in-geneva-server/</link>
		<comments>http://garrettvlieger.com/blog/2009/09/configuring-multiple-attribute-stores-in-geneva-server/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 20:05:06 +0000</pubDate>
		<dc:creator>Garrett</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Identity Management]]></category>
		<category><![CDATA[Active Directory Federation Services]]></category>
		<category><![CDATA[attribute stores]]></category>
		<category><![CDATA[claim rule]]></category>
		<category><![CDATA[claim rule language]]></category>
		<category><![CDATA[Geneva Server]]></category>
		<category><![CDATA[identity]]></category>
		<category><![CDATA[multiple attribute stores]]></category>

		<guid isPermaLink="false">http://garrettvlieger.com/blog/?p=46</guid>
		<description><![CDATA[The new Active Directory Federation Services (formerly named Geneva Server) is an extensible Secure Token Server (STS) that enables claims-based authentication. When an application requests for a user to be authenticated against AD FS, it not only expects back a valid token stating the user&#8217;s identity, but it can also specify a set of claims [...]]]></description>
			<content:encoded><![CDATA[<p>The new Active Directory Federation Services (formerly named Geneva Server) is an extensible Secure Token Server (STS) that enables claims-based authentication. When an application requests for a user to be authenticated against AD FS, it not only expects back a valid token stating the user&#8217;s identity, but it can also specify a set of claims (user attributes) to be returned in the form of a SAML token. These claims are not stored within AD FS but instead reside in an externally configured Attribute Store.</p>
<p>Out of the box, AD FS provides several options for the Attribute Store: an LDAP source (such as Active Directory DS), SQL Server, or a custom store defined in a .NET library. In many situations, there may not be a single source for all of the user&#8217;s profile data (e.g., birth date, email address, phone numbers, etc.) In these situations, AD FS gives you the ability to have several stores and then determine which attribute store to use based on the claim being requested. Setting up this within AD FS (at least in the beta version) is not the most intuitive process.</p>
<h3>Configuring Attribute Stores</h3>
<p>The first step is to configure the attribute stores within AD FS, which is accomplished in the Attribute Stores section. An Active Directory store which points to the domain AD instance is setup by default so that&#8217;s taken care of. Next, we will need to add our secondary attribute store. When you add a new store, you will see that you have three options: Active Directory, LDAP, or SQL. For an LDAP or SQL source, you simply need to provide a connection string. For my application, I needed to access a SQL Server instance, so I just gave it a unique name and plugged in the SQL connection string.</p>
<div id="attachment_48" class="wp-caption aligncenter" style="width: 310px"><a rel="attachment wp-att-48" href="http://garrettvlieger.com/blog/2009/09/configuring-multiple-attribute-stores-in-geneva-server/blog1/"><img class="size-medium wp-image-48" title="Attribute Store" src="http://garrettvlieger.com/blog/wp-content/uploads/2009/09/blog1-300x276.jpg" alt="AD FS Attribute Store" width="300" height="276" /></a><p class="wp-caption-text">AD FS Attribute Store</p></div>
<h3>Claim Rules</h3>
<p>Once the attribute stores have been setup, you need to setup claims rules either at the Relying Party or Identity Provider level to dictate which claims will be retrieved from which attribute store. Optionally, these claims can also be converted into another claim. Both of these tasks are accomplished using Microsoft&#8217;s new claim rule language. The syntax for defining claims transformations is sparsely documented at this point, and the only definitive source that I&#8217;ve found is on TechNet: <a href="http://technet.microsoft.com/en-us/library/dd807118%28WS.10%29.aspx">http://technet.microsoft.com/en-us/library/dd807118%28WS.10%29.aspx</a>.</p>
<p>To access the user data that&#8217;s stored in our SQL Server database, we need to write the query using a claim rule. Within the Relying Parties section, right click on the appropriate application and select &#8220;Edit Claim Rules&#8230;&#8221; Next, we will need to create an Advanced Rule since there currently isn&#8217;t a nice wizard to step us through this process. Within the rule definition window, type up your rule using syntax such as below:</p>
<blockquote><p><code>c:[Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth"]<br />
=&amp;gt; issue(store = "AdventureWorks Attribute Store", types = ("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth"), query = "SELECT BirthDate FROM [HumanResources].[Employee] WHERE LoginID = {0}", param = c.Value);</code></p></blockquote>
<p>This isn&#8217;t an easy mechanism and hopefully Microsoft polishes this interface in future releases, but in the end, we do have claims being sourced from multiple locations, which will be very useful when developing a claims-enabled application.</p>
]]></content:encoded>
			<wfw:commentRss>http://garrettvlieger.com/blog/2009/09/configuring-multiple-attribute-stores-in-geneva-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DTO Assembler</title>
		<link>http://garrettvlieger.com/blog/2009/09/dto-assembler/</link>
		<comments>http://garrettvlieger.com/blog/2009/09/dto-assembler/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 04:12:18 +0000</pubDate>
		<dc:creator>Garrett</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[assembler]]></category>
		<category><![CDATA[automapper]]></category>
		<category><![CDATA[data transfer objects]]></category>
		<category><![CDATA[dto]]></category>
		<category><![CDATA[mapping]]></category>
		<category><![CDATA[service oriented architecture]]></category>
		<category><![CDATA[services]]></category>
		<category><![CDATA[soa]]></category>
		<category><![CDATA[windows communication foundation]]></category>

		<guid isPermaLink="false">http://garrettvlieger.com/blog/?p=3</guid>
		<description><![CDATA[When writing services that pass data between processes, it is oftentimes beneficial and wise to package the data in simple classes called DataTransferObjects (DTOs).  The database-matching Entity objects are not good choices for serialization since they may contain too much information, too little information, could be many layers deep, and expose the database structure to [...]]]></description>
			<content:encoded><![CDATA[<p>When writing services that pass data between processes, it is oftentimes beneficial and wise to package the data in simple classes called DataTransferObjects (DTOs).  The database-matching Entity objects are not good choices for serialization since they may contain too much information, too little information, could be many layers deep, and expose the database structure to consuming clients.</p>
<p>The Assembler pattern is used to build up the DTO objects before sending results back from a method and is also responsible for reversing this process when clients pass DTOs to the service.  This build process involves mapping Entity classes to DTO classes, but there will not necessarily be a one-to-one correspondence between properties.  In either case, the process of mapping matching properties can be a laborious programming task.</p>
<h3>Enter the AutoMapper</h3>
<p>One option for overcoming this chore is to use generated code, which can be sufficient for exact matches but doesn’t address more complicated scenarios.  The other option is to use mapping code, and AutoMapper (<a href="http://www.codeplex.com/AutoMapper">http://www.codeplex.com/AutoMapper</a>) is a CodePlex project meant to solve exactly this problem.  By default, the AutoMapper library copies property values from one class to another based on property names and also allows for more complicated mappings.</p>
<h3>DtoAssembler</h3>
<p>For my particular set of DTOs, the mappings were mostly one-to-one to the underlying database entities and did not require many changes.  To simplify things, I created a generic DtoAssembler class that takes two class types – TSource and TDestination – as the input and output types for the mappings.  Next, we simply create a map using the CreateMap static method and then call the Map to perform the conversion.</p>
<pre>using AutoMapper;

public static class DtoAssembler&lt;TSource, TDestination&gt;
{
        public static void MapObject(TSource entity, TDestination destination)
        {
            Mapper.CreateMap&lt;TSource, TDestination&gt;();
            Mapper.Map&lt;TSource, TDestination&gt;(entity, destination);
        }

        public static TDestination MapObject(TSource entity)
        {
            Mapper.CreateMap&lt;TSource, TDestination&gt;();

            TDestination dto = Mapper.Map&lt;TSource, TDestination&gt;(entity);

            return dto;
        }

        public static List&lt;TDestination&gt; MapList(List&lt;TSource&gt; entities)
        {
            List&lt;TDestination&gt; dtoList = new List&lt;TDestination&gt;();

            foreach (TSource entity in entities)
            {
                dtoList.Add(MapObject(entity));
            }

            return dtoList;
        }
}</pre>
<p>From within the service code, the call is as simple as this to create the DTO:</p>
<pre>TeamDto teamDto = DtoAssembler&lt;TeamEntity, TeamDto&gt;.MapObject(team);</pre>
<p>As you can see, creating a simple DTO mapping can be greatly simplified by using the AutoMapper.  For more complicated mapping scenarios, take a look at the AutoMapper documentation for examples.</p>
]]></content:encoded>
			<wfw:commentRss>http://garrettvlieger.com/blog/2009/09/dto-assembler/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Closing WCF Service References</title>
		<link>http://garrettvlieger.com/blog/2009/09/closing-wcf-service-references/</link>
		<comments>http://garrettvlieger.com/blog/2009/09/closing-wcf-service-references/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 02:37:37 +0000</pubDate>
		<dc:creator>Garrett</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[close]]></category>
		<category><![CDATA[dispose]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[services]]></category>
		<category><![CDATA[windows communication foundation]]></category>

		<guid isPermaLink="false">http://garrettvlieger.com/blog/?p=18</guid>
		<description><![CDATA[One aspect of using WCF services that took a little bit of time to figure out is the lifespan of the service connection.  Unlike standard web services in .NET, the connection to a WCF service is only closed when the Close method is explicitly called or the service proxy object is disposed.  In the latter [...]]]></description>
			<content:encoded><![CDATA[<p>One aspect of using WCF services that took a little bit of time to figure out is the lifespan of the service connection.  Unlike standard web services in .NET, the connection to a WCF service is only closed when the Close method is explicitly called or the service proxy object is disposed.  In the latter case, the normal practice would be to wrap the object in a <strong><em>using</em></strong> statement as below:</p>
<pre>using (EmailServiceClient svc = new EmailServiceClient())
{
   svc.SendEmail(fromAddress, fromName, toEmail, toName, message);
}</pre>
<p>However, there are problems with the how the Dispose method was implemented that could cause an exception to be thrown and not properly caught as described in this MSDN article: <a href="http://msdn.microsoft.com/en-us/library/aa355056.aspx">http://msdn.microsoft.com/en-us/library/aa355056.aspx</a>.  Therefore, the best practices dictates that Close is called explicitly and the operations are wrapped in a try/catch block:</p>
<pre>EmailServiceClient svc = null;
try
{
   svc = new EmailServiceClient();
   svc.SendMail(fromAddress, fromName, toEmail, toName, message);
   svc.Close();
}
catch (CommunicationException e)
{
   svc.Abort();
}
catch (TimeoutException e)
{
   svc.Abort();
}
catch (Exception e)
{
   svc.Abort();
   throw;
}</pre>
<p>Since this is fairly lengthy to write for every service call, I instead added a wrapper class (based on code found in this blog: <a href="http://bloggingabout.net/blogs/erwyn/archive/2006/12/09/WCF-Service-Proxy-Helper.aspx">http://bloggingabout.net/blogs/erwyn/archive/2006/12/09/WCF-Service-Proxy-Helper.aspx</a>).</p>
<pre>public class ServiceProxyHelper&lt;TProxy, TChannel&gt; : IDisposable
    where TProxy : ClientBase&lt;TChannel&gt;, new()
    where TChannel : class
{
    ///
    /// Private instance of the WCF service proxy.
    ///
    private TProxy _proxy;

    ///
    /// Gets the WCF service proxy wrapped by this instance.
    ///
    public TProxy Proxy
    {
        get
        {
            if (_proxy != null)
            {
                return _proxy;
            }
            else
            {
                throw new ObjectDisposedException("ServiceProxyHelper");
            }
        }
    }

    public TChannel Channel { get; private set; }

    ///
    /// Constructs an instance.
    ///
    public ServiceProxyHelper()
    {
        _proxy = new TProxy();
    }

    ///
    /// Disposes of this instance.
    ///
    public void Dispose()
    {
        try
        {
            if (_proxy != null)
            {
                if (_proxy.State != CommunicationState.Faulted)
                {
                    _proxy.Close();
                }
                else
                {
                    _proxy.Abort();
                }
            }
        }
        catch (CommunicationException)
        {
            _proxy.Abort();
        }
        catch (TimeoutException)
        {
            _proxy.Abort();
        }
        catch (Exception)
        {
            _proxy.Abort();
            throw;
        }
        finally
        {
            _proxy = null;
        }
    }</pre>
<p>The new calls to our service now look like this:</p>
<pre>
using (ServiceProxyHelper&lt;EmailServiceClient, EmailService&gt; svc =
   new ServiceProxyHelper&lt;EmailServiceClient, EmailService&gt;())
{
   svc.Proxy.SendMail(fromAddress, fromName, toEmail, toName, message);
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://garrettvlieger.com/blog/2009/09/closing-wcf-service-references/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Flexible Namespace Naming</title>
		<link>http://garrettvlieger.com/blog/2009/09/more-flexible-namespace-naming/</link>
		<comments>http://garrettvlieger.com/blog/2009/09/more-flexible-namespace-naming/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 01:29:08 +0000</pubDate>
		<dc:creator>Garrett</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[contracts]]></category>
		<category><![CDATA[data contract]]></category>
		<category><![CDATA[names]]></category>
		<category><![CDATA[namespace]]></category>
		<category><![CDATA[references]]></category>
		<category><![CDATA[svcutil]]></category>
		<category><![CDATA[windows communication foundation]]></category>

		<guid isPermaLink="false">http://garrettvlieger.com/blog/?p=11</guid>
		<description><![CDATA[When using Visual Studio’s handy Add Service Reference wizard to add a new WCF service to your project, the dialog box allows you to define the namespace of the generated proxy code, which includes the method definitions and the data contracts.  While this is good for most cases, there are some instances where more flexibility [...]]]></description>
			<content:encoded><![CDATA[<p>When using Visual Studio’s handy <strong>Add Service Reference</strong> wizard to add a new WCF service to your project, the dialog box allows you to define the namespace of the generated proxy code, which includes the method definitions and the data contracts.  While this is good for most cases, there are some instances where more flexibility in setting the namespace is desired.</p>
<p style="text-align: center;"><img class="aligncenter size-medium wp-image-12" title="image003" src="http://garrettvlieger.com/blog/wp-content/uploads/2009/09/image003-300x248.png" alt="image003" width="300" height="248" /></p>
<p>I ran into a situation where there were several services using a common library of data classes.  However, the proxy classes generated for each service included separate instances of the same class (in this case, ParticipantDto) in different namespaces.  So instead of having the same class, the client application treated them as GoalService.ParticipantDto, UserService.ParticipantDto, etc.</p>
<h3>Service Utility (SVCUTIL) to the Rescue</h3>
<p>At the heart of the Add Service Reference Wizard is the SVCUTIL command line program, which has several options not exposed through Visual Studio.  To solve our divergent namespace issue, SVCUTIL includes a /namespace option that allows you to specify how to map a contract namespace to the generated .NET proxy namespace.</p>
<p>Therefore, the first key is setting the Namespace attribute in the DataContract attributes:</p>
<pre>namespace Example.Business.DataTransferObjects
{
    [DataContract(Namespace= http://schemas.example.com/Services/2009/09")]
    public class ParticipantDto
    {
       …</pre>
<p>Now that the namespace has been established, you can create a batch script as defined at <a href="http://stackoverflow.com/questions/889621/adding-service-references-to-multiple-wcf-services-that-shared-classes">http://stackoverflow.com/questions/889621/adding-service-references-to-multiple-wcf-services-that-shared-classes</a>.  This script will execute SVCUTIL against the set of services that share a common set of classes.</p>
<pre>@ECHO OFF
SET cmd=C:"Program Files""Microsoft SDKs"\Windows\v6.0a\bin\SvcUtil.exe
SET cmd=%cmd% /out:ProxyClass.cs /collectionType:System.Collections.Generic.List`1
SET cmd=%cmd% /config:Proxy.config
SET cmd=%cmd% /serializable
SET cmd=%cmd% /serializer:DataContractSerializer 

REM ######### Service namespace mappings (Service Contracts and Message Contracts)
SET cmd=%cmd% /namespace:"http://services.example.com/Services/2009/09"
SET cmd=%cmd%,"Example.Business.Services"

REM ######### Schema namespace mappings (Data Contracts)
SET cmd=%cmd% /namespace:"http://schemas.example.com/Services/2009/09"
SET cmd=%cmd%,"Example.Business.DataTransferObjects"

REM ######### Set all the URLs that have common types
SET cmd=%cmd% http://localhost/GoalsService/GoalService.svc
SET cmd=%cmd% http://localhost/UserService/UserService.svc
SET cmd=%cmd% http://localhost/EmailService/EmailService.svc

%cmd%

PAUSE</pre>
<p>The newly generated proxy code will contain two namespaces – one for the data contracts (Example.Business.DataTransferObjects) and one for the services (Example.Business.Services).  Therefore not only does this solve our divergent namespace issue, but it also provides a cleaner separation between the service methods and the data classes.</p>
]]></content:encoded>
			<wfw:commentRss>http://garrettvlieger.com/blog/2009/09/more-flexible-namespace-naming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Business Logic in Data Transfer Objects (DTOs)</title>
		<link>http://garrettvlieger.com/blog/2009/09/business-logic-in-data-transfer-objects-dtos/</link>
		<comments>http://garrettvlieger.com/blog/2009/09/business-logic-in-data-transfer-objects-dtos/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 00:40:16 +0000</pubDate>
		<dc:creator>Garrett</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[business logic]]></category>
		<category><![CDATA[data transfer objects]]></category>
		<category><![CDATA[dto]]></category>
		<category><![CDATA[windows communication foundation]]></category>

		<guid isPermaLink="false">http://garrettvlieger.com/blog/?p=22</guid>
		<description><![CDATA[While Data Transfer Objects (DTOs) are meant to be simple data containers with no functionality, there may be cases where you would like to add some simple business logic or data formatting within your classes that doesn’t require a call across the network using a service method. For instance, let’s say we have a User [...]]]></description>
			<content:encoded><![CDATA[<p>While Data Transfer Objects (DTOs) are meant to be simple data containers with no functionality, there may be cases where you would like to add some simple business logic or data formatting within your classes that doesn’t require a call across the network using a service method.</p>
<p>For instance, let’s say we have a User DTO class that contains a property with the person’s height in inches.  If we would like to add some code to compute the person’s height in feet and inches (e.g., 5 feet, 11 inches), it would be nice to add this within the DTO class itself.</p>
<p>Since the generated proxy code uses partial classes, we have a fairly simple solution.  Within our client application, we can add on to the class using the “partial” keyword and then include any additional logic that we need to perform.  Be sure not to make this too complicated since any complex business logic should be done within the business layer, but this is an easy way to implement data formatting or simple computations.</p>
<pre>namespace Example.Business.DataTransferObjects
{
    public partial class UserDto
    {
        public int HeightFeet
        {
            get
            {
                return this.CurrentHeight / 12;
            }
        }

        public int HeightInches
        {
            get
            {
                return this.CurrentHeight % 12;
            }
        }
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://garrettvlieger.com/blog/2009/09/business-logic-in-data-transfer-objects-dtos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
