<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>altinoren.com</title>
    <link>http://altinoren.com/</link>
    <description>Gokhan Altinoren's Blog and Projects</description>
    <language>en-us</language>
    <copyright>Gokhan Altinoren</copyright>
    <lastBuildDate>Mon, 10 Nov 2008 10:40:43 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.8.5223.2</generator>
    <managingEditor>gokhan@altinoren.com</managingEditor>
    <webMaster>gokhan@altinoren.com</webMaster>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/altinoren" type="application/rss+xml" /><item>
      <trackback:ping>http://altinoren.com/Trackback.aspx?guid=bca0aba7-dbaa-4ccf-bcf3-4d76efab1a40</trackback:ping>
      <pingback:server>http://altinoren.com/pingback.aspx</pingback:server>
      <pingback:target>http://altinoren.com/PermaLink,guid,bca0aba7-dbaa-4ccf-bcf3-4d76efab1a40.aspx</pingback:target>
      <dc:creator>gokhan@altinoren.com (Gokhan Altinoren)</dc:creator>
      <wfw:comment>http://altinoren.com/CommentView,guid,bca0aba7-dbaa-4ccf-bcf3-4d76efab1a40.aspx</wfw:comment>
      <wfw:commentRss>http://altinoren.com/SyndicationService.asmx/GetEntryCommentsRss?guid=bca0aba7-dbaa-4ccf-bcf3-4d76efab1a40</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I'm sure someone did this before, but I'm
   too lazy to search for it :)<br /><br />
   Model Binders in MVC is a cool concept to map your form values to parameter objects
   of your Action. There's also this automatic error message display capabilities in
   MVC. All explained by The Gu <a href="http://weblogs.asp.net/scottgu/archive/2008/09/02/asp-net-mvc-preview-5-and-form-posting-scenarios.aspx">here</a>.<br /><br />
   Here's my take on validating a model object during the binding process. Castle project
   has a validation framework and a range of <a href="http://hammett.castleproject.org/?p=114">validators</a> which
   can be used standalone. It would be cool to use it with MVC to ease the validation
   pain a bit, huh?<br /><br />
   First, we need a binder to validate the object using <a href="http://www.castleproject.org">Castle</a>'s
   ValidatorRunner:<br /><br /><!-- code formatted by http://manoli.net/csharpformat/ --><style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
</style><div class="csharpcode"><pre class="alt"><span class="kwrd">using</span> System.Web.Mvc;</pre><pre><span class="kwrd">using</span> Castle.Components.Validator;</pre><pre class="alt"> </pre><pre><span class="kwrd">public</span><span class="kwrd">class</span> ValidatingModelBinder
      : DefaultModelBinder</pre><pre class="alt">    {</pre><pre><span class="kwrd">public</span><span class="kwrd">override</span> ModelBinderResult
      BindModel(ModelBindingContext bindingContext)</pre><pre class="alt">        {</pre><pre>            var result = <span class="kwrd">base</span>.BindModel(bindingContext);</pre><pre class="alt"> </pre><pre><span class="kwrd">if</span> (result != <span class="kwrd">null</span> &amp;&amp;
      result.Value != <span class="kwrd">null</span>)</pre><pre class="alt">            {</pre><pre>                var runner = <span class="kwrd">new</span> ValidatorRunner(<span class="kwrd">new</span> CachedValidationRegistry());</pre><pre class="alt"><span class="kwrd">if</span> (!runner.IsValid(result.Value))</pre><pre>                {</pre><pre class="alt">                    var summary = runner.GetErrorSummary(result.Value);</pre><pre><span class="kwrd">foreach</span> (var invalidProperty <span class="kwrd">in</span> summary.InvalidProperties)</pre><pre class="alt">                    {</pre><pre><span class="kwrd">foreach</span> (var error <span class="kwrd">in</span> summary.GetErrorsForProperty(invalidProperty))</pre><pre class="alt">                        {</pre><pre>                            bindingContext.ModelState.AddModelError(bindingContext.ModelName + <span class="str">"."</span> +
      invalidProperty, error);</pre><pre class="alt">                        }</pre><pre>                    }</pre><pre class="alt">                }</pre><pre>            }</pre><pre class="alt"> </pre><pre><span class="kwrd">return</span> result;</pre><pre class="alt">        }</pre><pre>    }</pre></div><p>
      And an object to validate:
   </p><!-- code formatted by http://manoli.net/csharpformat/ --><style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
</style><div class="csharpcode"><pre class="alt"><span class="kwrd">using</span> Castle.Components.Validator;</pre><pre> </pre><pre class="alt"><span class="kwrd">public</span><span class="kwrd">class</span> CreateUser</pre><pre>    {</pre><pre class="alt">        [ValidateNonEmpty(<span class="str">"Please enter user name."</span>)]</pre><pre><span class="kwrd">public</span><span class="kwrd">string</span> UserName
      { get; set; }</pre><pre class="alt">        [ValidateNonEmpty(<span class="str">"Please enter password."</span>)]</pre><pre><span class="kwrd">public</span><span class="kwrd">string</span> Password
      { get; set; }</pre><pre class="alt">        [ValidateEmail(<span class="str">"Email is not valid."</span>)]</pre><pre>        [ValidateNonEmpty(<span class="str">"Please enter email address."</span>)]</pre><pre class="alt"><span class="kwrd">public</span><span class="kwrd">string</span> Email
      { get; set; }</pre><pre>    }</pre></div><p>
      And an action to use the object:
   </p><!-- code formatted by http://manoli.net/csharpformat/ --><style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
</style><div class="csharpcode"><pre class="alt"><span class="kwrd">public</span> ActionResult CreateUser(CreateUser
      createUser)</pre><pre>        {</pre><pre class="alt"><span class="kwrd">if</span> (ViewData.ModelState.IsValid)</pre><pre>            {</pre><pre class="alt">                ViewData[<span class="str">"Message"</span>] = <span class="str">"Done."</span>;</pre><pre>            }</pre><pre class="alt"> </pre><pre><span class="kwrd">return</span> View();</pre><pre class="alt">        }</pre></div><p>
      Please note that, when the action is invoked, parameter is already validated. We just
      check ViewData.ModelState.IsValid and act accordingly.<br /></p><p>
      Next, we'll tell the MVC engine to bind CreateUser objects through ValidatingModelBinder,
      in Application_Start() of Global.asax.cs:
   </p><!-- code formatted by http://manoli.net/csharpformat/ --><style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
</style><div class="csharpcode"><pre class="alt">        ModelBinders.Binders.Add(<span class="kwrd">typeof</span>(CreateUser), <span class="kwrd">new</span> ValidatingModelBinder());</pre></div><p>
      So, whenever the engine is bindign to a CreateUser, our binder will execute (and validate)
      the object. Finally, code below for the view:
   </p><!-- code formatted by http://manoli.net/csharpformat/ --><style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
</style><div class="csharpcode"><pre class="alt"><span class="kwrd">&lt;</span><span class="html">asp:Content</span><span class="attr">ID</span><span class="kwrd">="Content1"</span><span class="attr">ContentPlaceHolderID</span><span class="kwrd">="MainContent"</span><span class="attr">runat</span><span class="kwrd">="server"</span><span class="kwrd">&gt;</span></pre><pre><span class="asp">&lt;%</span><span class="kwrd">if</span> (ViewData[<span class="str">"Message"</span>]
      != <span class="kwrd">null</span>)</pre><pre class="alt">      {<span class="asp">%&gt;</span></pre><pre><span class="asp">&lt;%</span>=ViewData[<span class="str">"Message"</span>]<span class="asp">%&gt;</span></pre><pre class="alt"><span class="asp">&lt;%</span>} <span class="asp">%&gt;</span></pre><pre><span class="asp">&lt;%</span>=Html.ValidationSummary() <span class="asp">%&gt;</span></pre><pre class="alt"><span class="kwrd">&lt;</span><span class="html">form</span><span class="attr">method</span><span class="kwrd">="post"</span><span class="attr">action</span><span class="kwrd">="/Home/CreateUser"</span><span class="kwrd">&gt;</span></pre><pre>        User name: <span class="kwrd">&lt;</span><span class="html">br</span><span class="kwrd">/&gt;</span></pre><pre class="alt"><span class="asp">&lt;%</span>=Html.TextBox(<span class="str">"CreateUser.UserName"</span>)<span class="asp">%&gt;</span><span class="asp">&lt;%</span>=Html.ValidationMessage(<span class="str">"CreateUser.UserName"</span>, <span class="str">"*"</span>)<span class="asp">%&gt;</span><span class="kwrd">&lt;</span><span class="html">br</span><span class="kwrd">/&gt;</span></pre><pre>        Password: <span class="kwrd">&lt;</span><span class="html">br</span><span class="kwrd">/&gt;</span></pre><pre class="alt"><span class="asp">&lt;%</span>=Html.Password(<span class="str">"CreateUser.Password"</span>)<span class="asp">%&gt;</span><span class="asp">&lt;%</span>=Html.ValidationMessage(<span class="str">"CreateUser.Password"</span>, <span class="str">"*"</span>)<span class="asp">%&gt;</span><span class="kwrd">&lt;</span><span class="html">br</span><span class="kwrd">/&gt;</span></pre><pre>        Email: <span class="kwrd">&lt;</span><span class="html">br</span><span class="kwrd">/&gt;</span></pre><pre class="alt"><span class="asp">&lt;%</span>=Html.TextBox(<span class="str">"CreateUser.Email"</span>)<span class="asp">%&gt;</span><span class="asp">&lt;%</span>=Html.ValidationMessage(<span class="str">"CreateUser.Email"</span>, <span class="str">"*"</span>)<span class="asp">%&gt;</span><span class="kwrd">&lt;</span><span class="html">br</span><span class="kwrd">/&gt;</span></pre><pre><span class="kwrd">&lt;</span><span class="html">input</span><span class="attr">type</span><span class="kwrd">="submit"</span><span class="attr">value</span><span class="kwrd">="Submit"</span><span class="kwrd">/&gt;</span></pre><pre class="alt"><span class="kwrd">&lt;/</span><span class="html">form</span><span class="kwrd">&gt;</span></pre><pre><span class="kwrd">&lt;/</span><span class="html">asp:Content</span><span class="kwrd">&gt;</span></pre></div><p>
      Here's the result:
   </p><img src="http://altinoren.com/content/binary/MVC_Castle_Validators.jpg" border="0" /><img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=bca0aba7-dbaa-4ccf-bcf3-4d76efab1a40" /><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/altinoren/~4/6KHKXUaOBwo" height="1" width="1" /></body>
      <title>Using Castle Validators with ASP.NET MVC Model Binders for Automatic Validation</title>
      <guid isPermaLink="false">http://altinoren.com/PermaLink,guid,bca0aba7-dbaa-4ccf-bcf3-4d76efab1a40.aspx</guid>
      <link>http://feedproxy.google.com/~r/altinoren/~3/6KHKXUaOBwo/PermaLink,guid,bca0aba7-dbaa-4ccf-bcf3-4d76efab1a40.aspx</link>
      <pubDate>Mon, 10 Nov 2008 10:40:43 GMT</pubDate>
      <description>I'm sure someone did this before, but I'm too lazy to search for it :)&lt;br&gt;
&lt;br&gt;
Model Binders in MVC is a cool concept to map your form values to parameter objects
of your Action. There's also this automatic error message display capabilities in
MVC. All explained by The Gu &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/09/02/asp-net-mvc-preview-5-and-form-posting-scenarios.aspx"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
Here's my take on validating a model object during the binding process. Castle project
has a validation framework and a range of &lt;a href="http://hammett.castleproject.org/?p=114"&gt;validators&lt;/a&gt; which
can be used standalone. It would be cool to use it with MVC to ease the validation
pain a bit, huh?&lt;br&gt;
&lt;br&gt;
First, we need a binder to validate the object using &lt;a href="http://www.castleproject.org"&gt;Castle&lt;/a&gt;'s
ValidatorRunner:&lt;br&gt;
&lt;br&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web.Mvc;&lt;/pre&gt;
   &lt;pre&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; Castle.Components.Validator;&lt;/pre&gt;
   &lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;
   &lt;pre&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ValidatingModelBinder
   : DefaultModelBinder&lt;/pre&gt;
   &lt;pre class="alt"&gt;    {&lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; ModelBinderResult
   BindModel(ModelBindingContext bindingContext)&lt;/pre&gt;
   &lt;pre class="alt"&gt;        {&lt;/pre&gt;
   &lt;pre&gt;            var result = &lt;span class="kwrd"&gt;base&lt;/span&gt;.BindModel(bindingContext);&lt;/pre&gt;
   &lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;
   &lt;pre&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (result != &lt;span class="kwrd"&gt;null&lt;/span&gt; &amp;amp;&amp;amp;
   result.Value != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;
   &lt;pre class="alt"&gt;            {&lt;/pre&gt;
   &lt;pre&gt;                var runner = &lt;span class="kwrd"&gt;new&lt;/span&gt; ValidatorRunner(&lt;span class="kwrd"&gt;new&lt;/span&gt; CachedValidationRegistry());&lt;/pre&gt;
   &lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (!runner.IsValid(result.Value))&lt;/pre&gt;
   &lt;pre&gt;                {&lt;/pre&gt;
   &lt;pre class="alt"&gt;                    var summary = runner.GetErrorSummary(result.Value);&lt;/pre&gt;
   &lt;pre&gt;                    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (var invalidProperty &lt;span class="kwrd"&gt;in&lt;/span&gt; summary.InvalidProperties)&lt;/pre&gt;
   &lt;pre class="alt"&gt;                    {&lt;/pre&gt;
   &lt;pre&gt;                        &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (var error &lt;span class="kwrd"&gt;in&lt;/span&gt; summary.GetErrorsForProperty(invalidProperty))&lt;/pre&gt;
   &lt;pre class="alt"&gt;                        {&lt;/pre&gt;
   &lt;pre&gt;                            bindingContext.ModelState.AddModelError(bindingContext.ModelName + &lt;span class="str"&gt;"."&lt;/span&gt; +
   invalidProperty, error);&lt;/pre&gt;
   &lt;pre class="alt"&gt;                        }&lt;/pre&gt;
   &lt;pre&gt;                    }&lt;/pre&gt;
   &lt;pre class="alt"&gt;                }&lt;/pre&gt;
   &lt;pre&gt;            }&lt;/pre&gt;
   &lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;
   &lt;pre&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; result;&lt;/pre&gt;
   &lt;pre class="alt"&gt;        }&lt;/pre&gt;
   &lt;pre&gt;    }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
   And an object to validate:
&lt;/p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; Castle.Components.Validator;&lt;/pre&gt;
   &lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CreateUser&lt;/pre&gt;
   &lt;pre&gt;    {&lt;/pre&gt;
   &lt;pre class="alt"&gt;        [ValidateNonEmpty(&lt;span class="str"&gt;"Please enter user name."&lt;/span&gt;)]&lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; UserName
   { get; set; }&lt;/pre&gt;
   &lt;pre class="alt"&gt;        [ValidateNonEmpty(&lt;span class="str"&gt;"Please enter password."&lt;/span&gt;)]&lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Password
   { get; set; }&lt;/pre&gt;
   &lt;pre class="alt"&gt;        [ValidateEmail(&lt;span class="str"&gt;"Email is not valid."&lt;/span&gt;)]&lt;/pre&gt;
   &lt;pre&gt;        [ValidateNonEmpty(&lt;span class="str"&gt;"Please enter email address."&lt;/span&gt;)]&lt;/pre&gt;
   &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Email
   { get; set; }&lt;/pre&gt;
   &lt;pre&gt;    }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
   And an action to use the object:
&lt;/p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
   &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; ActionResult CreateUser(CreateUser
   createUser)&lt;/pre&gt;
   &lt;pre&gt;        {&lt;/pre&gt;
   &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (ViewData.ModelState.IsValid)&lt;/pre&gt;
   &lt;pre&gt;            {&lt;/pre&gt;
   &lt;pre class="alt"&gt;                ViewData[&lt;span class="str"&gt;"Message"&lt;/span&gt;] = &lt;span class="str"&gt;"Done."&lt;/span&gt;;&lt;/pre&gt;
   &lt;pre&gt;            }&lt;/pre&gt;
   &lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;
   &lt;pre&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; View();&lt;/pre&gt;
   &lt;pre class="alt"&gt;        }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
   Please note that, when the action is invoked, parameter is already validated. We just
   check ViewData.ModelState.IsValid and act accordingly.&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
   Next, we'll tell the MVC engine to bind CreateUser objects through ValidatingModelBinder,
   in Application_Start() of Global.asax.cs:
&lt;/p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
   &lt;pre class="alt"&gt;        ModelBinders.Binders.Add(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(CreateUser), &lt;span class="kwrd"&gt;new&lt;/span&gt; ValidatingModelBinder());&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
   So, whenever the engine is bindign to a CreateUser, our binder will execute (and validate)
   the object. Finally, code below for the view:
&lt;/p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
   &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:Content&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="Content1"&lt;/span&gt; &lt;span class="attr"&gt;ContentPlaceHolderID&lt;/span&gt;&lt;span class="kwrd"&gt;="MainContent"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre&gt;    &lt;span class="asp"&gt;&amp;lt;%&lt;/span&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (ViewData[&lt;span class="str"&gt;"Message"&lt;/span&gt;]
   != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;
   &lt;pre class="alt"&gt;      {&lt;span class="asp"&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="asp"&gt;&amp;lt;%&lt;/span&gt;=ViewData[&lt;span class="str"&gt;"Message"&lt;/span&gt;]&lt;span class="asp"&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre class="alt"&gt;    &lt;span class="asp"&gt;&amp;lt;%&lt;/span&gt;} &lt;span class="asp"&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre&gt;    &lt;span class="asp"&gt;&amp;lt;%&lt;/span&gt;=Html.ValidationSummary() &lt;span class="asp"&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;form&lt;/span&gt; &lt;span class="attr"&gt;method&lt;/span&gt;&lt;span class="kwrd"&gt;="post"&lt;/span&gt; &lt;span class="attr"&gt;action&lt;/span&gt;&lt;span class="kwrd"&gt;="/Home/CreateUser"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre&gt;        User name: &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre class="alt"&gt;        &lt;span class="asp"&gt;&amp;lt;%&lt;/span&gt;=Html.TextBox(&lt;span class="str"&gt;"CreateUser.UserName"&lt;/span&gt;)&lt;span class="asp"&gt;%&amp;gt;&lt;/span&gt; &lt;span class="asp"&gt;&amp;lt;%&lt;/span&gt;=Html.ValidationMessage(&lt;span class="str"&gt;"CreateUser.UserName"&lt;/span&gt;, &lt;span class="str"&gt;"*"&lt;/span&gt;)&lt;span class="asp"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre&gt;        Password: &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre class="alt"&gt;        &lt;span class="asp"&gt;&amp;lt;%&lt;/span&gt;=Html.Password(&lt;span class="str"&gt;"CreateUser.Password"&lt;/span&gt;)&lt;span class="asp"&gt;%&amp;gt;&lt;/span&gt; &lt;span class="asp"&gt;&amp;lt;%&lt;/span&gt;=Html.ValidationMessage(&lt;span class="str"&gt;"CreateUser.Password"&lt;/span&gt;, &lt;span class="str"&gt;"*"&lt;/span&gt;)&lt;span class="asp"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre&gt;        Email: &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre class="alt"&gt;        &lt;span class="asp"&gt;&amp;lt;%&lt;/span&gt;=Html.TextBox(&lt;span class="str"&gt;"CreateUser.Email"&lt;/span&gt;)&lt;span class="asp"&gt;%&amp;gt;&lt;/span&gt; &lt;span class="asp"&gt;&amp;lt;%&lt;/span&gt;=Html.ValidationMessage(&lt;span class="str"&gt;"CreateUser.Email"&lt;/span&gt;, &lt;span class="str"&gt;"*"&lt;/span&gt;)&lt;span class="asp"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;input&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="submit"&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="Submit"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;form&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
   &lt;pre&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:Content&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
   Here's the result:
&lt;/p&gt;
&lt;img src="http://altinoren.com/content/binary/MVC_Castle_Validators.jpg" border="0"&gt;&lt;img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=bca0aba7-dbaa-4ccf-bcf3-4d76efab1a40" /&gt;</description>
      <comments>http://altinoren.com/CommentView,guid,bca0aba7-dbaa-4ccf-bcf3-4d76efab1a40.aspx</comments>
      <category>.Net;Castle;MVC</category>
    <feedburner:origLink>http://altinoren.com/PermaLink,guid,bca0aba7-dbaa-4ccf-bcf3-4d76efab1a40.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://altinoren.com/Trackback.aspx?guid=2a6a5d82-4155-4f8d-ab18-9ffc354ad81e</trackback:ping>
      <pingback:server>http://altinoren.com/pingback.aspx</pingback:server>
      <pingback:target>http://altinoren.com/PermaLink,guid,2a6a5d82-4155-4f8d-ab18-9ffc354ad81e.aspx</pingback:target>
      <dc:creator>gokhan@altinoren.com (Gokhan Altinoren)</dc:creator>
      <wfw:comment>http://altinoren.com/CommentView,guid,2a6a5d82-4155-4f8d-ab18-9ffc354ad81e.aspx</wfw:comment>
      <wfw:commentRss>http://altinoren.com/SyndicationService.asmx/GetEntryCommentsRss?guid=2a6a5d82-4155-4f8d-ab18-9ffc354ad81e</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <b>
          <font color="#ff0000">Update</font>
        </b>:
   Check the comment by <a href="http://mhinze.com/">Matt Hinze</a>. It appears that
   we don't need this kind of complexity after Preview 4. Check <a href="http://stackoverflow.com/questions/58513/unit-testing-mvcnet-redirection#58818">this</a> and <a href="http://www.asp.net/learn/mvc/tutorial-07-cs.aspx">this</a>,
   for example. Thanks Matt. My lesson? When you're using pre-release software with lots
   of changes and improvements in each release, be sure to reevaluate all your past assumptions
   in each.<br /><br />
   --<br /><br />
   Just a note. I use a base like this code to avoid repetitive test setup when testing
   MVC controllers.<br /><br /><style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
</style><div class="csharpcode"><pre class="alt"><span class="kwrd">using</span> System;</pre><pre><span class="kwrd">using</span> System.Web;</pre><pre class="alt"><span class="kwrd">using</span> System.Web.Mvc;</pre><pre><span class="kwrd">using</span> System.Web.Routing;</pre><pre class="alt"><span class="kwrd">using</span> MbUnit.Framework;</pre><pre><span class="kwrd">using</span> Rhino.Commons;</pre><pre class="alt"><span class="kwrd">using</span> Rhino.Mocks;</pre><pre> </pre><pre class="alt"><span class="kwrd">public</span><span class="kwrd">abstract</span><span class="kwrd">class</span> ControllerTestBase&lt;TController&gt; </pre><pre><span class="kwrd">where</span> TController : Controller</pre><pre class="alt">    {</pre><pre><span class="kwrd">protected</span> TController controller;</pre><pre class="alt"><span class="kwrd">protected</span> ControllerContext controllerContext;</pre><pre><span class="kwrd">protected</span> IDisposable disposeGlobalUnitOfWorkRegistration;</pre><pre class="alt"><span class="kwrd">protected</span> HttpContextBase httpContextStub;</pre><pre><span class="kwrd">protected</span> HttpSessionStateBase httpSessionStub;</pre><pre class="alt"><span class="kwrd">protected</span> IUnitOfWork unitOfWorkStub;</pre><pre> </pre><pre class="alt">        [SetUp]</pre><pre><span class="kwrd">public</span><span class="kwrd">virtual</span><span class="kwrd">void</span> Setup()</pre><pre class="alt">        {</pre><pre>            SetupController();</pre><pre class="alt"> </pre><pre>            unitOfWorkStub = MockRepository.GenerateStub&lt;IUnitOfWork&gt;();</pre><pre class="alt">            httpContextStub = MockRepository.GenerateStub&lt;HttpContextBase&gt;();</pre><pre>            httpSessionStub = MockRepository.GenerateStub&lt;HttpSessionStateBase&gt;();</pre><pre class="alt">            httpContextStub.Stub(x =&gt; x.Session).Return(httpSessionStub);</pre><pre>            var httpRequestStub = MockRepository.GenerateStub&lt;HttpRequestBase&gt;();</pre><pre class="alt">            httpContextStub.Stub(x =&gt; x.Request).Return(httpRequestStub);</pre><pre>            controllerContext = <span class="kwrd">new</span> ControllerContext(httpContextStub, <span class="kwrd">new</span> RouteData(),
      controller);</pre><pre class="alt">            controller.ControllerContext = controllerContext;</pre><pre>            disposeGlobalUnitOfWorkRegistration = UnitOfWork.RegisterGlobalUnitOfWork(unitOfWorkStub);</pre><pre class="alt">        }</pre><pre> </pre><pre class="alt"><span class="kwrd">protected</span><span class="kwrd">abstract</span><span class="kwrd">void</span> SetupController();</pre><pre> </pre><pre class="alt">        [TearDown]</pre><pre><span class="kwrd">public</span><span class="kwrd">void</span> TearDown()</pre><pre class="alt">        {</pre><pre>            disposeGlobalUnitOfWorkRegistration.Dispose();</pre><pre class="alt">        }</pre><pre>    }</pre></div><br /><br />
   Then...<br /><br /><br /><div class="csharpcode"><pre class="alt"><span class="kwrd">using</span> System.Web.Mvc;</pre><pre><span class="kwrd">using</span> Common;</pre><pre class="alt"><span class="kwrd">using</span> Core.Authentication;</pre><pre><span class="kwrd">using</span> Core.Repositories;</pre><pre class="alt"><span class="kwrd">using</span> Domain.Entities;</pre><pre><span class="kwrd">using</span> MbUnit.Framework;</pre><pre class="alt"><span class="kwrd">using</span> Rhino.Commons;</pre><pre><span class="kwrd">using</span> Rhino.Mocks;</pre><pre class="alt"><span class="kwrd">using</span> UI.Controllers;</pre><pre><span class="kwrd">using</span> UI.Properties;</pre><pre class="alt"> </pre><pre>    [TestFixture]</pre><pre class="alt"><span class="kwrd">public</span><span class="kwrd">class</span> RegisterControllerTests
      : ControllerTestBase&lt;RegisterController&gt;</pre><pre>    {</pre><pre class="alt"><span class="kwrd">private</span> IRepository&lt;User&gt;
      repositoryStub;</pre><pre><span class="kwrd">private</span> IAuthenticationService authServiceStub;</pre><pre class="alt"> </pre><pre><span class="kwrd">protected</span><span class="kwrd">override</span><span class="kwrd">void</span> SetupController()</pre><pre class="alt">        {</pre><pre>            repositoryStub = MockRepository.GenerateStub&lt;UserRepository&gt;();</pre><pre class="alt">            authServiceStub = MockRepository.GenerateStub&lt;IAuthenticationService&gt;();</pre><pre>            controller = <span class="kwrd">new</span> RegisterController(repositoryStub,
      authServiceStub);</pre><pre class="alt">        }</pre><pre> </pre><pre class="alt">        [Test]</pre><pre><span class="kwrd">public</span><span class="kwrd">void</span> Will_display_error_message_if_logged_in()</pre><pre class="alt">        {</pre><pre>            authServiceStub.Stub(c =&gt; c.IsAuthenticated()).Return(<span class="kwrd">true</span>);</pre><pre class="alt">            var result = controller.Index() <span class="kwrd">as</span> RedirectToRouteResult;</pre><pre>            Assert.IsNotNull(result);</pre><pre class="alt">            var message = controller.TempData[<span class="str">"Message"</span>] <span class="kwrd">as</span><span class="kwrd">string</span>;</pre><pre>            Assert.IsFalse(<span class="kwrd">string</span>.IsNullOrEmpty(message));</pre><pre class="alt">            Assert.AreEqual(GlobalResources.CannotRegisterAlreadyRegistered, message);</pre><pre>            Assert.AreEqual(result.Values[<span class="str">"action"</span>], <span class="str">"Index"</span>);</pre><pre class="alt">            Assert.AreEqual(result.Values[<span class="str">"controller"</span>], <span class="str">"Message"</span>);</pre><pre>        }</pre><pre class="alt">    }</pre></div><img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=2a6a5d82-4155-4f8d-ab18-9ffc354ad81e" /><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/altinoren/~4/fCo5uP50sWg" height="1" width="1" /></body>
      <title>Base for testing ASP.NET MVC controllers</title>
      <guid isPermaLink="false">http://altinoren.com/PermaLink,guid,2a6a5d82-4155-4f8d-ab18-9ffc354ad81e.aspx</guid>
      <link>http://feedproxy.google.com/~r/altinoren/~3/fCo5uP50sWg/PermaLink,guid,2a6a5d82-4155-4f8d-ab18-9ffc354ad81e.aspx</link>
      <pubDate>Tue, 04 Nov 2008 20:32:02 GMT</pubDate>
      <description>&lt;b&gt;&lt;font color="#ff0000"&gt;Update&lt;/font&gt;&lt;/b&gt;: Check the comment by &lt;a href="http://mhinze.com/"&gt;Matt
Hinze&lt;/a&gt;. It appears that we don't need this kind of complexity after Preview 4.
Check &lt;a href="http://stackoverflow.com/questions/58513/unit-testing-mvcnet-redirection#58818"&gt;this&lt;/a&gt; and &lt;a href="http://www.asp.net/learn/mvc/tutorial-07-cs.aspx"&gt;this&lt;/a&gt;,
for example. Thanks Matt. My lesson? When you're using pre-release software with lots
of changes and improvements in each release, be sure to reevaluate all your past assumptions
in each.&lt;br&gt;
&lt;br&gt;
--&lt;br&gt;
&lt;br&gt;
Just a note. I use a base like this code to avoid repetitive test setup when testing
MVC controllers.&lt;br&gt;
&lt;br&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
   &lt;pre&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web;&lt;/pre&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web.Mvc;&lt;/pre&gt;
   &lt;pre&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web.Routing;&lt;/pre&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; MbUnit.Framework;&lt;/pre&gt;
   &lt;pre&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; Rhino.Commons;&lt;/pre&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; Rhino.Mocks;&lt;/pre&gt;
   &lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;abstract&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ControllerTestBase&amp;lt;TController&amp;gt; &lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="kwrd"&gt;where&lt;/span&gt; TController : Controller&lt;/pre&gt;
   &lt;pre class="alt"&gt;    {&lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; TController controller;&lt;/pre&gt;
   &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; ControllerContext controllerContext;&lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; IDisposable disposeGlobalUnitOfWorkRegistration;&lt;/pre&gt;
   &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; HttpContextBase httpContextStub;&lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; HttpSessionStateBase httpSessionStub;&lt;/pre&gt;
   &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; IUnitOfWork unitOfWorkStub;&lt;/pre&gt;
   &lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
   &lt;pre class="alt"&gt;        [SetUp]&lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;virtual&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Setup()&lt;/pre&gt;
   &lt;pre class="alt"&gt;        {&lt;/pre&gt;
   &lt;pre&gt;            SetupController();&lt;/pre&gt;
   &lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;
   &lt;pre&gt;            unitOfWorkStub = MockRepository.GenerateStub&amp;lt;IUnitOfWork&amp;gt;();&lt;/pre&gt;
   &lt;pre class="alt"&gt;            httpContextStub = MockRepository.GenerateStub&amp;lt;HttpContextBase&amp;gt;();&lt;/pre&gt;
   &lt;pre&gt;            httpSessionStub = MockRepository.GenerateStub&amp;lt;HttpSessionStateBase&amp;gt;();&lt;/pre&gt;
   &lt;pre class="alt"&gt;            httpContextStub.Stub(x =&amp;gt; x.Session).Return(httpSessionStub);&lt;/pre&gt;
   &lt;pre&gt;            var httpRequestStub = MockRepository.GenerateStub&amp;lt;HttpRequestBase&amp;gt;();&lt;/pre&gt;
   &lt;pre class="alt"&gt;            httpContextStub.Stub(x =&amp;gt; x.Request).Return(httpRequestStub);&lt;/pre&gt;
   &lt;pre&gt;            controllerContext = &lt;span class="kwrd"&gt;new&lt;/span&gt; ControllerContext(httpContextStub, &lt;span class="kwrd"&gt;new&lt;/span&gt; RouteData(),
   controller);&lt;/pre&gt;
   &lt;pre class="alt"&gt;            controller.ControllerContext = controllerContext;&lt;/pre&gt;
   &lt;pre&gt;            disposeGlobalUnitOfWorkRegistration = UnitOfWork.RegisterGlobalUnitOfWork(unitOfWorkStub);&lt;/pre&gt;
   &lt;pre class="alt"&gt;        }&lt;/pre&gt;
   &lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
   &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;abstract&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; SetupController();&lt;/pre&gt;
   &lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
   &lt;pre class="alt"&gt;        [TearDown]&lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; TearDown()&lt;/pre&gt;
   &lt;pre class="alt"&gt;        {&lt;/pre&gt;
   &lt;pre&gt;            disposeGlobalUnitOfWorkRegistration.Dispose();&lt;/pre&gt;
   &lt;pre class="alt"&gt;        }&lt;/pre&gt;
   &lt;pre&gt;    }&lt;/pre&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
Then...&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;div class="csharpcode"&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web.Mvc;&lt;/pre&gt;
   &lt;pre&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; Common;&lt;/pre&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; Core.Authentication;&lt;/pre&gt;
   &lt;pre&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; Core.Repositories;&lt;/pre&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; Domain.Entities;&lt;/pre&gt;
   &lt;pre&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; MbUnit.Framework;&lt;/pre&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; Rhino.Commons;&lt;/pre&gt;
   &lt;pre&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; Rhino.Mocks;&lt;/pre&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; UI.Controllers;&lt;/pre&gt;
   &lt;pre&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; UI.Properties;&lt;/pre&gt;
   &lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;
   &lt;pre&gt;    [TestFixture]&lt;/pre&gt;
   &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; RegisterControllerTests
   : ControllerTestBase&amp;lt;RegisterController&amp;gt;&lt;/pre&gt;
   &lt;pre&gt;    {&lt;/pre&gt;
   &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; IRepository&amp;lt;User&amp;gt;
   repositoryStub;&lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; IAuthenticationService authServiceStub;&lt;/pre&gt;
   &lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; SetupController()&lt;/pre&gt;
   &lt;pre class="alt"&gt;        {&lt;/pre&gt;
   &lt;pre&gt;            repositoryStub = MockRepository.GenerateStub&amp;lt;UserRepository&amp;gt;();&lt;/pre&gt;
   &lt;pre class="alt"&gt;            authServiceStub = MockRepository.GenerateStub&amp;lt;IAuthenticationService&amp;gt;();&lt;/pre&gt;
   &lt;pre&gt;            controller = &lt;span class="kwrd"&gt;new&lt;/span&gt; RegisterController(repositoryStub,
   authServiceStub);&lt;/pre&gt;
   &lt;pre class="alt"&gt;        }&lt;/pre&gt;
   &lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
   &lt;pre class="alt"&gt;        [Test]&lt;/pre&gt;
   &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Will_display_error_message_if_logged_in()&lt;/pre&gt;
   &lt;pre class="alt"&gt;        {&lt;/pre&gt;
   &lt;pre&gt;            authServiceStub.Stub(c =&amp;gt; c.IsAuthenticated()).Return(&lt;span class="kwrd"&gt;true&lt;/span&gt;);&lt;/pre&gt;
   &lt;pre class="alt"&gt;            var result = controller.Index() &lt;span class="kwrd"&gt;as&lt;/span&gt; RedirectToRouteResult;&lt;/pre&gt;
   &lt;pre&gt;            Assert.IsNotNull(result);&lt;/pre&gt;
   &lt;pre class="alt"&gt;            var message = controller.TempData[&lt;span class="str"&gt;"Message"&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;;&lt;/pre&gt;
   &lt;pre&gt;            Assert.IsFalse(&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(message));&lt;/pre&gt;
   &lt;pre class="alt"&gt;            Assert.AreEqual(GlobalResources.CannotRegisterAlreadyRegistered, message);&lt;/pre&gt;
   &lt;pre&gt;            Assert.AreEqual(result.Values[&lt;span class="str"&gt;"action"&lt;/span&gt;], &lt;span class="str"&gt;"Index"&lt;/span&gt;);&lt;/pre&gt;
   &lt;pre class="alt"&gt;            Assert.AreEqual(result.Values[&lt;span class="str"&gt;"controller"&lt;/span&gt;], &lt;span class="str"&gt;"Message"&lt;/span&gt;);&lt;/pre&gt;
   &lt;pre&gt;        }&lt;/pre&gt;
   &lt;pre class="alt"&gt;    }&lt;/pre&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=2a6a5d82-4155-4f8d-ab18-9ffc354ad81e" /&gt;</description>
      <comments>http://altinoren.com/CommentView,guid,2a6a5d82-4155-4f8d-ab18-9ffc354ad81e.aspx</comments>
      <category>MVC;Rhino Stack;TDD</category>
    <feedburner:origLink>http://altinoren.com/PermaLink,guid,2a6a5d82-4155-4f8d-ab18-9ffc354ad81e.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://altinoren.com/Trackback.aspx?guid=5e1af0a0-34a8-43d6-b90a-96d638c5bf89</trackback:ping>
      <pingback:server>http://altinoren.com/pingback.aspx</pingback:server>
      <pingback:target>http://altinoren.com/PermaLink,guid,5e1af0a0-34a8-43d6-b90a-96d638c5bf89.aspx</pingback:target>
      <dc:creator>gokhan@altinoren.com (Gokhan Altinoren)</dc:creator>
      <wfw:comment>http://altinoren.com/CommentView,guid,5e1af0a0-34a8-43d6-b90a-96d638c5bf89.aspx</wfw:comment>
      <wfw:commentRss>http://altinoren.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5e1af0a0-34a8-43d6-b90a-96d638c5bf89</wfw:commentRss>
      <slash:comments>12</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">For VS2008: <a href="content/binary/ActiveWriter%20Preview%204.1.rar">ActiveWriter
   Preview 4.1.rar (282.73 KB)</a><br />
   I'm not updating 2005 version anymore.<br /><br />
   What's New: 
   <ul><li>
         Optionally generates classes implementing INotifyPropertyChanging.</li><li>
         Contrib-117: Database and designer column order is not in sync</li></ul>
   Fixed: 
   <ul><li>
         Added "Nested" to Common.ARAttributes (Patch: Roberto Paterlini)</li><li>
         Swapped parameters in new ArgumentNullException (Patch: Roberto Paterlini)</li><li>
         Changed in-memory code compilation error reporting to give full details of the internal
         compile process. No more ExceptionCollection's.</li><li>
         Contrib-118: Activewriter errors in combination with VisualSVN (Patch: Visual SVN
         Team)</li><li>
         Changed the temporary file generation to use \obj folder rather than arbitrary locations
         on the system.</li></ul><p /><a href="http://altinoren.com/content/binary/ActiveWriter%20Preview%204.1.rar"><br /></a><img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=5e1af0a0-34a8-43d6-b90a-96d638c5bf89" /><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/altinoren/~4/tsXxpbZXPd8" height="1" width="1" /></body>
      <title>ActiveWriter Preview 4.1</title>
      <guid isPermaLink="false">http://altinoren.com/PermaLink,guid,5e1af0a0-34a8-43d6-b90a-96d638c5bf89.aspx</guid>
      <link>http://feedproxy.google.com/~r/altinoren/~3/tsXxpbZXPd8/PermaLink,guid,5e1af0a0-34a8-43d6-b90a-96d638c5bf89.aspx</link>
      <pubDate>Thu, 26 Jun 2008 11:21:59 GMT</pubDate>
      <description>For VS2008: &lt;a href="content/binary/ActiveWriter%20Preview%204.1.rar"&gt;ActiveWriter
Preview 4.1.rar (282.73 KB)&lt;/a&gt;
&lt;br&gt;
I'm not updating 2005 version anymore.&lt;br&gt;
&lt;br&gt;
What's New: 
&lt;ul&gt;
   &lt;li&gt;
      Optionally generates classes implementing INotifyPropertyChanging.&lt;/li&gt;
   &lt;li&gt;
      Contrib-117: Database and designer column order is not in sync&lt;/li&gt;
&lt;/ul&gt;
Fixed: 
&lt;ul&gt;
   &lt;li&gt;
      Added "Nested" to Common.ARAttributes (Patch: Roberto Paterlini)&lt;/li&gt;
   &lt;li&gt;
      Swapped parameters in new ArgumentNullException (Patch: Roberto Paterlini)&lt;/li&gt;
   &lt;li&gt;
      Changed in-memory code compilation error reporting to give full details of the internal
      compile process. No more ExceptionCollection's.&lt;/li&gt;
   &lt;li&gt;
      Contrib-118: Activewriter errors in combination with VisualSVN (Patch: Visual SVN
      Team)&lt;/li&gt;
   &lt;li&gt;
      Changed the temporary file generation to use \obj folder rather than arbitrary locations
      on the system.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;a href="http://altinoren.com/content/binary/ActiveWriter%20Preview%204.1.rar"&gt;
&lt;br&gt;
&lt;/a&gt;&lt;img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=5e1af0a0-34a8-43d6-b90a-96d638c5bf89" /&gt;</description>
      <comments>http://altinoren.com/CommentView,guid,5e1af0a0-34a8-43d6-b90a-96d638c5bf89.aspx</comments>
      <category>ActiveWriter</category>
    <feedburner:origLink>http://altinoren.com/PermaLink,guid,5e1af0a0-34a8-43d6-b90a-96d638c5bf89.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://altinoren.com/Trackback.aspx?guid=9cd1f262-2bab-4b08-910c-fa2d6a306d46</trackback:ping>
      <pingback:server>http://altinoren.com/pingback.aspx</pingback:server>
      <pingback:target>http://altinoren.com/PermaLink,guid,9cd1f262-2bab-4b08-910c-fa2d6a306d46.aspx</pingback:target>
      <dc:creator>gokhan@altinoren.com (Gokhan Altinoren)</dc:creator>
      <wfw:comment>http://altinoren.com/CommentView,guid,9cd1f262-2bab-4b08-910c-fa2d6a306d46.aspx</wfw:comment>
      <wfw:commentRss>http://altinoren.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9cd1f262-2bab-4b08-910c-fa2d6a306d46</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">Or Omea Reader has a strange dependency
   on Firefox:)<br /><br />
   If, after upgrading to Firefox 3, your Omea Reader stops downloading feeds with the
   error message someting like "Could not find file C:\Documents and Settings\&lt;your
   user name&gt;\Application Data\Mozilla\Profiles\&lt;random&gt;.default\cookies.txt",
   that's because Firefox 3 now employs cookies.sqlite to persist cookie info. Create
   an empty cookies.txt there to get Omea on it's feet again. By the way, I tried to
   switch to Google Reader while investigating this problem and didn't found it as useful
   as Omea. Other than some odd behavior after resuming the computer from hibernation,
   and the lack of online reading experience from different macgines :(, Omea is still
   the perfect blog reader for me.<br /><br />
   Now, depending on the existence of a cookies file of an external application is a
   shame on JetBrains's part, on the other hand. Especially if a dummy file works just
   as expected.<br /><p /><img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=9cd1f262-2bab-4b08-910c-fa2d6a306d46" /><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/altinoren/~4/OsuZzMmprmc" height="1" width="1" /></body>
      <title>FF3 breaks Omea Reader </title>
      <guid isPermaLink="false">http://altinoren.com/PermaLink,guid,9cd1f262-2bab-4b08-910c-fa2d6a306d46.aspx</guid>
      <link>http://feedproxy.google.com/~r/altinoren/~3/OsuZzMmprmc/PermaLink,guid,9cd1f262-2bab-4b08-910c-fa2d6a306d46.aspx</link>
      <pubDate>Thu, 26 Jun 2008 11:00:46 GMT</pubDate>
      <description>Or Omea Reader has a strange dependency on Firefox:)&lt;br&gt;
&lt;br&gt;
If, after upgrading to Firefox 3, your Omea Reader stops downloading feeds with the
error message someting like "Could not find file C:\Documents and Settings\&amp;lt;your
user name&amp;gt;\Application Data\Mozilla\Profiles\&amp;lt;random&amp;gt;.default\cookies.txt",
that's because Firefox 3 now employs cookies.sqlite to persist cookie info. Create
an empty cookies.txt there to get Omea on it's feet again. By the way, I tried to
switch to Google Reader while investigating this problem and didn't found it as useful
as Omea. Other than some odd behavior after resuming the computer from hibernation,
and the lack of online reading experience from different macgines :(, Omea is still
the perfect blog reader for me.&lt;br&gt;
&lt;br&gt;
Now, depending on the existence of a cookies file of an external application is a
shame on JetBrains's part, on the other hand. Especially if a dummy file works just
as expected.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=9cd1f262-2bab-4b08-910c-fa2d6a306d46" /&gt;</description>
      <comments>http://altinoren.com/CommentView,guid,9cd1f262-2bab-4b08-910c-fa2d6a306d46.aspx</comments>
      <category>Tools</category>
    <feedburner:origLink>http://altinoren.com/PermaLink,guid,9cd1f262-2bab-4b08-910c-fa2d6a306d46.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://altinoren.com/Trackback.aspx?guid=c86e4ceb-756f-4be2-a1da-3a55f28fef30</trackback:ping>
      <pingback:server>http://altinoren.com/pingback.aspx</pingback:server>
      <pingback:target>http://altinoren.com/PermaLink,guid,c86e4ceb-756f-4be2-a1da-3a55f28fef30.aspx</pingback:target>
      <dc:creator>gokhan@altinoren.com (Gokhan Altinoren)</dc:creator>
      <wfw:comment>http://altinoren.com/CommentView,guid,c86e4ceb-756f-4be2-a1da-3a55f28fef30.aspx</wfw:comment>
      <wfw:commentRss>http://altinoren.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c86e4ceb-756f-4be2-a1da-3a55f28fef30</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">Kathleen Dollard wrote a <a href="http://msmvps.com/blogs/kathleen/archive/2008/06/24/entity-framework-petition.aspx">response</a> regarding
   the <a href="http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/">Vote
   of No Confidence</a> on the Entity Framework. I was reading her post knowing that
   there will be lots of posts circling around the Vote of No Confidence, some will agree
   and some won't, and that was such a post from a particular point of view, until I
   hit this one (emphesis not mine):<br /><blockquote><i>"Entity approaches are good because they better separate the business
   and data sides of our middle tiers. But they are also inherently difficult and inaccessible
   to most programmers. Entity Framework’s goal must be to bridge this gap. That means
   being extremely creative in picking its battles to reach toward the real world developer
   – not copy a strategy that is available to that developer today and fails (the combination
   of NHibernate and other tools used in a specific style of development). The failure
   is not because NHibernate is an Open Source tool. It’s not because people don’t know
   about it. If it worked in the majority of shops it would burn through our industry
   like wildfire. Why don’t you use them? <b>Because they do not fit your development
   environment!</b></i>"<br /></blockquote>Sorry, but this is FUD or what? What's the ground here to say that NHibernate,
   or any O/RM approach mimicking it, is failing? Does Linq To SQL, which is no different
   in theory than NHibernate but lacks most of it's features, is a carrot from MS to
   the impatient while they wait for the uber EF framework? What makes something fail
   in MS land when it is actually quite successful in other platforms? Take TDD, for
   example. It works, appearently, and gaining some momentum. But it's nowhere near burning
   through our industry like wildfire. You can't make average Joe and his boss accept
   TDD as the defacto way of writing software. Does that mean TDD fails? Do we need some
   other über-TDD to replace it at the moment?<br /><br />
   NHibernate does actually fit very well into my development environment, and I see
   no reason why it won't for any other developer. It has a clear SoC attitude, minimalistic
   configuration (compare NH xml configuration files with any behind-the-scene xml dialect
   from MS and you'll know what I mean), nice performance. It has everything if you want
   to write maintainable code. That does not mean that it's irreplaceable, but it just
   works, now, and any newcomer should challange it, not vice versa.<br /><br />
   But yes, it does not fit the development environment often thought by Microsoft. Last
   year, I have paid a visit to a client who was suffering lots of performance, scalability
   and mainly maintainability problems with their in-house written ERP system. It turns
   out that, the application was built on typed datasets start to finish. They decided
   that they need to port their application to .Net, took some courses along with MOC
   2541 (part of the official MS curriculum saying that data access is a solved problem
   if you use drag'n drop and datasets), realized that typed datasets is the ultimate-easy
   way do access data and the rest is history for them. Don't get me wrong, I instructed
   almost all the courses in the official MS curriculum, but in each case I mentioned
   and demoed alternatives and told the audience that what they see in the official book
   is just part of the story.<br /><br />
   In the last couple years I'm feeling much better about Microsoft, the direction they're
   heading, the way they're interacting with and listening to the community. I'm also
   a firm believer in code generation when it's due, wrote some tools to make developers'
   life easier (including people using NHibernate), and actually paid a visit to Cambidge,
   UK to meet the nice people of the DSL Tools team for a job interview a couple of months
   ago (I failed, appearently). I'm buying the toy my son wanted by spending the money
   I earned by using Microsoft technologies, and I'm happy with what I do. But I can't
   stand the "MS way or nothing else" attitude.<br /><br />
   Microsoft is famous for handling developers as babies sometimes. If you're a C# developer,
   create a VB.NET project and you'll see that behavior precisely. In a VB.Net project,
   why project references or .designer.cs files are hidden? Where all this namespace
   thing gone? Where's the damn entry point of this application? The broad, ignorant
   world of MS developer echosystem (of which I'm a part of) is actualy ignorant because
   of this simple fact. In the past, we are always told that there's a specific way of
   writing applications, and you can find tools and documentation from Microsoft if you
   want to know what it is. If there's a problem already solved, it's solved by Microsoft.
   It's comfortable to leave the thinking to someone else and do what you told.<br /><br />
   But times are changing, DAL == DAAB no more, we are more open and influenced by other
   tools, platforms and thinking. This is also true for O/RM tools / frameworks. I visit
   lots of clients every week, and O/RM is really something people are researching or
   already using somehow, be it in-house, EF, Linq to SQL, LLBLGen, NHibernate, or something
   else. So, again, how can one say that NHibernate is done, kaput, arrivederci? It's
   all just started, and minds are shifting.<br /><br />
   In the long-run, reaching real world developers only works if you solve their real
   world problems with long-lasting frameworks. And by long-lasting, I mean frameworks
   that survive rewrites, gives you the opportunity to say that "I was right by selecting
   this" three years after your first deployment. I'm not saying that EF is not one of
   them, but we have seen many palliative solutions from MS that didn't last long, and
   the items in that Vote of No Confidence document are real and learned by experience.
   Real world experience.<br /><p /><img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=c86e4ceb-756f-4be2-a1da-3a55f28fef30" /><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/altinoren/~4/hUrjqi2WEq8" height="1" width="1" /></body>
      <title>NHibernate FUD?</title>
      <guid isPermaLink="false">http://altinoren.com/PermaLink,guid,c86e4ceb-756f-4be2-a1da-3a55f28fef30.aspx</guid>
      <link>http://feedproxy.google.com/~r/altinoren/~3/hUrjqi2WEq8/PermaLink,guid,c86e4ceb-756f-4be2-a1da-3a55f28fef30.aspx</link>
      <pubDate>Thu, 26 Jun 2008 08:49:33 GMT</pubDate>
      <description>Kathleen Dollard wrote a &lt;a href="http://msmvps.com/blogs/kathleen/archive/2008/06/24/entity-framework-petition.aspx"&gt;response&lt;/a&gt; regarding
the &lt;a href="http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/"&gt;Vote
of No Confidence&lt;/a&gt; on the Entity Framework. I was reading her post knowing that
there will be lots of posts circling around the Vote of No Confidence, some will agree
and some won't, and that was such a post from a particular point of view, until I
hit this one (emphesis not mine):&lt;br&gt;
&lt;blockquote&gt;&lt;i&gt;"Entity approaches are good because they better separate the business
and data sides of our middle tiers. But they are also inherently difficult and inaccessible
to most programmers. Entity Framework’s goal must be to bridge this gap. That means
being extremely creative in picking its battles to reach toward the real world developer
– not copy a strategy that is available to that developer today and fails (the combination
of NHibernate and other tools used in a specific style of development). The failure
is not because NHibernate is an Open Source tool. It’s not because people don’t know
about it. If it worked in the majority of shops it would burn through our industry
like wildfire. Why don’t you use them? &lt;b&gt;Because they do not fit your development
environment!&lt;/b&gt;&lt;/i&gt;"&lt;br&gt;
&lt;/blockquote&gt;Sorry, but this is FUD or what? What's the ground here to say that NHibernate,
or any O/RM approach mimicking it, is failing? Does Linq To SQL, which is no different
in theory than NHibernate but lacks most of it's features, is a carrot from MS to
the impatient while they wait for the uber EF framework? What makes something fail
in MS land when it is actually quite successful in other platforms? Take TDD, for
example. It works, appearently, and gaining some momentum. But it's nowhere near burning
through our industry like wildfire. You can't make average Joe and his boss accept
TDD as the defacto way of writing software. Does that mean TDD fails? Do we need some
other über-TDD to replace it at the moment?&lt;br&gt;
&lt;br&gt;
NHibernate does actually fit very well into my development environment, and I see
no reason why it won't for any other developer. It has a clear SoC attitude, minimalistic
configuration (compare NH xml configuration files with any behind-the-scene xml dialect
from MS and you'll know what I mean), nice performance. It has everything if you want
to write maintainable code. That does not mean that it's irreplaceable, but it just
works, now, and any newcomer should challange it, not vice versa.&lt;br&gt;
&lt;br&gt;
But yes, it does not fit the development environment often thought by Microsoft. Last
year, I have paid a visit to a client who was suffering lots of performance, scalability
and mainly maintainability problems with their in-house written ERP system. It turns
out that, the application was built on typed datasets start to finish. They decided
that they need to port their application to .Net, took some courses along with MOC
2541 (part of the official MS curriculum saying that data access is a solved problem
if you use drag'n drop and datasets), realized that typed datasets is the ultimate-easy
way do access data and the rest is history for them. Don't get me wrong, I instructed
almost all the courses in the official MS curriculum, but in each case I mentioned
and demoed alternatives and told the audience that what they see in the official book
is just part of the story.&lt;br&gt;
&lt;br&gt;
In the last couple years I'm feeling much better about Microsoft, the direction they're
heading, the way they're interacting with and listening to the community. I'm also
a firm believer in code generation when it's due, wrote some tools to make developers'
life easier (including people using NHibernate), and actually paid a visit to Cambidge,
UK to meet the nice people of the DSL Tools team for a job interview a couple of months
ago (I failed, appearently). I'm buying the toy my son wanted by spending the money
I earned by using Microsoft technologies, and I'm happy with what I do. But I can't
stand the "MS way or nothing else" attitude.&lt;br&gt;
&lt;br&gt;
Microsoft is famous for handling developers as babies sometimes. If you're a C# developer,
create a VB.NET project and you'll see that behavior precisely. In a VB.Net project,
why project references or .designer.cs files are hidden? Where all this namespace
thing gone? Where's the damn entry point of this application? The broad, ignorant
world of MS developer echosystem (of which I'm a part of) is actualy ignorant because
of this simple fact. In the past, we are always told that there's a specific way of
writing applications, and you can find tools and documentation from Microsoft if you
want to know what it is. If there's a problem already solved, it's solved by Microsoft.
It's comfortable to leave the thinking to someone else and do what you told.&lt;br&gt;
&lt;br&gt;
But times are changing, DAL == DAAB no more, we are more open and influenced by other
tools, platforms and thinking. This is also true for O/RM tools / frameworks. I visit
lots of clients every week, and O/RM is really something people are researching or
already using somehow, be it in-house, EF, Linq to SQL, LLBLGen, NHibernate, or something
else. So, again, how can one say that NHibernate is done, kaput, arrivederci? It's
all just started, and minds are shifting.&lt;br&gt;
&lt;br&gt;
In the long-run, reaching real world developers only works if you solve their real
world problems with long-lasting frameworks. And by long-lasting, I mean frameworks
that survive rewrites, gives you the opportunity to say that "I was right by selecting
this" three years after your first deployment. I'm not saying that EF is not one of
them, but we have seen many palliative solutions from MS that didn't last long, and
the items in that Vote of No Confidence document are real and learned by experience.
Real world experience.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=c86e4ceb-756f-4be2-a1da-3a55f28fef30" /&gt;</description>
      <comments>http://altinoren.com/CommentView,guid,c86e4ceb-756f-4be2-a1da-3a55f28fef30.aspx</comments>
      <category>NHibernate;O/RM</category>
    <feedburner:origLink>http://altinoren.com/PermaLink,guid,c86e4ceb-756f-4be2-a1da-3a55f28fef30.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://altinoren.com/Trackback.aspx?guid=643ec407-4fe1-4238-a24e-20ef8b134a99</trackback:ping>
      <pingback:server>http://altinoren.com/pingback.aspx</pingback:server>
      <pingback:target>http://altinoren.com/PermaLink,guid,643ec407-4fe1-4238-a24e-20ef8b134a99.aspx</pingback:target>
      <dc:creator>gokhan@altinoren.com (Gokhan Altinoren)</dc:creator>
      <wfw:comment>http://altinoren.com/CommentView,guid,643ec407-4fe1-4238-a24e-20ef8b134a99.aspx</wfw:comment>
      <wfw:commentRss>http://altinoren.com/SyndicationService.asmx/GetEntryCommentsRss?guid=643ec407-4fe1-4238-a24e-20ef8b134a99</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">Some time ago, <a href="http://blogs.msdn.com/stuart_kent">Stuart
   Kent</a> published the <a href="http://blogs.msdn.com/stuart_kent/archive/2007/11/22/dsl-tools-beyond-vs2008.aspx">roadmap
   for DSL Tools</a>. The idea of Dsl extensibility and WPF-based design surface mentioned
   there easily make someone drool. In the comments to the same post, he also mentions
   a way to provide your own editor instead of the built-in one. Here's my take on using
   that technique to provide a custom editor-wannabe in WPF.<br /><ul><li>
         Create a new <b>Domain-Specific Language Designer </b>(File \ New \ Project \ Other
         Project Types \ Extensibility)<br /><b>Name </b>the project as <b>WPFDSLDesigner</b></li><li>
         Select <b>Class Diagrams template</b> and click <b>Finish </b>to accept the defaults.</li><li>
         On the DSL Explorer tool window, click on the <b>Editor node</b>. Make a note of the <b>FileExtension </b>property
         in the Properties Window. <b>Right click</b> Editor node and <b>Delete </b>it.</li><li><b>Right click</b> on the WPFDSLDesigner <b>root node</b> and select <b>Add New Custom
         Editor</b>. Set the <b>FileExtension </b>property. Set <b>Root Class</b> property
         to <b>ModelRoot</b>.<br /><img src="http://altinoren.com/content/binary/CustomDSLEditor.png" border="0" /><br /></li><li><b>Transform All Templates</b> using the rightmost button on top of the Solution Explorer.</li><li>
         Try building the project. The <b>compiler error</b> will lead you to the customization
         point. The cool thing with the DSL Tools is that, it clearly marks customization points
         expected by the developer with appropriate comments, all the time. We will add a partial
         class to supply our own getter in this case, as described by the comment in the code.</li><li>
         Add a <b>project reference</b> to <b>WindowsFormsIntegration </b>assembly (The last
         element in the dialog, most probably)</li><li>
         Add a <b>class </b>named <b>WPFDesignerDocView </b>to the <b>DSLPackage </b>project.
         (I created a DocView folder to group added files in a single place.) Change the code
         as follows:<br /><!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset162\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs28 \cf1 namespace\cf0  Company.WPFDSLDesigner.DslPackage\par ??\{\par ??    \cf1 using\cf0  System.Windows.Forms;\par ??    \cf1 using\cf0  System.Windows.Forms.Integration;\par ??\par ??    \cf1 internal\cf0  \cf1 partial\cf0  \cf1 class\cf0  \cf4 WPFDSLDesignerDocView\par ??\cf0     \{\par ??        \cf1 private\cf0  \cf4 ElementHost\cf0  host;\par ??        \cf1 public\cf0  \cf1 override\cf0  \cf4 IWin32Window\cf0  Window\par ??        \{\par ??            \cf1 get\par ??\cf0             \{\par ??                \cf1 if\cf0  (host == \cf1 null\cf0 )\par ??                \{\par ??                    host = \cf1 new\cf0  \cf4 ElementHost\cf0  \{ Dock = \cf4 DockStyle\cf0 .Fill \};\par ??\par ??                    \cf4 WPFDesigner\cf0  designer = \cf1 new\cf0  \cf4 WPFDesigner\cf0 (\cf1 this\cf0 );\par ??                    host.Child = designer;\par ??                \}\par ??\par ??                \cf1 return\cf0  host;\par ??            \}\par ??        \}\par ??\par ??        \cf1 protected\cf0  \cf1 override\cf0  \cf1 bool\cf0  LoadView()\par ??        \{\par ??            \cf1 bool\cf0  result = \cf1 base\cf0 .LoadView();\par ??            \cf1 if\cf0  (result)\par ??            \{\par ??                ((\cf4 WPFDesigner\cf0 )host.Child).DocumentLoaded();\par ??            \}\par ??\par ??            \cf1 return\cf0  result;\par ??        \}\par ??    \}\par ??\}\par ??}
--><div style="background: white none repeat scroll 0% 50%; font-family: Consolas; font-size: 14pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset162\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs28 \cf1 namespace\cf0  Company.WPFDSLDesigner.DslPackage\par ??\{\par ??    \cf1 using\cf0  System.Windows.Forms;\par ??    \cf1 using\cf0  System.Windows.Forms.Integration;\par ??\par ??    \cf1 internal\cf0  \cf1 partial\cf0  \cf1 class\cf0  \cf4 WPFDSLDesignerDocView\par ??\cf0     \{\par ??        \cf1 private\cf0  \cf4 ElementHost\cf0  host;\par ??        \cf1 public\cf0  \cf1 override\cf0  \cf4 IWin32Window\cf0  Window\par ??        \{\par ??            \cf1 get\par ??\cf0             \{\par ??                \cf1 if\cf0  (host == \cf1 null\cf0 )\par ??                \{\par ??                    host = \cf1 new\cf0  \cf4 ElementHost\cf0  \{ Dock = \cf4 DockStyle\cf0 .Fill \};\par ??\par ??                    \cf4 WPFDesigner\cf0  designer = \cf1 new\cf0  \cf4 WPFDesigner\cf0 (\cf1 this\cf0 );\par ??                    host.Child = designer;\par ??                \}\par ??\par ??                \cf1 return\cf0  host;\par ??            \}\par ??        \}\par ??\par ??        \cf1 protected\cf0  \cf1 override\cf0  \cf1 bool\cf0  LoadView()\par ??        \{\par ??            \cf1 bool\cf0  result = \cf1 base\cf0 .LoadView();\par ??            \cf1 if\cf0  (result)\par ??            \{\par ??                ((\cf4 WPFDesigner\cf0 )host.Child).DocumentLoaded();\par ??            \}\par ??\par ??            \cf1 return\cf0  result;\par ??        \}\par ??    \}\par ??\}\par ??}
--><div style="background: white none repeat scroll 0% 50%; font-family: Consolas; font-size: 14pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><p style="margin: 0px;"><span style="color: blue;">namespace</span> Company.WPFDSLDesigner.DslPackage
               </p><p style="margin: 0px;">
                  {
               </p><p style="margin: 0px;">
                      <span style="color: blue;">using</span> System.Windows.Forms;
               </p><p style="margin: 0px;">
                      <span style="color: blue;">using</span> System.Windows.Forms.Integration;
               </p><p style="margin: 0px;">
                   
               </p><p style="margin: 0px;">
                      <span style="color: blue;">internal</span><span style="color: blue;">partial</span><span style="color: blue;">class</span><span style="color: rgb(43, 145, 175);">WPFDSLDesignerDocView</span></p><p style="margin: 0px;">
                      {
               </p><p style="margin: 0px;">
                          <span style="color: blue;">private</span><span style="color: rgb(43, 145, 175);">ElementHost</span> host;
               </p><p style="margin: 0px;">
                          <span style="color: blue;">public</span><span style="color: blue;">override</span><span style="color: rgb(43, 145, 175);">IWin32Window</span> Window
               </p><p style="margin: 0px;">
                          {
               </p><p style="margin: 0px;">
                              <span style="color: blue;">get</span></p><p style="margin: 0px;">
                              {
               </p><p style="margin: 0px;">
                                  <span style="color: blue;">if</span> (host
                  == <span style="color: blue;">null</span>)
               </p><p style="margin: 0px;">
                                  {
               </p><p style="margin: 0px;">
                                     
                  host = <span style="color: blue;">new</span><span style="color: rgb(43, 145, 175);">ElementHost</span> {
                  Dock = <span style="color: rgb(43, 145, 175);">DockStyle</span>.Fill };
               </p><p style="margin: 0px;">
                   
               </p><p style="margin: 0px;">
                                      <span style="color: rgb(43, 145, 175);">WPFDesigner</span> designer
                  = <span style="color: blue;">new</span><span style="color: rgb(43, 145, 175);">WPFDesigner</span>(<span style="color: blue;">this</span>);
               </p><p style="margin: 0px;">
                                     
                  host.Child = designer;
               </p><p style="margin: 0px;">
                                  }
               </p><p style="margin: 0px;">
                   
               </p><p style="margin: 0px;">
                                  <span style="color: blue;">return</span> host;
               </p><p style="margin: 0px;">
                              }
               </p><p style="margin: 0px;">
                          }
               </p><p style="margin: 0px;">
                   
               </p><p style="margin: 0px;">
                          <span style="color: blue;">protected</span><span style="color: blue;">override</span><span style="color: blue;">bool</span> LoadView()
               </p><p style="margin: 0px;">
                          {
               </p><p style="margin: 0px;">
                              <span style="color: blue;">bool</span> result
                  = <span style="color: blue;">base</span>.LoadView();
               </p><p style="margin: 0px;">
                              <span style="color: blue;">if</span> (result)
               </p><p style="margin: 0px;">
                              {
               </p><p style="margin: 0px;">
                                  ((<span style="color: rgb(43, 145, 175);">WPFDesigner</span>)host.Child).DocumentLoaded();
               </p><p style="margin: 0px;">
                              }
               </p><p style="margin: 0px;">
                   
               </p><p style="margin: 0px;">
                              <span style="color: blue;">return</span> result;
               </p><p style="margin: 0px;">
                          }
               </p><p style="margin: 0px;">
                      }
               </p><p style="margin: 0px;">
                  }
               </p></div></div></li><li>
         Add a <b>User Control (WPF)</b> item to the project, name it <b>WPFDesigner</b>. Change
         the <b>Xaml </b><b>code </b>of the UserControl as follows:<br /><!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset162\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;}??\fs28 \cf1 &lt;\cf3 UserControl\cf1  \cf4 x:Class\cf1 =\cf0 "\cf1 Company.WPFDSLDesigner.DslPackage.WPFDesigner\cf0 "\par ??\cf1     \cf4 xmlns\cf1 =\cf0 "\cf1 http://schemas.microsoft.com/winfx/2006/xaml/presentation\cf0 "\par ??\cf1     \cf4 xmlns:x\cf1 =\cf0 "\cf1 http://schemas.microsoft.com/winfx/2006/xaml\cf0 "\cf1 &gt;\par ??    &lt;\cf3 UserControl.Resources\cf1 &gt;\par ??        &lt;\cf3 Style\cf1  \cf4 TargetType\cf1 =\cf0 "\cf1 \{x:Type ListBox\}\cf0 "\cf1 &gt;\par ??            &lt;\cf3 Setter\cf1  \cf4 Property\cf1 =\cf0 "\cf1 ItemsPanel\cf0 "\cf1 &gt;\par ??                &lt;\cf3 Setter.Value\cf1 &gt;\par ??                    &lt;\cf3 ItemsPanelTemplate\cf1 &gt;\par ??                        &lt;\cf3 StackPanel\cf1  /&gt;\par ??                    &lt;/\cf3 ItemsPanelTemplate\cf1 &gt;\par ??                &lt;/\cf3 Setter.Value\cf1 &gt;\par ??            &lt;/\cf3 Setter\cf1 &gt;\par ??            &lt;\cf3 Setter\cf1  \cf4 Property\cf1 =\cf0 "\cf1 ItemTemplate\cf0 "\cf1 &gt;\par ??                &lt;\cf3 Setter.Value\cf1 &gt;\par ??                    &lt;\cf3 DataTemplate\cf1 &gt;\par ??                        &lt;\cf3 Border\cf1  \cf4 BorderBrush\cf1 =\cf0 "\cf1 Black\cf0 "\cf1  \cf4 BorderThickness\cf1 =\cf0 "\cf1 1\cf0 "\cf1  \cf4 CornerRadius\cf1 =\cf0 "\cf1 5\cf0 "\cf1  \cf4 Margin\cf1 =\cf0 "\cf1 6\cf0 "\cf1 &gt;\par ??                            &lt;\cf3 Label\cf1  \cf4 Content\cf1 =\cf0 "\cf1 \{Binding Path=Name\}\cf0 "\cf1 &gt;&lt;/\cf3 Label\cf1 &gt;\par ??                        &lt;/\cf3 Border\cf1 &gt;\par ??                    &lt;/\cf3 DataTemplate\cf1 &gt;\par ??                &lt;/\cf3 Setter.Value\cf1 &gt;\par ??            &lt;/\cf3 Setter\cf1 &gt;\par ??        &lt;/\cf3 Style\cf1 &gt;\par ??    &lt;/\cf3 UserControl.Resources\cf1 &gt;\par ??\par ??    &lt;\cf3 Grid\cf1 &gt;\par ??        &lt;\cf3 ListBox\cf1  \cf4 Name\cf1 =\cf0 "\cf1 modelClassViewer\cf0 "\cf1  \cf4 ItemsSource\cf1 =\cf0 "\cf1 \{Binding Mode=OneWay\}\cf0 "\cf1  /&gt;\par ??    &lt;/\cf3 Grid\cf1 &gt;\par ??&lt;/\cf3 UserControl\cf1 &gt;}
--><div style="background: white none repeat scroll 0% 50%; font-family: Consolas; font-size: 14pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><p style="margin: 0px;"><span style="color: blue;">&lt;</span><span style="color: rgb(163, 21, 21);">UserControl</span><span style="color: blue;" /><span style="color: red;">x:Class</span><span style="color: blue;">=</span>"<span style="color: blue;">Company.WPFDSLDesigner.DslPackage.WPFDesigner</span>"
            </p><p style="margin: 0px;"><span style="color: blue;">    </span><span style="color: red;">xmlns</span><span style="color: blue;">=</span>"<span style="color: blue;">http://schemas.microsoft.com/winfx/2006/xaml/presentation</span>"
            </p><p style="margin: 0px;"><span style="color: blue;">    </span><span style="color: red;">xmlns:x</span><span style="color: blue;">=</span>"<span style="color: blue;">http://schemas.microsoft.com/winfx/2006/xaml</span>"<span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">    &lt;</span><span style="color: rgb(163, 21, 21);">UserControl.Resources</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">        &lt;</span><span style="color: rgb(163, 21, 21);">Style</span><span style="color: blue;" /><span style="color: red;">TargetType</span><span style="color: blue;">=</span>"<span style="color: blue;">{x:Type
               ListBox}</span>"<span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">            &lt;</span><span style="color: rgb(163, 21, 21);">Setter</span><span style="color: blue;" /><span style="color: red;">Property</span><span style="color: blue;">=</span>"<span style="color: blue;">ItemsPanel</span>"<span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">               
               &lt;</span><span style="color: rgb(163, 21, 21);">Setter.Value</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">               
                   &lt;</span><span style="color: rgb(163, 21, 21);">ItemsPanelTemplate</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">               
                       &lt;</span><span style="color: rgb(163, 21, 21);">StackPanel</span><span style="color: blue;"> /&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">               
                   &lt;/</span><span style="color: rgb(163, 21, 21);">ItemsPanelTemplate</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">               
               &lt;/</span><span style="color: rgb(163, 21, 21);">Setter.Value</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">            &lt;/</span><span style="color: rgb(163, 21, 21);">Setter</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">            &lt;</span><span style="color: rgb(163, 21, 21);">Setter</span><span style="color: blue;" /><span style="color: red;">Property</span><span style="color: blue;">=</span>"<span style="color: blue;">ItemTemplate</span>"<span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">               
               &lt;</span><span style="color: rgb(163, 21, 21);">Setter.Value</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">               
                   &lt;</span><span style="color: rgb(163, 21, 21);">DataTemplate</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">               
                       &lt;</span><span style="color: rgb(163, 21, 21);">Border</span><span style="color: blue;" /><span style="color: red;">BorderBrush</span><span style="color: blue;">=</span>"<span style="color: blue;">Black</span>"<span style="color: blue;" /><span style="color: red;">BorderThickness</span><span style="color: blue;">=</span>"<span style="color: blue;">1</span>"<span style="color: blue;" /><span style="color: red;">CornerRadius</span><span style="color: blue;">=</span>"<span style="color: blue;">5</span>"<span style="color: blue;" /><span style="color: red;">Margin</span><span style="color: blue;">=</span>"<span style="color: blue;">6</span>"<span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">               
                           &lt;</span><span style="color: rgb(163, 21, 21);">Label</span><span style="color: blue;" /><span style="color: red;">Content</span><span style="color: blue;">=</span>"<span style="color: blue;">{Binding
               Path=Name}</span>"<span style="color: blue;">&gt;&lt;/</span><span style="color: rgb(163, 21, 21);">Label</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">               
                       &lt;/</span><span style="color: rgb(163, 21, 21);">Border</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">               
                   &lt;/</span><span style="color: rgb(163, 21, 21);">DataTemplate</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">               
               &lt;/</span><span style="color: rgb(163, 21, 21);">Setter.Value</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">            &lt;/</span><span style="color: rgb(163, 21, 21);">Setter</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">        &lt;/</span><span style="color: rgb(163, 21, 21);">Style</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">    &lt;/</span><span style="color: rgb(163, 21, 21);">UserControl.Resources</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;">
                
            </p><p style="margin: 0px;"><span style="color: blue;">    &lt;</span><span style="color: rgb(163, 21, 21);">Grid</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">        &lt;</span><span style="color: rgb(163, 21, 21);">ListBox</span><span style="color: blue;" /><span style="color: red;">Name</span><span style="color: blue;">=</span>"<span style="color: blue;">modelClassViewer</span>"<span style="color: blue;" /><span style="color: red;">ItemsSource</span><span style="color: blue;">=</span>"<span style="color: blue;">{Binding
               Mode=OneWay}</span>"<span style="color: blue;"> /&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">    &lt;/</span><span style="color: rgb(163, 21, 21);">Grid</span><span style="color: blue;">&gt;</span></p><p style="margin: 0px;"><span style="color: blue;">&lt;/</span><span style="color: rgb(163, 21, 21);">UserControl</span><span style="color: blue;">&gt;</span></p></div></li><li>
         And change the code of the UserControl to:<br /><!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset162\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red0\green128\blue0;}??\fs28 \cf1 namespace\cf0  Company.WPFDSLDesigner.DslPackage\par ??\{\par ??    \cf1 using\cf0  Microsoft.VisualStudio.Modeling.Shell;\par ??    \cf1 using\cf0  System.Collections.Generic;\par ??\par ??    \cf1 public\cf0  \cf1 partial\cf0  \cf1 class\cf0  \cf4 WPFDesigner\par ??\cf0     \{\par ??        \cf1 public\cf0  \cf4 ModelingDocView\cf0  DocView \{ \cf1 get\cf0 ; \cf1 set\cf0 ; \}\par ??        \cf1 protected\cf0  \cf4 ModelRoot\cf0  root;\par ??\par ??        \cf1 public\cf0  WPFDesigner()\par ??        \{\par ??            InitializeComponent();\par ??        \}\par ??\par ??        \cf1 public\cf0  WPFDesigner(\cf4 ModelingDocView\cf0  docView)\par ??            : \cf1 this\cf0 ()\par ??        \{\par ??            DocView = docView;\par ??        \}\par ??\par ??        \cf1 public\cf0  \cf1 void\cf0  DocumentLoaded()\par ??        \{\par ??            \cf1 if\cf0  (DocView != \cf1 null\cf0  &amp;&amp; DocView.DocData.RootElement != \cf1 null\cf0 )\par ??            \{\par ??                \cf5 // Had some problems binding to ModelRoot.Types directly. Using a custom list instead.\par ??\cf0                 \cf1 var\cf0  list = \cf1 new\cf0  \cf4 List\cf0 &lt;\cf4 ModelType\cf0 &gt;();\par ??                list.AddRange(((\cf4 ModelRoot\cf0 )DocView.DocData.RootElement).Types);\par ??                modelClassViewer.DataContext = list;\par ??            \}\par ??        \}\par ??    \}\par ??\}\par ??}
--><span style="color: rgb(43, 145, 175);" /><!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset162\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red0\green128\blue0;}??\fs28 \cf1 namespace\cf0  Company.WPFDSLDesigner.DslPackage\par ??\{\par ??    \cf1 using\cf0  Microsoft.VisualStudio.Modeling.Shell;\par ??    \cf1 using\cf0  System.Collections.Generic;\par ??\par ??    \cf1 public\cf0  \cf1 partial\cf0  \cf1 class\cf0  \cf4 WPFDesigner\par ??\cf0     \{\par ??        \cf1 public\cf0  \cf4 ModelingDocView\cf0  DocView \{ \cf1 get\cf0 ; \cf1 set\cf0 ; \}\par ??        \cf1 protected\cf0  \cf4 ModelRoot\cf0  root;\par ??\par ??        \cf1 public\cf0  WPFDesigner()\par ??        \{\par ??            InitializeComponent();\par ??        \}\par ??\par ??        \cf1 public\cf0  WPFDesigner(\cf4 ModelingDocView\cf0  docView)\par ??            : \cf1 this\cf0 ()\par ??        \{\par ??            DocView = docView;\par ??        \}\par ??\par ??        \cf1 public\cf0  \cf1 void\cf0  DocumentLoaded()\par ??        \{\par ??            \cf1 if\cf0  (DocView != \cf1 null\cf0  &amp;&amp; DocView.DocData.RootElement != \cf1 null\cf0 )\par ??            \{\par ??                \cf5 // Had some problems binding to ModelRoot.Types directly. Using a custom list instead.\par ??\cf0                 \cf1 var\cf0  list = \cf1 new\cf0  \cf4 List\cf0 &lt;\cf4 ModelType\cf0 &gt;();\par ??                list.AddRange(((\cf4 ModelRoot\cf0 )DocView.DocData.RootElement).Types);\par ??                modelClassViewer.DataContext = list;\par ??            \}\par ??        \}\par ??    \}\par ??\}\par ??}
--><div style="background: white none repeat scroll 0% 50%; font-family: Consolas; font-size: 14pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><div style="background: white none repeat scroll 0% 50%; font-family: Consolas; font-size: 14pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><p style="margin: 0px;"><span style="color: blue;">namespace</span> Company.WPFDSLDesigner.DslPackage
               </p><p style="margin: 0px;">
                  {
               </p><p style="margin: 0px;">
                      <span style="color: blue;">using</span> Microsoft.VisualStudio.Modeling.Shell;
               </p><p style="margin: 0px;">
                      <span style="color: blue;">using</span> System.Collections.Generic;
               </p><p style="margin: 0px;">
                   
               </p><p style="margin: 0px;">
                      <span style="color: blue;">public</span><span style="color: blue;">partial</span><span style="color: blue;">class</span><span style="color: rgb(43, 145, 175);">WPFDesigner</span></p><p style="margin: 0px;">
                      {
               </p><p style="margin: 0px;">
                          <span style="color: blue;">public</span><span style="color: rgb(43, 145, 175);">ModelingDocView</span> DocView
                  { <span style="color: blue;">get</span>; <span style="color: blue;">set</span>; }
               </p><p style="margin: 0px;">
                          <span style="color: blue;">protected</span><span style="color: rgb(43, 145, 175);">ModelRoot</span> root;
               </p><p style="margin: 0px;">
                   
               </p><p style="margin: 0px;">
                          <span style="color: blue;">public</span> WPFDesigner()
               </p><p style="margin: 0px;">
                          {
               </p><p style="margin: 0px;">
                              InitializeComponent();
               </p><p style="margin: 0px;">
                          }
               </p><p style="margin: 0px;">
                   
               </p><p style="margin: 0px;">
                          <span style="color: blue;">public</span> WPFDesigner(<span style="color: rgb(43, 145, 175);">ModelingDocView</span> docView)
               </p><p style="margin: 0px;">
                              : <span style="color: blue;">this</span>()
               </p><p style="margin: 0px;">
                          {
               </p><p style="margin: 0px;">
                              DocView = docView;
               </p><p style="margin: 0px;">
                          }
               </p><p style="margin: 0px;">
                   
               </p><p style="margin: 0px;">
                          <span style="color: blue;">public</span><span style="color: blue;">void</span> DocumentLoaded()
               </p><p style="margin: 0px;">
                          {
               </p><p style="margin: 0px;">
                              <span style="color: blue;">if</span> (DocView
                  != <span style="color: blue;">null</span> &amp;&amp; DocView.DocData.RootElement != <span style="color: blue;">null</span>)
               </p><p style="margin: 0px;">
                              {
               </p><p style="margin: 0px;">
                                  <span style="color: green;">//
                  Had some problems binding to ModelRoot.Types directly. Using a custom list instead.</span></p><p style="margin: 0px;">
                                  <span style="color: blue;">var</span> list
                  = <span style="color: blue;">new</span><span style="color: rgb(43, 145, 175);">List</span>&lt;<span style="color: rgb(43, 145, 175);">ModelType</span>&gt;();
               </p><p style="margin: 0px;">
                                  list.AddRange(((<span style="color: rgb(43, 145, 175);">ModelRoot</span>)DocView.DocData.RootElement).Types);
               </p><p style="margin: 0px;">
                                  modelClassViewer.DataContext
                  = list;
               </p><p style="margin: 0px;">
                              }
               </p><p style="margin: 0px;">
                          }
               </p><p style="margin: 0px;">
                      }
               </p><p style="margin: 0px;">
                  }
               </p></div></div><br /></li><li>
         Your final project structure should be looking something like this:<br /><img src="http://altinoren.com/content/binary/FinalSolution.png" border="0" /><br /></li><li>
         Run the solution to open the Debugging project. Open the <b>Sample.mydslx</b> file.
         That's all.</li></ul>
   And the result is:<br /><p /><img src="http://altinoren.com/content/binary/WPFDSLEditorResult.png" border="0" /><br /><br />
   Nothing fancy at the moment, but it's pure WPF. Add some compartment shapes and connectors,
   layout the entities rather than using a StackPanel and you're almost done. Nested
   shapes and such should be a breeze to implement.<br /><br />
   Thank god they're working on this some future version of DSL Tools, WPF is so powerful
   to customize. I'm expecting that in the final version, we'll optionally be able to
   provide our own templates instead of the generated ones for customize-like-hell experiences.<br /><br />
   Here are some future research points for the implementation above:<br /><ul><li>
         We can write a code generator to create shapes based on the Diagram Element properties
         in DslDefinition.dsl. Compartments, decorators, appearance properties etc. Why enumerate
         a bunch of types at runtime when we're already generating the rest design time?<br /></li><li>
         Databinding to LinkedElementCollection failed pretty bad, VS kept crashing in every
         single case. Hey, I want to use built-in collections. Any INotifyCollectionChanged,
         by the way?<br /></li><li>
         We should be mapping WPF menu items to package menus (VSCT). Add new property, validate
         etc.<br /></li><li>
         We should either use the original .designer file structure to persist the layout etc.
         or find a way to store that data somewhere. (Designer file is the best)</li><li>
         Performance is not so great. I tried some 3D and it's even worse, much worse. There's
         something fishy going-on when you host a WPF control on top of a win32 container,
         or in VS, or both.<br /></li></ul><img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=643ec407-4fe1-4238-a24e-20ef8b134a99" /><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/altinoren/~4/BprT3TmDwM4" height="1" width="1" /></body>
      <title>Using WPF As The Designer Surface In DSL Tools</title>
      <guid isPermaLink="false">http://altinoren.com/PermaLink,guid,643ec407-4fe1-4238-a24e-20ef8b134a99.aspx</guid>
      <link>http://feedproxy.google.com/~r/altinoren/~3/BprT3TmDwM4/PermaLink,guid,643ec407-4fe1-4238-a24e-20ef8b134a99.aspx</link>
      <pubDate>Mon, 21 Apr 2008 14:55:54 GMT</pubDate>
      <description>Some time ago, &lt;a href="http://blogs.msdn.com/stuart_kent"&gt;Stuart Kent&lt;/a&gt; published
the &lt;a href="http://blogs.msdn.com/stuart_kent/archive/2007/11/22/dsl-tools-beyond-vs2008.aspx"&gt;roadmap
for DSL Tools&lt;/a&gt;. The idea of Dsl extensibility and WPF-based design surface mentioned
there easily make someone drool. In the comments to the same post, he also mentions
a way to provide your own editor instead of the built-in one. Here's my take on using
that technique to provide a custom editor-wannabe in WPF.&lt;br&gt;
&lt;ul&gt;
   &lt;li&gt;
      Create a new &lt;b&gt;Domain-Specific Language Designer &lt;/b&gt;(File \ New \ Project \ Other
      Project Types \ Extensibility)&lt;br&gt;
      &lt;b&gt;Name &lt;/b&gt;the project as &lt;b&gt;WPFDSLDesigner&lt;/b&gt;
   &lt;/li&gt;
   &lt;li&gt;
      Select &lt;b&gt;Class Diagrams template&lt;/b&gt; and click &lt;b&gt;Finish &lt;/b&gt;to accept the defaults.&lt;/li&gt;
   &lt;li&gt;
      On the DSL Explorer tool window, click on the &lt;b&gt;Editor node&lt;/b&gt;. Make a note of the &lt;b&gt;FileExtension &lt;/b&gt;property
      in the Properties Window. &lt;b&gt;Right click&lt;/b&gt; Editor node and &lt;b&gt;Delete &lt;/b&gt;it.&lt;/li&gt;
   &lt;li&gt;
      &lt;b&gt;Right click&lt;/b&gt; on the WPFDSLDesigner &lt;b&gt;root node&lt;/b&gt; and select &lt;b&gt;Add New Custom
      Editor&lt;/b&gt;. Set the &lt;b&gt;FileExtension &lt;/b&gt;property. Set &lt;b&gt;Root Class&lt;/b&gt; property
      to &lt;b&gt;ModelRoot&lt;/b&gt;.&lt;br&gt;
      &lt;img src="http://altinoren.com/content/binary/CustomDSLEditor.png" border="0"&gt;
      &lt;br&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;b&gt;Transform All Templates&lt;/b&gt; using the rightmost button on top of the Solution Explorer.&lt;/li&gt;
   &lt;li&gt;
      Try building the project. The &lt;b&gt;compiler error&lt;/b&gt; will lead you to the customization
      point. The cool thing with the DSL Tools is that, it clearly marks customization points
      expected by the developer with appropriate comments, all the time. We will add a partial
      class to supply our own getter in this case, as described by the comment in the code.&lt;/li&gt;
   &lt;li&gt;
      Add a &lt;b&gt;project reference&lt;/b&gt; to &lt;b&gt;WindowsFormsIntegration &lt;/b&gt;assembly (The last
      element in the dialog, most probably)&lt;/li&gt;
   &lt;li&gt;
      Add a &lt;b&gt;class &lt;/b&gt;named &lt;b&gt;WPFDesignerDocView &lt;/b&gt;to the &lt;b&gt;DSLPackage &lt;/b&gt;project.
      (I created a DocView folder to group added files in a single place.) Change the code
      as follows:&lt;br&gt;
      &lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset162\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs28 \cf1 namespace\cf0  Company.WPFDSLDesigner.DslPackage\par ??\{\par ??    \cf1 using\cf0  System.Windows.Forms;\par ??    \cf1 using\cf0  System.Windows.Forms.Integration;\par ??\par ??    \cf1 internal\cf0  \cf1 partial\cf0  \cf1 class\cf0  \cf4 WPFDSLDesignerDocView\par ??\cf0     \{\par ??        \cf1 private\cf0  \cf4 ElementHost\cf0  host;\par ??        \cf1 public\cf0  \cf1 override\cf0  \cf4 IWin32Window\cf0  Window\par ??        \{\par ??            \cf1 get\par ??\cf0             \{\par ??                \cf1 if\cf0  (host == \cf1 null\cf0 )\par ??                \{\par ??                    host = \cf1 new\cf0  \cf4 ElementHost\cf0  \{ Dock = \cf4 DockStyle\cf0 .Fill \};\par ??\par ??                    \cf4 WPFDesigner\cf0  designer = \cf1 new\cf0  \cf4 WPFDesigner\cf0 (\cf1 this\cf0 );\par ??                    host.Child = designer;\par ??                \}\par ??\par ??                \cf1 return\cf0  host;\par ??            \}\par ??        \}\par ??\par ??        \cf1 protected\cf0  \cf1 override\cf0  \cf1 bool\cf0  LoadView()\par ??        \{\par ??            \cf1 bool\cf0  result = \cf1 base\cf0 .LoadView();\par ??            \cf1 if\cf0  (result)\par ??            \{\par ??                ((\cf4 WPFDesigner\cf0 )host.Child).DocumentLoaded();\par ??            \}\par ??\par ??            \cf1 return\cf0  result;\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
      &lt;div style="background: white none repeat scroll 0% 50%; font-family: Consolas; font-size: 14pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
         &lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset162\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs28 \cf1 namespace\cf0  Company.WPFDSLDesigner.DslPackage\par ??\{\par ??    \cf1 using\cf0  System.Windows.Forms;\par ??    \cf1 using\cf0  System.Windows.Forms.Integration;\par ??\par ??    \cf1 internal\cf0  \cf1 partial\cf0  \cf1 class\cf0  \cf4 WPFDSLDesignerDocView\par ??\cf0     \{\par ??        \cf1 private\cf0  \cf4 ElementHost\cf0  host;\par ??        \cf1 public\cf0  \cf1 override\cf0  \cf4 IWin32Window\cf0  Window\par ??        \{\par ??            \cf1 get\par ??\cf0             \{\par ??                \cf1 if\cf0  (host == \cf1 null\cf0 )\par ??                \{\par ??                    host = \cf1 new\cf0  \cf4 ElementHost\cf0  \{ Dock = \cf4 DockStyle\cf0 .Fill \};\par ??\par ??                    \cf4 WPFDesigner\cf0  designer = \cf1 new\cf0  \cf4 WPFDesigner\cf0 (\cf1 this\cf0 );\par ??                    host.Child = designer;\par ??                \}\par ??\par ??                \cf1 return\cf0  host;\par ??            \}\par ??        \}\par ??\par ??        \cf1 protected\cf0  \cf1 override\cf0  \cf1 bool\cf0  LoadView()\par ??        \{\par ??            \cf1 bool\cf0  result = \cf1 base\cf0 .LoadView();\par ??            \cf1 if\cf0  (result)\par ??            \{\par ??                ((\cf4 WPFDesigner\cf0 )host.Child).DocumentLoaded();\par ??            \}\par ??\par ??            \cf1 return\cf0  result;\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
         &lt;div style="background: white none repeat scroll 0% 50%; font-family: Consolas; font-size: 14pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
            &lt;p style="margin: 0px;"&gt;
               &lt;span style="color: blue;"&gt;namespace&lt;/span&gt; Company.WPFDSLDesigner.DslPackage
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               {
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Windows.Forms;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Windows.Forms.Integration;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;internal&lt;/span&gt; &lt;span style="color: blue;"&gt;partial&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;WPFDSLDesignerDocView&lt;/span&gt;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; {
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;ElementHost&lt;/span&gt; host;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;IWin32Window&lt;/span&gt; Window
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;get&lt;/span&gt;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (host
               == &lt;span style="color: blue;"&gt;null&lt;/span&gt;)
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
               host = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;ElementHost&lt;/span&gt; {
               Dock = &lt;span style="color: rgb(43, 145, 175);"&gt;DockStyle&lt;/span&gt;.Fill };
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(43, 145, 175);"&gt;WPFDesigner&lt;/span&gt; designer
               = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;WPFDesigner&lt;/span&gt;(&lt;span style="color: blue;"&gt;this&lt;/span&gt;);
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
               host.Child = designer;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;return&lt;/span&gt; host;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;protected&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; LoadView()
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; result
               = &lt;span style="color: blue;"&gt;base&lt;/span&gt;.LoadView();
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (result)
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ((&lt;span style="color: rgb(43, 145, 175);"&gt;WPFDesigner&lt;/span&gt;)host.Child).DocumentLoaded();
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;return&lt;/span&gt; result;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; }
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               }
            &lt;/p&gt;
         &lt;/div&gt;
      &lt;/div&gt;
   &lt;/li&gt;
   &lt;li&gt;
      Add a &lt;b&gt;User Control (WPF)&lt;/b&gt; item to the project, name it &lt;b&gt;WPFDesigner&lt;/b&gt;. Change
      the &lt;b&gt;Xaml &lt;/b&gt;&lt;b&gt;code &lt;/b&gt;of the UserControl as follows:&lt;br&gt;
      &lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset162\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;}??\fs28 \cf1 &amp;lt;\cf3 UserControl\cf1  \cf4 x:Class\cf1 =\cf0 "\cf1 Company.WPFDSLDesigner.DslPackage.WPFDesigner\cf0 "\par ??\cf1     \cf4 xmlns\cf1 =\cf0 "\cf1 http://schemas.microsoft.com/winfx/2006/xaml/presentation\cf0 "\par ??\cf1     \cf4 xmlns:x\cf1 =\cf0 "\cf1 http://schemas.microsoft.com/winfx/2006/xaml\cf0 "\cf1 &amp;gt;\par ??    &amp;lt;\cf3 UserControl.Resources\cf1 &amp;gt;\par ??        &amp;lt;\cf3 Style\cf1  \cf4 TargetType\cf1 =\cf0 "\cf1 \{x:Type ListBox\}\cf0 "\cf1 &amp;gt;\par ??            &amp;lt;\cf3 Setter\cf1  \cf4 Property\cf1 =\cf0 "\cf1 ItemsPanel\cf0 "\cf1 &amp;gt;\par ??                &amp;lt;\cf3 Setter.Value\cf1 &amp;gt;\par ??                    &amp;lt;\cf3 ItemsPanelTemplate\cf1 &amp;gt;\par ??                        &amp;lt;\cf3 StackPanel\cf1  /&amp;gt;\par ??                    &amp;lt;/\cf3 ItemsPanelTemplate\cf1 &amp;gt;\par ??                &amp;lt;/\cf3 Setter.Value\cf1 &amp;gt;\par ??            &amp;lt;/\cf3 Setter\cf1 &amp;gt;\par ??            &amp;lt;\cf3 Setter\cf1  \cf4 Property\cf1 =\cf0 "\cf1 ItemTemplate\cf0 "\cf1 &amp;gt;\par ??                &amp;lt;\cf3 Setter.Value\cf1 &amp;gt;\par ??                    &amp;lt;\cf3 DataTemplate\cf1 &amp;gt;\par ??                        &amp;lt;\cf3 Border\cf1  \cf4 BorderBrush\cf1 =\cf0 "\cf1 Black\cf0 "\cf1  \cf4 BorderThickness\cf1 =\cf0 "\cf1 1\cf0 "\cf1  \cf4 CornerRadius\cf1 =\cf0 "\cf1 5\cf0 "\cf1  \cf4 Margin\cf1 =\cf0 "\cf1 6\cf0 "\cf1 &amp;gt;\par ??                            &amp;lt;\cf3 Label\cf1  \cf4 Content\cf1 =\cf0 "\cf1 \{Binding Path=Name\}\cf0 "\cf1 &amp;gt;&amp;lt;/\cf3 Label\cf1 &amp;gt;\par ??                        &amp;lt;/\cf3 Border\cf1 &amp;gt;\par ??                    &amp;lt;/\cf3 DataTemplate\cf1 &amp;gt;\par ??                &amp;lt;/\cf3 Setter.Value\cf1 &amp;gt;\par ??            &amp;lt;/\cf3 Setter\cf1 &amp;gt;\par ??        &amp;lt;/\cf3 Style\cf1 &amp;gt;\par ??    &amp;lt;/\cf3 UserControl.Resources\cf1 &amp;gt;\par ??\par ??    &amp;lt;\cf3 Grid\cf1 &amp;gt;\par ??        &amp;lt;\cf3 ListBox\cf1  \cf4 Name\cf1 =\cf0 "\cf1 modelClassViewer\cf0 "\cf1  \cf4 ItemsSource\cf1 =\cf0 "\cf1 \{Binding Mode=OneWay\}\cf0 "\cf1  /&amp;gt;\par ??    &amp;lt;/\cf3 Grid\cf1 &amp;gt;\par ??&amp;lt;/\cf3 UserControl\cf1 &amp;gt;}
--&gt;
      &lt;div style="background: white none repeat scroll 0% 50%; font-family: Consolas; font-size: 14pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;UserControl&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;x:Class&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Company.WPFDSLDesigner.DslPackage.WPFDesigner&lt;/span&gt;"
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://schemas.microsoft.com/winfx/2006/xaml/presentation&lt;/span&gt;"
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns:x&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Style&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;{x:Type
            ListBox}&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Setter&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;Property&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;ItemsPanel&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
            &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Setter.Value&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
            &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ItemsPanelTemplate&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
            &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StackPanel&lt;/span&gt;&lt;span style="color: blue;"&gt; /&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
            &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ItemsPanelTemplate&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Setter.Value&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Setter&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Setter&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;Property&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;ItemTemplate&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
            &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Setter.Value&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
            &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
            &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Border&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;BorderBrush&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Black&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;BorderThickness&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;1&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;CornerRadius&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;5&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;Margin&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;6&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
            &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Label&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;Content&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;{Binding
            Path=Name}&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Label&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
            &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Border&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
            &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Setter.Value&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Setter&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Style&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &amp;nbsp;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Grid&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ListBox&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;Name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;modelClassViewer&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;{Binding
            Mode=OneWay}&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Grid&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
         &lt;p style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;UserControl&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
         &lt;/p&gt;
      &lt;/div&gt;
   &lt;/li&gt;
   &lt;li&gt;
      And change the code of the UserControl to:&lt;br&gt;
      &lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset162\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red0\green128\blue0;}??\fs28 \cf1 namespace\cf0  Company.WPFDSLDesigner.DslPackage\par ??\{\par ??    \cf1 using\cf0  Microsoft.VisualStudio.Modeling.Shell;\par ??    \cf1 using\cf0  System.Collections.Generic;\par ??\par ??    \cf1 public\cf0  \cf1 partial\cf0  \cf1 class\cf0  \cf4 WPFDesigner\par ??\cf0     \{\par ??        \cf1 public\cf0  \cf4 ModelingDocView\cf0  DocView \{ \cf1 get\cf0 ; \cf1 set\cf0 ; \}\par ??        \cf1 protected\cf0  \cf4 ModelRoot\cf0  root;\par ??\par ??        \cf1 public\cf0  WPFDesigner()\par ??        \{\par ??            InitializeComponent();\par ??        \}\par ??\par ??        \cf1 public\cf0  WPFDesigner(\cf4 ModelingDocView\cf0  docView)\par ??            : \cf1 this\cf0 ()\par ??        \{\par ??            DocView = docView;\par ??        \}\par ??\par ??        \cf1 public\cf0  \cf1 void\cf0  DocumentLoaded()\par ??        \{\par ??            \cf1 if\cf0  (DocView != \cf1 null\cf0  &amp;amp;&amp;amp; DocView.DocData.RootElement != \cf1 null\cf0 )\par ??            \{\par ??                \cf5 // Had some problems binding to ModelRoot.Types directly. Using a custom list instead.\par ??\cf0                 \cf1 var\cf0  list = \cf1 new\cf0  \cf4 List\cf0 &amp;lt;\cf4 ModelType\cf0 &amp;gt;();\par ??                list.AddRange(((\cf4 ModelRoot\cf0 )DocView.DocData.RootElement).Types);\par ??                modelClassViewer.DataContext = list;\par ??            \}\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
      &lt;span style="color: rgb(43, 145, 175);"&gt;&lt;/span&gt;
      &lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset162\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red0\green128\blue0;}??\fs28 \cf1 namespace\cf0  Company.WPFDSLDesigner.DslPackage\par ??\{\par ??    \cf1 using\cf0  Microsoft.VisualStudio.Modeling.Shell;\par ??    \cf1 using\cf0  System.Collections.Generic;\par ??\par ??    \cf1 public\cf0  \cf1 partial\cf0  \cf1 class\cf0  \cf4 WPFDesigner\par ??\cf0     \{\par ??        \cf1 public\cf0  \cf4 ModelingDocView\cf0  DocView \{ \cf1 get\cf0 ; \cf1 set\cf0 ; \}\par ??        \cf1 protected\cf0  \cf4 ModelRoot\cf0  root;\par ??\par ??        \cf1 public\cf0  WPFDesigner()\par ??        \{\par ??            InitializeComponent();\par ??        \}\par ??\par ??        \cf1 public\cf0  WPFDesigner(\cf4 ModelingDocView\cf0  docView)\par ??            : \cf1 this\cf0 ()\par ??        \{\par ??            DocView = docView;\par ??        \}\par ??\par ??        \cf1 public\cf0  \cf1 void\cf0  DocumentLoaded()\par ??        \{\par ??            \cf1 if\cf0  (DocView != \cf1 null\cf0  &amp;amp;&amp;amp; DocView.DocData.RootElement != \cf1 null\cf0 )\par ??            \{\par ??                \cf5 // Had some problems binding to ModelRoot.Types directly. Using a custom list instead.\par ??\cf0                 \cf1 var\cf0  list = \cf1 new\cf0  \cf4 List\cf0 &amp;lt;\cf4 ModelType\cf0 &amp;gt;();\par ??                list.AddRange(((\cf4 ModelRoot\cf0 )DocView.DocData.RootElement).Types);\par ??                modelClassViewer.DataContext = list;\par ??            \}\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
      &lt;div style="background: white none repeat scroll 0% 50%; font-family: Consolas; font-size: 14pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
         &lt;div style="background: white none repeat scroll 0% 50%; font-family: Consolas; font-size: 14pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
            &lt;p style="margin: 0px;"&gt;
               &lt;span style="color: blue;"&gt;namespace&lt;/span&gt; Company.WPFDSLDesigner.DslPackage
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               {
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; Microsoft.VisualStudio.Modeling.Shell;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Collections.Generic;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;partial&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;WPFDesigner&lt;/span&gt;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; {
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;ModelingDocView&lt;/span&gt; DocView
               { &lt;span style="color: blue;"&gt;get&lt;/span&gt;; &lt;span style="color: blue;"&gt;set&lt;/span&gt;; }
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;protected&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;ModelRoot&lt;/span&gt; root;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; WPFDesigner()
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; InitializeComponent();
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; WPFDesigner(&lt;span style="color: rgb(43, 145, 175);"&gt;ModelingDocView&lt;/span&gt; docView)
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; : &lt;span style="color: blue;"&gt;this&lt;/span&gt;()
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DocView = docView;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; DocumentLoaded()
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (DocView
               != &lt;span style="color: blue;"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; DocView.DocData.RootElement != &lt;span style="color: blue;"&gt;null&lt;/span&gt;)
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;//
               Had some problems binding to ModelRoot.Types directly. Using a custom list instead.&lt;/span&gt;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;var&lt;/span&gt; list
               = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ModelType&lt;/span&gt;&amp;gt;();
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; list.AddRange(((&lt;span style="color: rgb(43, 145, 175);"&gt;ModelRoot&lt;/span&gt;)DocView.DocData.RootElement).Types);
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; modelClassViewer.DataContext
               = list;
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp; }
            &lt;/p&gt;
            &lt;p style="margin: 0px;"&gt;
               }
            &lt;/p&gt;
         &lt;/div&gt;
      &lt;/div&gt;
      &lt;br&gt;
   &lt;/li&gt;
   &lt;li&gt;
      Your final project structure should be looking something like this:&lt;br&gt;
      &lt;img src="http://altinoren.com/content/binary/FinalSolution.png" border="0"&gt;
      &lt;br&gt;
   &lt;/li&gt;
   &lt;li&gt;
      Run the solution to open the Debugging project. Open the &lt;b&gt;Sample.mydslx&lt;/b&gt; file.
      That's all.&lt;/li&gt;
&lt;/ul&gt;
And the result is:&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img src="http://altinoren.com/content/binary/WPFDSLEditorResult.png" border="0"&gt;
&lt;br&gt;
&lt;br&gt;
Nothing fancy at the moment, but it's pure WPF. Add some compartment shapes and connectors,
layout the entities rather than using a StackPanel and you're almost done. Nested
shapes and such should be a breeze to implement.&lt;br&gt;
&lt;br&gt;
Thank god they're working on this some future version of DSL Tools, WPF is so powerful
to customize. I'm expecting that in the final version, we'll optionally be able to
provide our own templates instead of the generated ones for customize-like-hell experiences.&lt;br&gt;
&lt;br&gt;
Here are some future research points for the implementation above:&lt;br&gt;
&lt;ul&gt;
   &lt;li&gt;
      We can write a code generator to create shapes based on the Diagram Element properties
      in DslDefinition.dsl. Compartments, decorators, appearance properties etc. Why enumerate
      a bunch of types at runtime when we're already generating the rest design time?&lt;br&gt;
   &lt;/li&gt;
   &lt;li&gt;
      Databinding to LinkedElementCollection failed pretty bad, VS kept crashing in every
      single case. Hey, I want to use built-in collections. Any INotifyCollectionChanged,
      by the way?&lt;br&gt;
   &lt;/li&gt;
   &lt;li&gt;
      We should be mapping WPF menu items to package menus (VSCT). Add new property, validate
      etc.&lt;br&gt;
   &lt;/li&gt;
   &lt;li&gt;
      We should either use the original .designer file structure to persist the layout etc.
      or find a way to store that data somewhere. (Designer file is the best)&lt;/li&gt;
   &lt;li&gt;
      Performance is not so great. I tried some 3D and it's even worse, much worse. There's
      something fishy going-on when you host a WPF control on top of a win32 container,
      or in VS, or both.&lt;br&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=643ec407-4fe1-4238-a24e-20ef8b134a99" /&gt;</description>
      <comments>http://altinoren.com/CommentView,guid,643ec407-4fe1-4238-a24e-20ef8b134a99.aspx</comments>
      <category>Code Generation;DSL Tools;VSIP;VSX;WPF</category>
    <feedburner:origLink>http://altinoren.com/PermaLink,guid,643ec407-4fe1-4238-a24e-20ef8b134a99.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://altinoren.com/Trackback.aspx?guid=73958408-c42d-428c-b820-a606dded2c81</trackback:ping>
      <pingback:server>http://altinoren.com/pingback.aspx</pingback:server>
      <pingback:target>http://altinoren.com/PermaLink,guid,73958408-c42d-428c-b820-a606dded2c81.aspx</pingback:target>
      <dc:creator>gokhan@altinoren.com (Gokhan Altinoren)</dc:creator>
      <wfw:comment>http://altinoren.com/CommentView,guid,73958408-c42d-428c-b820-a606dded2c81.aspx</wfw:comment>
      <wfw:commentRss>http://altinoren.com/SyndicationService.asmx/GetEntryCommentsRss?guid=73958408-c42d-428c-b820-a606dded2c81</wfw:commentRss>
      <slash:comments>7</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">At last. Preview 4 is <a href="http://using.castleproject.org/display/Contrib/ActiveWriter">here</a>.
   Spread the word :)<br /><br />
   I'm very sorry that I couldn't be able to align this release with the Visual Studio
   2008 release back in November. I failed to allocate time and couldn't be able to organize
   people trying to help. Won't do that again.<br /><br />
   There are still lots of thing to do but AW is getting much better with each release,
   thanks to patch submissions and suggestions. Here's the complete what's new list:<br /><br /><b>New:<br /></b><ul><li>
         Added support for Flush for ManyToOneRelation</li><li>
         Added partial Oracle drag and drop support. (Patch: Yavor Shahpasov)</li><li>
         Generates metadata about properties to be used in queries (as in ICriterion selectCriterium
         = Expression.Eq(User.Properties.Name, name); )(Thanks: Rudi van den Belt)</li><li>
         Contrib-30: Add flag to property to mark it with the DefaultMemberAttribute (or do
         it by default for primary key fields) (Thanks: Michael Hawksworth)</li><li>
         Contrib-50: (Revised description) Allow user defined imports to replace generated
         imports. (Thanks: Michael Hawksworth)</li><li>
         Contrib-54: Integrate NHibernateQueryGenerator into ActiveWriter (Thanks: Steve Degosserie)</li><li>
         Contrib-81: Added list relation type. (Patch: Grimace of Despair)</li><li>
         Moved all to vS2008</li><li>
         Moved binaries license from "as is" to Apache v2. We don't need DSL Tools redistributables
         in setup package anymore.</li></ul><b>Fixed:</b><br /><ul><li>
         ManyToOne SourceNotNull is now working propertly</li><li>
         Incorrectly generates Some pascal case fields as camel case.</li><li>
         Contrib-52: (Revised description) Generic types are incorrectly generated if the given
         type name already includes generic parameters. (Thanks: Hugo Burm)</li><li>
         CONTRIB-59: (Revised description) Problems with NHQG integration when the temporary
         path, used for out argument, contains spaces. (Patch: Steve Degosserie)</li><li>
         Contrib-56: When creating a many-one relation, the generation of the Ilist should
         always be generic, independent of the generic settings for the objects. (Thanks: Robert
         van Hoornaar)</li><li>
         Contrib-61: (If the namespace cannot be retrieved from the VS project system) When
         a class is added to a model, the .hbm.xml file that is added as a nested file is missing
         the first character of the class name in the filename. (Thanks: David Gardiner)</li><li>
         Contrib-63: VB projects can have a default root Namespace. ActiveWriter should take
         this into account when generating the mapping files. It currently appears to only
         use the model's Namespace property. (Patch: David Gardiner)</li><li>
         Contrib-66: The private field used by the relation properties should be initialised
         with a constructor (Patch: David Gardiner) (Added as a model level option, defaults
         to false)</li><li>
         Contrib-69: Generated VB code should respect project's Option Strict setting (Patch:
         David Gardiner)</li><li>
         Contrib-70: Using a custom type that is defined in a user project fails (Partial patch:
         David Gardiner)</li><li>
         Contrib-72: Option to remove prefix from generated property names.(Patch: David Gardiner)
         (Implemented as model level RegEx)</li><li>
         Contrib-73: Look for Castle.ActiveWriter and NHibernate in project references. (Patch:
         David Gardiner)</li><li>
         Oracle support is now fully working (Patch: Marjan Flis)</li></ul>
   There are some bug fixes and improvements in the DSL Tools itself, which directly
   affects AW. Most notably, the giant red X problem happening time to time when you
   drag-drop items from Server Explorer is gone with the 2008 release. Another improvement
   is, DSL Tools redistributables are now included in the IDE, so they're not included
   in the AW setup, resulting in a smaller download.<br /><br />
   Preview 4 will be the last release for VS 2005. It's very hard for me to maintain
   both 2005 and 2008 versions, so I'm planning to continue with 2008-only releases.
   But if you encounter a show-stopper bug in 2005 release, I'll fix it.<br /><br />
   As always, you can mail me using "gokhan (a) altinoren.com" with all your suggestions
   and patches.<br /><p /><img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=73958408-c42d-428c-b820-a606dded2c81" /><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/altinoren/~4/67OOOnQGd8g" height="1" width="1" /></body>
      <title>End Of The Dark Ages Of ActiveWriter</title>
      <guid isPermaLink="false">http://altinoren.com/PermaLink,guid,73958408-c42d-428c-b820-a606dded2c81.aspx</guid>
      <link>http://feedproxy.google.com/~r/altinoren/~3/67OOOnQGd8g/PermaLink,guid,73958408-c42d-428c-b820-a606dded2c81.aspx</link>
      <pubDate>Tue, 08 Apr 2008 10:11:14 GMT</pubDate>
      <description>At last. Preview 4 is &lt;a href="http://using.castleproject.org/display/Contrib/ActiveWriter"&gt;here&lt;/a&gt;.
Spread the word :)&lt;br&gt;
&lt;br&gt;
I'm very sorry that I couldn't be able to align this release with the Visual Studio
2008 release back in November. I failed to allocate time and couldn't be able to organize
people trying to help. Won't do that again.&lt;br&gt;
&lt;br&gt;
There are still lots of thing to do but AW is getting much better with each release,
thanks to patch submissions and suggestions. Here's the complete what's new list:&lt;br&gt;
&lt;br&gt;
&lt;b&gt;New:&lt;br&gt;
&lt;/b&gt;
&lt;ul&gt;
   &lt;li&gt;
      Added support for Flush for ManyToOneRelation&lt;/li&gt;
   &lt;li&gt;
      Added partial Oracle drag and drop support. (Patch: Yavor Shahpasov)&lt;/li&gt;
   &lt;li&gt;
      Generates metadata about properties to be used in queries (as in ICriterion selectCriterium
      = Expression.Eq(User.Properties.Name, name); )(Thanks: Rudi van den Belt)&lt;/li&gt;
   &lt;li&gt;
      Contrib-30: Add flag to property to mark it with the DefaultMemberAttribute (or do
      it by default for primary key fields) (Thanks: Michael Hawksworth)&lt;/li&gt;
   &lt;li&gt;
      Contrib-50: (Revised description) Allow user defined imports to replace generated
      imports. (Thanks: Michael Hawksworth)&lt;/li&gt;
   &lt;li&gt;
      Contrib-54: Integrate NHibernateQueryGenerator into ActiveWriter (Thanks: Steve Degosserie)&lt;/li&gt;
   &lt;li&gt;
      Contrib-81: Added list relation type. (Patch: Grimace of Despair)&lt;/li&gt;
   &lt;li&gt;
      Moved all to vS2008&lt;/li&gt;
   &lt;li&gt;
      Moved binaries license from "as is" to Apache v2. We don't need DSL Tools redistributables
      in setup package anymore.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Fixed:&lt;/b&gt;
&lt;br&gt;
&lt;ul&gt;
   &lt;li&gt;
      ManyToOne SourceNotNull is now working propertly&lt;/li&gt;
   &lt;li&gt;
      Incorrectly generates Some pascal case fields as camel case.&lt;/li&gt;
   &lt;li&gt;
      Contrib-52: (Revised description) Generic types are incorrectly generated if the given
      type name already includes generic parameters. (Thanks: Hugo Burm)&lt;/li&gt;
   &lt;li&gt;
      CONTRIB-59: (Revised description) Problems with NHQG integration when the temporary
      path, used for out argument, contains spaces. (Patch: Steve Degosserie)&lt;/li&gt;
   &lt;li&gt;
      Contrib-56: When creating a many-one relation, the generation of the Ilist should
      always be generic, independent of the generic settings for the objects. (Thanks: Robert
      van Hoornaar)&lt;/li&gt;
   &lt;li&gt;
      Contrib-61: (If the namespace cannot be retrieved from the VS project system) When
      a class is added to a model, the .hbm.xml file that is added as a nested file is missing
      the first character of the class name in the filename. (Thanks: David Gardiner)&lt;/li&gt;
   &lt;li&gt;
      Contrib-63: VB projects can have a default root Namespace. ActiveWriter should take
      this into account when generating the mapping files. It currently appears to only
      use the model's Namespace property. (Patch: David Gardiner)&lt;/li&gt;
   &lt;li&gt;
      Contrib-66: The private field used by the relation properties should be initialised
      with a constructor (Patch: David Gardiner) (Added as a model level option, defaults
      to false)&lt;/li&gt;
   &lt;li&gt;
      Contrib-69: Generated VB code should respect project's Option Strict setting (Patch:
      David Gardiner)&lt;/li&gt;
   &lt;li&gt;
      Contrib-70: Using a custom type that is defined in a user project fails (Partial patch:
      David Gardiner)&lt;/li&gt;
   &lt;li&gt;
      Contrib-72: Option to remove prefix from generated property names.(Patch: David Gardiner)
      (Implemented as model level RegEx)&lt;/li&gt;
   &lt;li&gt;
      Contrib-73: Look for Castle.ActiveWriter and NHibernate in project references. (Patch:
      David Gardiner)&lt;/li&gt;
   &lt;li&gt;
      Oracle support is now fully working (Patch: Marjan Flis)&lt;/li&gt;
&lt;/ul&gt;
There are some bug fixes and improvements in the DSL Tools itself, which directly
affects AW. Most notably, the giant red X problem happening time to time when you
drag-drop items from Server Explorer is gone with the 2008 release. Another improvement
is, DSL Tools redistributables are now included in the IDE, so they're not included
in the AW setup, resulting in a smaller download.&lt;br&gt;
&lt;br&gt;
Preview 4 will be the last release for VS 2005. It's very hard for me to maintain
both 2005 and 2008 versions, so I'm planning to continue with 2008-only releases.
But if you encounter a show-stopper bug in 2005 release, I'll fix it.&lt;br&gt;
&lt;br&gt;
As always, you can mail me using "gokhan (a) altinoren.com" with all your suggestions
and patches.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=73958408-c42d-428c-b820-a606dded2c81" /&gt;</description>
      <comments>http://altinoren.com/CommentView,guid,73958408-c42d-428c-b820-a606dded2c81.aspx</comments>
    <feedburner:origLink>http://altinoren.com/PermaLink,guid,73958408-c42d-428c-b820-a606dded2c81.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://altinoren.com/Trackback.aspx?guid=4e1440b9-097e-4363-bcff-32957ae6a86e</trackback:ping>
      <pingback:server>http://altinoren.com/pingback.aspx</pingback:server>
      <pingback:target>http://altinoren.com/PermaLink,guid,4e1440b9-097e-4363-bcff-32957ae6a86e.aspx</pingback:target>
      <dc:creator>gokhan@altinoren.com (Gokhan Altinoren)</dc:creator>
      <wfw:comment>http://altinoren.com/CommentView,guid,4e1440b9-097e-4363-bcff-32957ae6a86e.aspx</wfw:comment>
      <wfw:commentRss>http://altinoren.com/SyndicationService.asmx/GetEntryCommentsRss?guid=4e1440b9-097e-4363-bcff-32957ae6a86e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">It appears that people are having trouble
   finding templates for some of the documents mentioned in <a href="http://altinoren.com/PermaLink,guid,120647c4-69e4-43a4-a784-0180f58dd877.aspx">MSF
   Deliverables Matrix</a>. Here is the Initial Risk Assessment template I created for
   a client, an excel representation of the ideas in <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=6c2f2c7e-ddbd-448c-a218-074d88240942">MSF
   Risk Management Discipline v1.1</a> document. Enjoy.<br /><p /><a href="http://altinoren.com/content/binary/Initial%20Risk%20Assessment.xlsx">Initial
   Risk Assessment.xlsx (21.81 KB)</a><img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=4e1440b9-097e-4363-bcff-32957ae6a86e" /><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/altinoren/~4/JFI9V9XDXMI" height="1" width="1" /></body>
      <title>MSF Initial Risk Assessment Template</title>
      <guid isPermaLink="false">http://altinoren.com/PermaLink,guid,4e1440b9-097e-4363-bcff-32957ae6a86e.aspx</guid>
      <link>http://feedproxy.google.com/~r/altinoren/~3/JFI9V9XDXMI/PermaLink,guid,4e1440b9-097e-4363-bcff-32957ae6a86e.aspx</link>
      <pubDate>Thu, 03 Apr 2008 07:34:26 GMT</pubDate>
      <description>It appears that people are having trouble finding templates for some of the documents mentioned in &lt;a href="http://altinoren.com/PermaLink,guid,120647c4-69e4-43a4-a784-0180f58dd877.aspx"&gt;MSF
Deliverables Matrix&lt;/a&gt;. Here is the Initial Risk Assessment template I created for
a client, an excel representation of the ideas in &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=6c2f2c7e-ddbd-448c-a218-074d88240942"&gt;MSF
Risk Management Discipline v1.1&lt;/a&gt; document. Enjoy.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;a href="http://altinoren.com/content/binary/Initial%20Risk%20Assessment.xlsx"&gt;Initial
Risk Assessment.xlsx (21.81 KB)&lt;/a&gt;&lt;img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=4e1440b9-097e-4363-bcff-32957ae6a86e" /&gt;</description>
      <comments>http://altinoren.com/CommentView,guid,4e1440b9-097e-4363-bcff-32957ae6a86e.aspx</comments>
      <category>MSF</category>
    <feedburner:origLink>http://altinoren.com/PermaLink,guid,4e1440b9-097e-4363-bcff-32957ae6a86e.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://altinoren.com/Trackback.aspx?guid=a530ffb1-34d1-49f8-a093-888d6354e91a</trackback:ping>
      <pingback:server>http://altinoren.com/pingback.aspx</pingback:server>
      <pingback:target>http://altinoren.com/PermaLink,guid,a530ffb1-34d1-49f8-a093-888d6354e91a.aspx</pingback:target>
      <dc:creator>gokhan@altinoren.com (Gokhan Altinoren)</dc:creator>
      <wfw:comment>http://altinoren.com/CommentView,guid,a530ffb1-34d1-49f8-a093-888d6354e91a.aspx</wfw:comment>
      <wfw:commentRss>http://altinoren.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a530ffb1-34d1-49f8-a093-888d6354e91a</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">Just for the fun :)<br /><p /><img src="http://altinoren.com/content/binary/tddoang.png" border="0" /><br /><br />
   Download: <a href="http://altinoren.com/content/binary/TDDOANG.pdf">TDDOANG.pdf (734.42
   KB)</a><br /><br />
   Notes:<br /><ul><li>
         Yeah. I know it's not complete / 100% accurate.</li><li>
         Yep. There are other tools, I know.<br /></li><li>
         Yes, Alt.Net is not the authority. But it's the most active community in MS ecosystem
         right now where you can ask questions on TDD.<br /></li></ul><img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=a530ffb1-34d1-49f8-a093-888d6354e91a" /><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/altinoren/~4/nTTUBC2iGp8" height="1" width="1" /></body>
      <title>TDD Poster - IKEA Style</title>
      <guid isPermaLink="false">http://altinoren.com/PermaLink,guid,a530ffb1-34d1-49f8-a093-888d6354e91a.aspx</guid>
      <link>http://feedproxy.google.com/~r/altinoren/~3/nTTUBC2iGp8/PermaLink,guid,a530ffb1-34d1-49f8-a093-888d6354e91a.aspx</link>
      <pubDate>Sat, 01 Dec 2007 11:29:37 GMT</pubDate>
      <description>Just for the fun :)&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img src="http://altinoren.com/content/binary/tddoang.png" border="0"&gt;
&lt;br&gt;
&lt;br&gt;
Download: &lt;a href="http://altinoren.com/content/binary/TDDOANG.pdf"&gt;TDDOANG.pdf (734.42
KB)&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
Notes:&lt;br&gt;
&lt;ul&gt;
   &lt;li&gt;
      Yeah. I know it's not complete / 100% accurate.&lt;/li&gt;
   &lt;li&gt;
      Yep. There are other tools, I know.&lt;br&gt;
   &lt;/li&gt;
   &lt;li&gt;
      Yes, Alt.Net is not the authority. But it's the most active community in MS ecosystem
      right now where you can ask questions on TDD.&lt;br&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=a530ffb1-34d1-49f8-a093-888d6354e91a" /&gt;</description>
      <comments>http://altinoren.com/CommentView,guid,a530ffb1-34d1-49f8-a093-888d6354e91a.aspx</comments>
      <category>TDD</category>
    <feedburner:origLink>http://altinoren.com/PermaLink,guid,a530ffb1-34d1-49f8-a093-888d6354e91a.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://altinoren.com/Trackback.aspx?guid=bca628f2-3277-4d51-a266-6cee50f0a657</trackback:ping>
      <pingback:server>http://altinoren.com/pingback.aspx</pingback:server>
      <pingback:target>http://altinoren.com/PermaLink,guid,bca628f2-3277-4d51-a266-6cee50f0a657.aspx</pingback:target>
      <dc:creator>gokhan@altinoren.com (Gokhan Altinoren)</dc:creator>
      <wfw:comment>http://altinoren.com/CommentView,guid,bca628f2-3277-4d51-a266-6cee50f0a657.aspx</wfw:comment>
      <wfw:commentRss>http://altinoren.com/SyndicationService.asmx/GetEntryCommentsRss?guid=bca628f2-3277-4d51-a266-6cee50f0a657</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">A small tidbit. In WCF, service code like
   this<br /><br /><div style="background: black none repeat scroll 0% 50%; font-family: Consolas; font-size: 12pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><p style="margin: 0px;"><span style="color: rgb(255, 128, 0);">public</span><span style="color: rgb(255, 128, 0);">string</span> MyServiceMethod()
      </p><p style="margin: 0px;">
         {
      </p><p style="margin: 0px;">
             <span style="color: rgb(255, 128, 0);">throw</span><span style="color: rgb(255, 128, 0);">new</span><span style="color: yellow;">FaultException</span>&lt;<span style="color: rgb(255, 128, 0);">string</span>&gt;(<span style="color: lime;">"It
         happened!"</span>);
      </p><p style="margin: 0px;">
         }
      </p></div><br />
   will make VS break into debugger. Normally you just throw FaultException's, knowing
   that the dispatcher hadles it to convert it to a fault contract message. But VS thinks
   that it's an unhandled user exception (it is, actualy). For a smoother debugging experience,
   just add <b>System.ServiceModel.FaultException`1</b> to <b>Debug / Exceptions / Common
   Language Runtime Exceptions</b>, unchecked.<br /><br /><img src="http://altinoren.com/content/binary/unhandledfaultexception.jpg" /><br /><p /><img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=bca628f2-3277-4d51-a266-6cee50f0a657" /><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/altinoren/~4/BbEawRppe8U" height="1" width="1" /></body>
      <title>Train Visual Studio to keep quiet for FaultException</title>
      <guid isPermaLink="false">http://altinoren.com/PermaLink,guid,bca628f2-3277-4d51-a266-6cee50f0a657.aspx</guid>
      <link>http://feedproxy.google.com/~r/altinoren/~3/BbEawRppe8U/PermaLink,guid,bca628f2-3277-4d51-a266-6cee50f0a657.aspx</link>
      <pubDate>Fri, 23 Nov 2007 07:07:15 GMT</pubDate>
      <description>A small tidbit. In WCF, service code like this&lt;br&gt;
&lt;br&gt;
&lt;div style="background: black none repeat scroll 0% 50%; font-family: Consolas; font-size: 12pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
   &lt;p style="margin: 0px;"&gt;
      &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; MyServiceMethod()
   &lt;/p&gt;
   &lt;p style="margin: 0px;"&gt;
      {
   &lt;/p&gt;
   &lt;p style="margin: 0px;"&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(255, 128, 0);"&gt;throw&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;FaultException&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;&amp;gt;(&lt;span style="color: lime;"&gt;"It
      happened!"&lt;/span&gt;);
   &lt;/p&gt;
   &lt;p style="margin: 0px;"&gt;
      }
   &lt;/p&gt;
&lt;/div&gt;
&lt;br&gt;
will make VS break into debugger. Normally you just throw FaultException's, knowing
that the dispatcher hadles it to convert it to a fault contract message. But VS thinks
that it's an unhandled user exception (it is, actualy). For a smoother debugging experience,
just add &lt;b&gt;System.ServiceModel.FaultException`1&lt;/b&gt; to &lt;b&gt;Debug / Exceptions / Common
Language Runtime Exceptions&lt;/b&gt;, unchecked.&lt;br&gt;
&lt;br&gt;
&lt;img src="http://altinoren.com/content/binary/unhandledfaultexception.jpg"&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=bca628f2-3277-4d51-a266-6cee50f0a657" /&gt;</description>
      <comments>http://altinoren.com/CommentView,guid,bca628f2-3277-4d51-a266-6cee50f0a657.aspx</comments>
      <category>Visual Studio;WCF</category>
    <feedburner:origLink>http://altinoren.com/PermaLink,guid,bca628f2-3277-4d51-a266-6cee50f0a657.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://altinoren.com/Trackback.aspx?guid=7c26bba3-f2ed-4aaf-a883-c368e1ab4a7a</trackback:ping>
      <pingback:server>http://altinoren.com/pingback.aspx</pingback:server>
      <pingback:target>http://altinoren.com/PermaLink,guid,7c26bba3-f2ed-4aaf-a883-c368e1ab4a7a.aspx</pingback:target>
      <dc:creator>gokhan@altinoren.com (Gokhan Altinoren)</dc:creator>
      <wfw:comment>http://altinoren.com/CommentView,guid,7c26bba3-f2ed-4aaf-a883-c368e1ab4a7a.aspx</wfw:comment>
      <wfw:commentRss>http://altinoren.com/SyndicationService.asmx/GetEntryCommentsRss?guid=7c26bba3-f2ed-4aaf-a883-c368e1ab4a7a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I have seen Roy's frustration on having
   a will-expire VPC on the lap, three days before a serious event where he is the speaker
   planning to use the exact same VPC! Yay.<br /><br />
   Here's a quick <b>possible fix</b> to the problem before 1st of November. This is
   the ninja tactic I have been using for expired VPC's for whatever reason.<br /><br /><ol><li>
         Break the date synchronization between the host (your pc) and the VPC image.<br />
         To do this, you should add the following lines (in bold) to the .vmc file (I did this
         to both Base01 and OrcasBeta2_VSTS vmc files, to be safe):<br />
             &lt;!-- ... other things --&gt;<br />
             &lt;integration&gt;<br />
                 &lt;microsoft&gt;<br />
                   &lt;!-- ... other things --&gt;<br /><b>            &lt;components&gt;<br />
                         &lt;host_time_sync&gt;<br />
                            
         &lt;enabled type="boolean"&gt;false&lt;/enabled&gt;<br />
                         &lt;/host_time_sync&gt;<br />
                     &lt;/components&gt;</b><br />
                 &lt;/microsoft&gt;<br />
             &lt;/integration&gt;<br /></li><li>
         Start VPC image. Change date to sometime in the past.</li><li>
         Restart VPC, it won't be in sync with the host anymore. 
         <br /></li></ol>
   I tested this by changing my computer's time to 2nd of November, worked for me as
   shown in the following screenshot:<p /><img src="http://altinoren.com/content/binary/VS2008NotExpiring.png" border="0" /><br /><br />
   Based on my past experience it will work forever, but I'm not guaranteeing anything.
   I don't know if this will work when the actual day comes for this particular VPC image.
   So, backup your data, don't rely on this for the morning of 1st of November, and take
   this info AS IS.<br /><br /><font color="#ff0000"><b>Update:</b></font><br /><a href="http://blogs.msdn.com/jeffbe">Jeff Beehler</a><a href="http://blogs.msdn.com/jeffbe/archive/2007/10/25/vs2008-beta2-vpcs-expiring-prematurely.aspx">says</a>:<br /><blockquote><p><i>"I would strongly advise against changing the system time on the VPC if you're
      using TFS as TFS counts on time always moving forward.  You cannot make a check
      in or save a work item with an earlier date than the last one for obvious reasons.
       So, if you're using the VPC in production, you could get yourself into a situation
      where you can't check in which would obviously be problematic."</i></p></blockquote>He has also a <a href="http://blogs.msdn.com/jeffbe/archive/2007/10/27/update-on-expiring-vs2008-beta2-vpcs.aspx">solution</a> for
   the expiration problem if you have a valid 2003 Server media and key.<br /><br />
   So, yes, unless you're using TFS on the image, you may use this trick. And this makes
   it invalid for Roy's case.<br /><img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=7c26bba3-f2ed-4aaf-a883-c368e1ab4a7a" /><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/altinoren/~4/PGuPB-z9yFY" height="1" width="1" /></body>
      <title>How to Prevent VS2008 Beta2 VPC from Expiring</title>
      <guid isPermaLink="false">http://altinoren.com/PermaLink,guid,7c26bba3-f2ed-4aaf-a883-c368e1ab4a7a.aspx</guid>
      <link>http://feedproxy.google.com/~r/altinoren/~3/PGuPB-z9yFY/PermaLink,guid,7c26bba3-f2ed-4aaf-a883-c368e1ab4a7a.aspx</link>
      <pubDate>Mon, 29 Oct 2007 12:51:31 GMT</pubDate>
      <description>I have seen Roy's frustration on having a will-expire VPC on the lap,
three days before a serious event where he is the speaker planning to
use the exact same VPC! Yay.&lt;br&gt;
&lt;br&gt;
Here's a quick &lt;b&gt;possible fix&lt;/b&gt; to the problem before 1st of November. This is
the ninja tactic I have been using for expired VPC's for whatever reason.&lt;br&gt;
&lt;br&gt;
&lt;ol&gt;
   &lt;li&gt;
      Break the date synchronization between the host (your pc) and the VPC image.&lt;br&gt;
      To do this, you should add the following lines (in bold) to the .vmc file (I did this
      to both Base01 and OrcasBeta2_VSTS vmc files, to be safe):&lt;br&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!-- ... other things --&amp;gt;&lt;br&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;integration&amp;gt;&lt;br&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;microsoft&amp;gt;&lt;br&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!-- ... other things --&amp;gt;&lt;br&gt;
      &lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;components&amp;gt;&lt;br&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;host_time_sync&amp;gt;&lt;br&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
      &amp;lt;enabled type="boolean"&amp;gt;false&amp;lt;/enabled&amp;gt;&lt;br&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/host_time_sync&amp;gt;&lt;br&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/components&amp;gt;&lt;/b&gt;
      &lt;br&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/microsoft&amp;gt;&lt;br&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/integration&amp;gt;&lt;br&gt;
   &lt;/li&gt;
   &lt;li&gt;
      Start VPC image. Change date to sometime in the past.&lt;/li&gt;
   &lt;li&gt;
      Restart VPC, it won't be in sync with the host anymore. 
      &lt;br&gt;
   &lt;/li&gt;
&lt;/ol&gt;
I tested this by changing my computer's time to 2nd of November, worked for me as
shown in the following screenshot:&lt;p&gt;
&lt;/p&gt;
&lt;img src="http://altinoren.com/content/binary/VS2008NotExpiring.png" border="0"&gt;
&lt;br&gt;
&lt;br&gt;
Based on my past experience it will work forever, but I'm not guaranteeing anything.
I don't know if this will work when the actual day comes for this particular VPC image.
So, backup your data, don't rely on this for the morning of 1st of November, and take
this info AS IS.&lt;br&gt;
&lt;br&gt;
&lt;font color="#ff0000"&gt;&lt;b&gt;Update:&lt;/b&gt;&lt;/font&gt;
&lt;br&gt;
&lt;a href="http://blogs.msdn.com/jeffbe"&gt;Jeff Beehler&lt;/a&gt; &lt;a href="http://blogs.msdn.com/jeffbe/archive/2007/10/25/vs2008-beta2-vpcs-expiring-prematurely.aspx"&gt;says&lt;/a&gt;:&lt;br&gt;
&lt;blockquote&gt;
&lt;p&gt;
   &lt;i&gt;"I would strongly advise against changing the system time on the VPC if you're
   using TFS as TFS counts on time always moving forward. &amp;nbsp;You cannot make a check
   in or save a work item with an earlier date than the last one for obvious reasons.
   &amp;nbsp;So, if you're using the VPC in production, you could get yourself into a situation
   where you can't check in which would obviously be problematic."&lt;/i&gt;
&lt;/p&gt;
&lt;/blockquote&gt;He has also a &lt;a href="http://blogs.msdn.com/jeffbe/archive/2007/10/27/update-on-expiring-vs2008-beta2-vpcs.aspx"&gt;solution&lt;/a&gt; for
the expiration problem if you have a valid 2003 Server media and key.&lt;br&gt;
&lt;br&gt;
So, yes, unless you're using TFS on the image, you may use this trick. And this makes
it invalid for Roy's case.&lt;br&gt;
&lt;img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=7c26bba3-f2ed-4aaf-a883-c368e1ab4a7a" /&gt;</description>
      <comments>http://altinoren.com/CommentView,guid,7c26bba3-f2ed-4aaf-a883-c368e1ab4a7a.aspx</comments>
      <category>Visual Studio</category>
    <feedburner:origLink>http://altinoren.com/PermaLink,guid,7c26bba3-f2ed-4aaf-a883-c368e1ab4a7a.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://altinoren.com/Trackback.aspx?guid=d7be66c4-3dc1-4c91-b84e-aa22c01d2948</trackback:ping>
      <pingback:server>http://altinoren.com/pingback.aspx</pingback:server>
      <pingback:target>http://altinoren.com/PermaLink,guid,d7be66c4-3dc1-4c91-b84e-aa22c01d2948.aspx</pingback:target>
      <dc:creator>gokhan@altinoren.com (Gokhan Altinoren)</dc:creator>
      <wfw:comment>http://altinoren.com/CommentView,guid,d7be66c4-3dc1-4c91-b84e-aa22c01d2948.aspx</wfw:comment>
      <wfw:commentRss>http://altinoren.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d7be66c4-3dc1-4c91-b84e-aa22c01d2948</wfw:commentRss>
      <slash:comments>23</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">This is mainly a service release, fixing
   some nasty bugs or "features".<br /><br />
   AW now supports international versions of Visual Studio better. Preview 3 introduced
   hbm.xml generation but a bug prevented it to be usable without intevention. And drag-drop
   support for MySQL was broken if the user have a different version of Connector installed.
   All should work OK now.<br /><br />
   Download <a href="http://altinoren.com/activewriter/downloads.htm">here</a>.<br /><br /><strong>Preview 3.1 Release - 18/08/2007<br /><br /></strong>What's New:<br /><ul><li>
         CONTRIB-31: "Lazy" One-to-One relation. (Thanks: Gabriel Schenker)</li></ul><p>
      Fixes:
   </p><ul><li>
         Server Explorer drag'n drop is now supported on international versions of VS. (Patch:
         Daniel Rothmaler)</li><li>
         Server Explorer support changed to VS Connection Service and its Connection Hierarchies,
         instead of the Server Explorer's UIHierarchies to prevent the flicker during the hierarchy
         traversing process. (Patch: Daniel Rothmaler)</li><li>
         Closing <a href="This%20is%20mainly%20a%20service%20release,%20fixing%20some%20nasty%20bugs%20or%20%22features%22.">Contrib-25</a>.
         ValidateNotSameAttribute Won't be supported ATM.</li><li><a href="http://support.castleproject.org/browse/CONTRIB-33">CONTRIB-33</a>: When
         adding a table (SQL Server) to the designer which has a primary key of type uniqueidentifier
         ActiveWriter should use "Guid" instead of "Native" as generator (Thanks: Gabriel Schenker)</li><li><font color="#000000">Assembly names in NHibernate configs are incorrectly stripped
         from the name. (Thanx: Fedde)</font></li><li><font color="#000000">Removed dependency to MySQL.Data.dll to prevent runtime version
         conflicts. Moved to IDbConnection for all metadata retrieval jobs. (Thanks: Joao Paulo
         Marques and Shane)</font></li></ul><br /><a href="http://altinoren.com/content/binary/ActiveWriter%20Preview%203.1.rar" /><img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=d7be66c4-3dc1-4c91-b84e-aa22c01d2948" /><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/altinoren/~4/Iu-lU29cZVA" height="1" width="1" /></body>
      <title>ActiveWriter Preview 3.1 - Fixing Nasties</title>
      <guid isPermaLink="false">http://altinoren.com/PermaLink,guid,d7be66c4-3dc1-4c91-b84e-aa22c01d2948.aspx</guid>
      <link>http://feedproxy.google.com/~r/altinoren/~3/Iu-lU29cZVA/PermaLink,guid,d7be66c4-3dc1-4c91-b84e-aa22c01d2948.aspx</link>
      <pubDate>Sat, 18 Aug 2007 12:39:10 GMT</pubDate>
      <description>This is mainly a service release, fixing some nasty bugs or "features".&lt;br&gt;
&lt;br&gt;
AW now supports international versions of Visual Studio better. Preview 3 introduced
hbm.xml generation but a bug prevented it to be usable without intevention. And drag-drop
support for MySQL was broken if the user have a different version of Connector installed.
All should work OK now.&lt;br&gt;
&lt;br&gt;
Download &lt;a href="http://altinoren.com/activewriter/downloads.htm"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;Preview 3.1 Release - 18/08/2007&lt;br&gt;
&lt;br&gt;
&lt;/strong&gt;What's New:&lt;br&gt;
&lt;ul&gt;
   &lt;li&gt;
      CONTRIB-31: "Lazy" One-to-One relation. (Thanks: Gabriel Schenker)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   Fixes:
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      Server Explorer drag'n drop is now supported on international versions of VS. (Patch:
      Daniel Rothmaler)&lt;/li&gt;
   &lt;li&gt;
      Server Explorer support changed to VS Connection Service and its Connection Hierarchies,
      instead of the Server Explorer's UIHierarchies to prevent the flicker during the hierarchy
      traversing process. (Patch: Daniel Rothmaler)&lt;/li&gt;
   &lt;li&gt;
      Closing &lt;a href="This%20is%20mainly%20a%20service%20release,%20fixing%20some%20nasty%20bugs%20or%20%22features%22."&gt;Contrib-25&lt;/a&gt;.
      ValidateNotSameAttribute Won't be supported ATM.&lt;/li&gt;
   &lt;li&gt;
      &lt;a href="http://support.castleproject.org/browse/CONTRIB-33"&gt;CONTRIB-33&lt;/a&gt;: When
      adding a table (SQL Server) to the designer which has a primary key of type uniqueidentifier
      ActiveWriter should use "Guid" instead of "Native" as generator (Thanks: Gabriel Schenker)&lt;/li&gt;
   &lt;li&gt;
      &lt;font color="#000000"&gt;Assembly names in NHibernate configs are incorrectly stripped
      from the name. (Thanx: Fedde)&lt;/font&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;font color="#000000"&gt;Removed dependency to MySQL.Data.dll to prevent runtime version
      conflicts. Moved to IDbConnection for all metadata retrieval jobs. (Thanks: Joao Paulo
      Marques and Shane)&lt;/font&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;br&gt;
&lt;a href="http://altinoren.com/content/binary/ActiveWriter%20Preview%203.1.rar"&gt;&lt;/a&gt;&lt;img width="0" height="0" src="http://altinoren.com/aggbug.ashx?id=d7be66c4-3dc1-4c91-b84e-aa22c01d2948" /&gt;</description>
      <comments>http://altinoren.com/CommentView,guid,d7be66c4-3dc1-4c91-b84e-aa22c01d2948.aspx</comments>
      <category>ActiveWriter</category>
    <feedburner:origLink>http://altinoren.com/PermaLink,guid,d7be66c4-3dc1-4c91-b84e-aa22c01d2948.aspx</feedburner:origLink></item>
  </channel>
</rss>
