<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Ruurd Boeke Enterprise development and technobabble</title>
  <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/" />
  <link rel="self" href="http://www.sitechno.com/Blog/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2008-07-25T10:46:13.281625+02:00</updated>
  <author>
    <name>Ruurd Boeke</name>
  </author>
  <subtitle>All about agile, OR-mapping and winfx - yeah baby!</subtitle>
  <id>http://www.sitechno.com/Blog/</id>
  <generator uri="http://www.dasblog.net" version="1.9.6264.0">DasBlog</generator>
  <entry>
    <title>I&amp;rsquo;m joining Microsoft!!</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/IrsquomJoiningMicrosoft.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,02c38c95-b751-4f12-b02b-16e1e513d43f.aspx</id>
    <published>2008-07-25T10:46:13.281625+02:00</published>
    <updated>2008-07-25T10:46:13.281625+02:00</updated>
    <category term="EF (Entity Framework)" label="EF (Entity Framework)" scheme="http://www.sitechno.com/Blog/CategoryView,category,EF%2B(Entity%2BFramework).aspx" />
    <category term="EF-Contrib" label="EF-Contrib" scheme="http://www.sitechno.com/Blog/CategoryView,category,EF-Contrib.aspx" />
    <category term="Personal" label="Personal" scheme="http://www.sitechno.com/Blog/CategoryView,category,Personal.aspx" />
    <category term="Silverlight" label="Silverlight" scheme="http://www.sitechno.com/Blog/CategoryView,category,Silverlight.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
        </p>
        <p>
I started my career when I was still in university. I started a company named <a href="http://www.sitechno.com" target="_blank">Sitechno</a> that
did webapplications and custom solutions. The last few years, I’ve been hired as a
consultant on some big projects. 
<br />
The role I was given on my last project, allowed me to do some crazy cool stuff, using
nHibernate and winforms. I was able to push WCF, WF and WPF into a big client/server
application, and had great success with it. We reformed a monolithic data-oriented
application into a domain-oriented loosely coupled application.
</p>
        <p>
It’s easy enough to find new projects, but the market for the cutting edge technologies
is not very big ;-)
</p>
        <p>
When I was asked to join Microsoft, my main attraction to the offer was the opportunity
to work on cutting edge technology with a group of passionate people. When I talked
Microsofties on the Redmond campus, it became clear that they could certainly offer
just that.
</p>
        <p>
I was torn between working on EF (which, I’ve been very involved with lately) and
on Silverlight. 
<br />
In the end, Silverlight won, because I strongly believe it to be the strongest contender
in the client space, there is an interesting ‘war’ going on right now, and I have
really enjoyed working with the WPF-framework in the past. I was torn by the decision
because whatever choice I made, I knew that a great opportunity would be lost. 
</p>
        <p>
We will be heading to Vancouver, Canada in September and I will work for Microsoft
Canada for a year. After that, I will be allowed to work in the U.S.A. and we will
move to Redmond.
</p>
        <p>
You can not believe how excited I am about this opportunity. I will be working for <a href="http://blogs.msdn.com/sburke/default.aspx" target="_blank">Shawn
Burke</a> on Silverlight Controls. I’m not sure yet who else is working on the team,
but I believe/hope I’ll be working with <a href="http://blogs.msdn.com/delay/default.aspx" target="_blank">David</a>,
Ted, <a href="http://blogs.msdn.com/kirti/default.aspx" target="_blank">Kirti</a> and <a href="http://www.jeff.wilcox.name/" target="_blank">Jeff</a>. 
</p>
        <p>
As for <a href="http://www.codeplex.com/efcontrib" target="_blank">EFContrib</a>:
although I’m dedicated to it, I’m having a hard time finding the time to work on it.
Also, since version 2.0 of EF will feature some nice Poco capabilities. So, I’m not
sure if people are waiting for the solution. It would be nice to make it work with
SL though! So, if I find the time, or get lots of mail of people wanting me to finish
it properly, I’ll work on it some more.
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=02c38c95-b751-4f12-b02b-16e1e513d43f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Great new way for using RoutedCommands with the ViewModel pattern in WPF</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/GreatNewWayForUsingRoutedCommandsWithTheViewModelPatternInWPF.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,3bfb7a9b-ad9a-4655-b2a6-5ce9c1c2a86a.aspx</id>
    <published>2008-07-25T10:17:02.875375+02:00</published>
    <updated>2008-07-25T10:17:02.875375+02:00</updated>
    <category term="WPF (Avalon)" label="WPF (Avalon)" scheme="http://www.sitechno.com/Blog/CategoryView,category,WPF%2B(Avalon).aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://joshsmithonwpf.wordpress.com/2008/07/24/article-about-using-routed-commands-with-mvvm/" target="_blank">Josh
Smith</a> just published a <a href="http://www.codeproject.com/KB/WPF/VMCommanding.aspx" target="_blank">great
article</a> about his solution to using RoutedCommands in WPF.
</p>
        <p>
The problem he solves, has been solved by others before, however, I think this is
a very lightweight succinct way of doing it. 
<br />
Basically, when you set a command to a button, you will have to handle that logic
(canExecute and Execute) in the codebehind of the view. Since you are (hopefully)
using a MVC, MVP or MVVM approach, you would rather not go through the codebehind
of the view, but directly route the commands to the appropriate viewmodel/controller. 
</p>
        <p>
He creates a relaying object that does just that. This results in a completely empty
codebehind for the view, which is exactly what I like! 
</p>
        <p>
Good job Josh!
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=3bfb7a9b-ad9a-4655-b2a6-5ce9c1c2a86a" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Better navigation management for deeplinking</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/BetterNavigationManagementForDeeplinking.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,20136f25-a09c-418a-b101-c82fa9f621c0.aspx</id>
    <published>2008-06-21T00:11:52.6614672+02:00</published>
    <updated>2008-06-21T00:11:52.6614672+02:00</updated>
    <category term="Silverlight" label="Silverlight" scheme="http://www.sitechno.com/Blog/CategoryView,category,Silverlight.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Well, I wrote about one way to do deeplinking and knew that there had to be something
out there that already did this.
</p>
        <p>
Look no further. It’s <a href="http://web-snippets.blogspot.com/2008/06/enabling-browser-back-button-in.html" target="_blank">here</a>!
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=20136f25-a09c-418a-b101-c82fa9f621c0" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Ninject goes gold &amp;ndash; silverlight support</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/NinjectGoesGoldNdashSilverlightSupport.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,e83accde-0144-4ba0-aad1-ade777b06109.aspx</id>
    <published>2008-06-18T12:42:42.443375+02:00</published>
    <updated>2008-06-18T12:42:42.443375+02:00</updated>
    <category term="Silverlight" label="Silverlight" scheme="http://www.sitechno.com/Blog/CategoryView,category,Silverlight.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
Ninject is a lightweight dependency injection framework and it has been getting quite
a bit of attention lately. 
<br />
What makes is <em>super</em>special, is that it runs under Silverlight 2.0 beta 2!
</p>
        <p>
The Ninject website is <a href="http://ninject.org/" target="_blank">here</a> and
Nate Kohari talks about this release <a href="http://kohari.org/2008/06/16/ninject-10-goes-gold/" target="_blank">here</a>.
From his post:
</p>
        <blockquote>
          <p>
So, what are some of the features of Ninject 1.0?
</p>
          <ul>
            <li>
Constructor, property, method, and field injection 
</li>
            <li>
Instantiation behaviors (singleton, one-per-thread, one-per-request) 
</li>
            <li>
Fluent interface for declaring type bindings 
</li>
            <li>
Contextual bindings, where the selection of which type to instantiate can be delayed
until activation 
</li>
            <li>
Support for instance scope and deterministic disposal 
</li>
            <li>
Fully pluggable, modular design: each kernel component can be easily replaced to alter
the framework’s behavior 
</li>
            <li>
Lightweight interceptor support (aspect-oriented programming) 
</li>
            <li>
Integrations with other popular frameworks 
</li>
          </ul>
        </blockquote>
        <p>
        </p>
        <p>
        </p>
        <p>
It’s great to see people working on MVC approaches and now even DI frameworks for
SL. Keep it coming!
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=e83accde-0144-4ba0-aad1-ade777b06109" />
      </div>
    </content>
  </entry>
  <entry>
    <title>The beginning of an MVC framework for SL</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/TheBeginningOfAnMVCFrameworkForSL.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,aafd0c70-dcf3-4ed9-a46e-c867c26ec35c.aspx</id>
    <published>2008-06-18T11:04:08.443375+02:00</published>
    <updated>2008-06-18T11:04:08.443375+02:00</updated>
    <category term="Silverlight" label="Silverlight" scheme="http://www.sitechno.com/Blog/CategoryView,category,Silverlight.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Nihkil wrote sometime ago about ‘<a href="http://www.nikhilk.net/Silverlight-Behaviors.aspx" target="_blank">actions’</a>,
which was a concept he created that attach some behavior to elements. Think of the
action of pressing the ‘enter’ key in a textbutton and executing some logic (sparing
the user a click on the button next to the textbutton).
</p>
        <p>
He has clearly been thinking more about his framework and now posts about the MVC
concept of the ViewModel, extending it with his actions <a href="http://www.nikhilk.net/Entry.aspx?id=198" target="_blank">here</a>.
Good write-up. Go read it. 
</p>
        <p>
Basically, he explains what a ViewModel is and shows how to execute ‘command’-like
behavior on them. As you might know, Silverlight does not support the concepts of
commands, like WPF does. His syntax is like this:
</p>
        <p>
 
</p>
        <pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 1</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">vm:View</span>
            <span style="color: red">xmlns</span>="<span style="color: blue">...</span>" <span style="color: red">xmlns:x</span>="<span style="color: blue">...</span>" </pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 2</span>
            <span style="color: red">xmlns:vm="clr-namespace:Silverlight.FX.ViewModel;assembly</span>=Silverlight.FX" </pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 3</span>
            <span style="color: red">xmlns:app</span>="<span style="color: blue">clr-namespace:AmazonSearch.Views</span>"<span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 4</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">vm:View.Model</span>
            <span style="color: blue">&gt;</span>
          </pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 5</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">app:SearchViewModel</span> /<span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 6</span>
            <span style="color: blue">&lt;</span>/<span style="color: maroon">vm:View.Model</span><span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 7</span>
          </pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 8</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">Grid</span>
            <span style="color: blue">&gt;</span>
          </pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 9</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">TextBox</span>
            <span style="color: red">x:Name</span>="<span style="color: blue">searchTextBox</span>"
/<span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 10</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">Button</span>
            <span style="color: red">Content</span>="<span style="color: blue">Search</span>" <span style="color: red">IsEnabled</span>="<span style="color: blue">{Binding
CanSearch}</span>"<span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 11</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">vm:ButtonEvents.Click</span>
            <span style="color: blue">&gt;</span>
          </pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 12</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">vm:InvokeMethod</span>
            <span style="color: red">MethodName</span>="<span style="color: blue">Search</span>"<span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 13</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">vm:ElementParameter</span>
            <span style="color: red">ElementName</span>="<span style="color: blue">searchTextBox</span>" <span style="color: red">ElementProperty</span>="<span style="color: blue">Text</span>"
/<span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 14</span>
            <span style="color: blue">&lt;</span>/<span style="color: maroon">vm:InvokeMethod</span><span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 15</span>
            <span style="color: blue">&lt;</span>/<span style="color: maroon">vm:ButtonEvents.Click</span><span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 16</span>
            <span style="color: blue">&lt;</span>/<span style="color: maroon">Button</span><span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 17</span>
          </pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 18</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">ItemsControl</span>
            <span style="color: red">ItemsSource</span>="<span style="color: blue">{Binding
Products}</span>"<span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 19</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">ItemsControl.ItemTemplate</span>
            <span style="color: blue">&gt;</span>
          </pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 20</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">DataTemplate</span>
            <span style="color: blue">&gt;</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">app:ProductView</span> /<span style="color: blue">&gt;</span><span style="color: blue">&lt;</span>/<span style="color: maroon">DataTemplate</span><span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 21</span>
            <span style="color: blue">&lt;</span>/<span style="color: maroon">ItemsControl.ItemTemplate</span><span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 22</span>
            <span style="color: blue">&lt;</span>/<span style="color: maroon">ItemsControl</span><span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 23</span>
            <span style="color: blue">&lt;</span>/<span style="color: maroon">Grid</span><span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 24</span>
            <span style="color: blue">&lt;</span>/<span style="color: maroon">vm:View</span><span style="color: blue">&gt;</span></pre>
          <span style="color: teal"> 25</span>
        </pre>
        <p>
The thing to note is in lines 10 to 15. There he invokes a method straight on the
ViewModel.
</p>
        <p>
The concept is quite the same as the Caliburn project from Rob and the idea is very
powerful! 
<br />
It enables you to have no code-behind and go straight to the viewmodel. Very nice!
</p>
        <p>
Thinking about this a bit though, does make me wonder if the added Xaml is worth the
ability to go straight to the viewmodel. Wouldn't it be just as simple to define a
Search method on the codebehind and invoke the correct method in the viewmodel? 
</p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
My point being: is it worth to incorporate such a framework (albeit very small and
succinct). What do you think?
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=aafd0c70-dcf3-4ed9-a46e-c867c26ec35c" />
      </div>
    </content>
  </entry>
  <entry>
    <title>VisualStateManager states do not show up in blend</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/VisualStateManagerStatesDoNotShowUpInBlend.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,c36a4f6e-6de7-4ff6-b985-ba5348260091.aspx</id>
    <published>2008-06-13T18:45:21.414+02:00</published>
    <updated>2008-06-14T00:51:33.2499082+02:00</updated>
    <category term="Silverlight" label="Silverlight" scheme="http://www.sitechno.com/Blog/CategoryView,category,Silverlight.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’ve been busy sharpening my Silverlight skills and created my very own button, complete
with VSM.
</p>
        <p>
        </p>
        <p>
The button (‘rjButton’) inherits from contentControl and in the project there is a
generic.xaml which defines a default look for the button, including VSM definitions
and state transitions. 
<br />
When loading up my solution in Blend, I can happily get the rjButton in my page. It
looks correct. However, when I ‘Edit a copy’ of the template, nothing shows up!! Funnily
enough, when I use ‘Create empty’, the correct states do show up.
</p>
        <p>
I was unable to google-fix the problem. I would guess that when you use ‘create empty’,
Blend just looks at the attributes on your class and shows the correct states. When
you ‘Edit a copy’, Blend looks for the template and can not find any. Somehow it is
unaware of the link to the style in generic.xaml, and it creates an empty style.
</p>
        <p>
I’ve double checked the behavior with the TabControl, which is also a control that
is defined in an external control, and it works the same. 
<br />
I'm not sure why controls included in the framework do work correctly. I've taken
a look with reflector and I've seen nothing out of the ordinary.
</p>
        <p>
You can work around this by naming the style and explicitly tell the control to use
the style. But then again, it might be easier to just copy the style (use David's
excellent style browser <a href="http://blogs.msdn.com/delay/archive/2008/06/06/continuing-access-to-silverlight-2-s-generic-xaml-resources-silverlightdefaultstylebrowser-updated-for-silverlight-2-beta-2.aspx" target="_blank">here</a>).
</p>
        <p>
If you know what is going on, leave a comment!
</p>
        <p>
[<strong>update</strong>: jasonxz knows: I was informed, today, that Blend does not,
yet, support the "edit a copy" functionality of a Template that is not defined in
System.Windows.dll. Thnx! ]
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=c36a4f6e-6de7-4ff6-b985-ba5348260091" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Do not make the VSM a child of you controltemplate (duh)</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/DoNotMakeTheVSMAChildOfYouControltemplateDuh.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,af9a42f2-3733-4575-9755-06bc0d1a93f8.aspx</id>
    <published>2008-06-13T16:01:00.6588982+02:00</published>
    <updated>2008-06-13T16:01:00.6588982+02:00</updated>
    <category term="Silverlight" label="Silverlight" scheme="http://www.sitechno.com/Blog/CategoryView,category,Silverlight.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just spent way too much time figuring out why my VisualStateManager suddenly started
giving errors. Without ‘break on all exceptions’ I got a ‘Catastrophic error’. With
breaking on all exceptions I could finally see that the layout system was trying to
layout the visualstatemanager.
</p>
        <p>
I basically had specified my vsm directly under the controltemplate, instead of defining
it inside the grid. Whoops!
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=af9a42f2-3733-4575-9755-06bc0d1a93f8" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Deeplinking in Silverlight</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/DeeplinkingInSilverlight.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,a49020cd-bdec-4dfd-a2d4-1e22cda32a28.aspx</id>
    <published>2008-06-11T21:48:01+02:00</published>
    <updated>2008-06-11T21:48:01+02:00</updated>
    <category term="Silverlight" label="Silverlight" scheme="http://www.sitechno.com/Blog/CategoryView,category,Silverlight.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I was triggered to spend some time on thinking about deeplinking, when I was listening
to a podcast with Neal Ford, <a href="http://feeds.sparklingclient.com/~r/SparklingClient/~3/290284532/" target="_blank">here</a>. 
<br />
In it, he has quite a few arguments why something like Silverlight (and Flex for that
matter) will never amount to anything. I disagree with almost all of his points, but
one stuck with me more: the inability to do deeplinking.
</p>
        <p>
Let me start off by saying that I think the ‘normal’ html world has reached maturity
and should soon begin to disappear. As almost everything in the world, technology
adoption follows a wave pattern. Html has had some great advantages which made it
easy to adopt. However, as computing power increases and humans become more accustomed
to great applications, html as a platform does not deliver anymore. It was rejuvenated
by the Ajax revolution, but in the end, you are always fighting against the restrictions
that it imposes.
</p>
        <p>
Those restrictions are no longer necessary. Flash did not deliver as a RIA platform,
but Flex seems very capable, as does Silverlight. It will take a few years, but the
demand for rich clients will drive the adoption of said technologies.
</p>
        <p>
Being able to do deeplinking, is an important part of the experience and usability.
The more I thought about it, the more I agreed on this. Although I think that browsers
(as we know them) will cease to exist pretty soon or more likely: change to meet new
needs, for the next few years we will have to deal with the restrictions they impose. 
<br />
So, I started to think about how we can solve the deeplinking issue for Silverlight.
</p>
        <p>
I had a flash of brilliance when I thought of the achor (#) sign in url’s. They can
be navigated to, but the page is not reloaded. Exactly what was needed for deeplinking. 
<br />
After doing some fast research, I discovered half the world had already thought of
this trick and it is heavily used by the Flex world. 
<br />
That discovery ruined my chances to score some ‘smart'-points with my girlfriend,
but it won't keep me from implementing my idea ;-)
</p>
        <h3>The basic idea
</h3>
        <p>
The idea is to get to the url at the beginning of the application and treat everything
after the # sign as 'state'. This state is used by the components in our application
to initialize themselves to the correct state. For instance, show the help page, or
the products page. 
<br />
When a component is changed and it is important enough to reflect this change in the
url, we use javascript to navigate to the new url. The browser will recognize that
only the anchor has changed, and will not really browse there. However, the user can
now confidently copy the url.
</p>
        <p>
It's pretty easy.
</p>
        <h3>Two approaches
</h3>
        <p>
Using a <strong>navigationcontroller</strong>. 
<br />
Your application could instantiate one navigationcontroller. This controller would
be used inside your application to show different usercontrols etcetera. I think such
an approach is well suited for a MVC-style of application architecture. 
<br />
Obviously, since all your navigation is taken care of by a central component, it would
be very easy to take care of 'serializing' its state to the url.
</p>
        <p>
Using <strong>per component</strong> approach. 
<br />
If you're just not that kind of person, you could also just make the components you
care about do the (de)serializing. So, possibly react to the Loaded event of a component
and reading the url to see how to initialize it. 
<br />
I've taken this a step further and created a class that serializes the vertical offset
of a Scrollviewer. It can be used like so: 
<br /></p>
        <pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 1</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">ScrollViewer</span>
            <span style="color: red">x:Name</span>="<span style="color: blue">sv1</span>" <span style="color: red">VerticalScrollBarVisibility</span>="<span style="color: blue">Auto</span>" <span style="color: red">Margin</span>="<span style="color: blue">10</span>"<span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 2</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">nav:ScrollviewerOffsetStateAttacher.Register</span>
            <span style="color: blue">&gt;</span>
          </pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 3</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">nav:ScrollviewerOffsetState</span>
            <span style="color: red">TemplateName</span>="<span style="color: blue">HelpTemplate</span>" <span style="color: red">PartName</span>="<span style="color: blue">pos1</span>"
/<span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: teal"> 4</span>
            <span style="color: blue">&lt;</span>/<span style="color: maroon">nav:ScrollviewerOffsetStateAttacher.Register</span><span style="color: blue">&gt;</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: teal"> 5</span>
            <span style="color: blue">&lt;</span>
            <span style="color: maroon">TextBlock</span>
            <span style="color: red">TextWrapping</span>="<span style="color: blue">Wrap</span>"<span style="color: blue">&gt;</span></pre>
          <span style="color: teal"> 6</span> Lorem ipsum dolor sit amet, conse</pre>
        <p>
(pretty radical, isn't it. Here I'm serializing the amount of scrolled pixels to the
url. That's something else than just which page you are viewing!)
</p>
        <h3>Some more code
</h3>
        <p>
First off, you need to think about how the url is serialized. Some kind of template
needs to be known to the system. And, different templates should be available for
different parts of your application. So, during initialization of my application I
do this:
</p>
        <div style="font-family: courier new">
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">            NavigationState.RegisterTemplate(<span style="color: maroon">"MainNavigationTemplate"</span>, <span style="color: maroon">"mainpage"</span>);</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">            NavigationState.RegisterTemplate(<span style="color: maroon">"ProductTemplate"</span>, <span style="color: maroon">"mainpage/product/detailpos"</span>);</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">            NavigationState.RegisterTemplate(<span style="color: maroon">"HelpTemplate"</span>, <span style="color: maroon">"mainpage/pos1/pos2"</span>);</pre>
        </div>
        <p>
A better approach might be to supply regex expressions.
</p>
        <p>
As you have figured out by now, I'm using a static class 'NavigationState' to manage
my url fiddling. It contains a SetNamedPartState and a GetNamedPartState method. So
when I navigate to the Products page, I might do this:
</p>
        <div style="font-family: courier new">
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">appController.NavigateToPage(<span style="color: blue">typeof</span>(Products));</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">NavigationState.SetNamedPartState(<span style="color: maroon">"mainpage"</span>, <span style="color: maroon">"ProductTemplate"</span>, <span style="color: maroon">"products"</span>);</pre>
        </div>
        <p>
          <br />
I'm telling it to use the producttemplate and set the mainpage part of that template
to the state 'products'. 
<br />
During the load though, I do the opposite:
</p>
        <div style="font-family: courier new">
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: blue">string</span> state
= NavigationState.GetNamedPartState(<span style="color: maroon">"mainpage"</span>, <span style="color: maroon">"MainNavigationTemplate"</span>);</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">
            <span style="color: blue">if</span> (!String.IsNullOrEmpty(state))</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">{</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    <span style="color: blue">if</span> (state
== <span style="color: maroon">"products"</span>)</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">        ProductsSelected();</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    <span style="color: blue">else</span> <span style="color: blue">if</span> (state
== <span style="color: maroon">"help"</span>)</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">        HelpSelected();</pre>
}
</div>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
Getting the url is easy: 
<br />
string uri = HtmlPage.Document.DocumentUri.ToString(); 
</p>
        <p>
Setting it is only slightly harder: 
<br />
HtmlPage.Window.Eval(String.Format("window.navigate('{0}#{1}');", 
<br />
    NavigationApplicationString, InternalStateString));
</p>
        <h3>Conclusion, work ahead
</h3>
        <p>
It's pretty a pretty simple idea. I like the way I attached a 'state' object to a
scrollviewer control to make a no-code, designer friendly experience possible.
</p>
        <p>
If someone would get serious about this, I guess they would take a look at the asp.net
mvc approach. They also hook the url's you are setting, to the back button(!) So,
there should be good crossbrowser javascript available.
</p>
        <p>
Also, a good and flexible url parsing engine is necessary.
</p>
        <p>
Finally, when you take the approach of one controller doing all the hard work, nothing
much has to be done. However, I can see the creation of all kinds of specific classes
that can be attached to controls to make them 'url-persistable' (think of selecting
the right listbox item).
</p>
        <h3>Try it out
</h3>
        <p>
The homepage of our sample application: 
<br /><a href="http://www.sitechno.com/silverlight/deeplinking/deeplinkingtestpage.html">http://www.sitechno.com/silverlight/deeplinking/deeplinkingtestpage.html</a></p>
        <p>
Two url's with state in them: 
<br /><a title="http://www.sitechno.com/silverlight/deeplinking/deeplinkingtestpage.html#products/SqlServer/760" href="http://www.sitechno.com/silverlight/deeplinking/deeplinkingtestpage.html#products/SqlServer/760">http://www.sitechno.com/silverlight/deeplinking/deeplinkingtestpage.html#products/SqlServer/760</a><br /><a title="http://www.sitechno.com/silverlight/deeplinking/deeplinkingtestpage.html#help/309/1166" href="http://www.sitechno.com/silverlight/deeplinking/deeplinkingtestpage.html#help/309/1166">http://www.sitechno.com/silverlight/deeplinking/deeplinkingtestpage.html#help/309/1166</a></p>
        <p>
        </p>
        <p>
I will not keep this application available forever and probably not update it to the
release version of beta2.
</p>
        <p>
 
</p>
        <p>
Who is going to make themselves useful by creating a robust solution? Leave a comment
of mail me if you want the source code!
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=a49020cd-bdec-4dfd-a2d4-1e22cda32a28" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Silverlight 2.0 beta 2 comin' up! Some changes.</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/Silverlight20Beta2CominUpSomeChanges.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,7ad00ab3-2b92-48e3-80a0-c920b9248a2f.aspx</id>
    <published>2008-06-05T12:14:48.296875+02:00</published>
    <updated>2008-06-05T12:14:48.296875+02:00</updated>
    <category term="Silverlight" label="Silverlight" scheme="http://www.sitechno.com/Blog/CategoryView,category,Silverlight.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Okay, I've been busy with other stuff in my life, I'll blog about soon. Suffice it
to say, I'm going to be able to focus my time more on Silverlight now ;-)
</p>
        <p>
The Silverlight team is announcing beta 2 with <a href="http://blogs.msdn.com/silverlight_sdk/archive/2008/06/04/what-s-new-in-silverlight-2-beta-2.aspx" target="_blank">this
post</a>. It's a pretty long list with changes, and it's looking very good! Here are
a few of my favorites:
</p>
        <ul>
          <li>
They included some controls into the runtime. So more goodies without added download
size.</li>
          <li>
A visual tree helper. I'm looking for more information on this. As you know, SL does
not have the same concept of a seperate visual tree and logical tree as WPF does.
They instead opted to not differentiate. Does this helper mean that the two models
come closer to each other?</li>
          <li>
Per binding level validation.</li>
          <li>
Binding to attached properties! Yay!</li>
          <li>
OnItemsChanged method</li>
          <li>
Fallback value during conversion</li>
          <li>
Duplex communication. Oh dear, they really hit the sweet spot here. This allows you
to push data to the client during a call. 
</li>
        </ul>
        <p>
The big one for me is support for <strong>UIAutomation</strong> though. I'm not sure
if it is supported fully, but this means you can test your controls with actual 'human'-like
input. I think this is important when building an application with a late-bound system
like Xaml-binding. 
</p>
        <p>
The whole blogosphere is raving about the new <strong>VisualStateManager</strong>.
It is a highlevel api to work with your states. The blend team is able to give you
a much improved templating story because of it. Read about it <a href="http://electricbeach.org/?p=98" target="_blank">here</a> or <a href="http://feeds.timheuer.com/~r/timheuer/~3/304691907/silverlight-introduces-visual-state-manager-vsm.aspx" target="_blank">here</a>.
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=7ad00ab3-2b92-48e3-80a0-c920b9248a2f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Comments broken, feel free to use email</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/CommentsBrokenFeelFreeToUseEmail.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,8f6896b5-87d7-461f-8f70-67fe36bae06d.aspx</id>
    <published>2008-04-29T15:33:19.932+02:00</published>
    <updated>2008-05-09T06:33:28.884+02:00</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've recently moved this blog to another host. Everything seems to work, except for
access denied errors on the comments. 
</p>
        <p>
I'm using DasBlog which writes to the filesystem. I'm able to post new posts without
problems, but comments don't work.
</p>
        <p>
If you have any comments, feel free to email me. I've already received a few, and
will be answering them.
</p>
        <p>
[<strong>update:</strong> not sure why, but I removed the allcomments.xml, and there
is no longer an error. However, no new 'allcomments.xml' file is created, so don't
know what's up with that!]
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=8f6896b5-87d7-461f-8f70-67fe36bae06d" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Future of EFContrib</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/FutureOfEFContrib.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,b3f65a57-3309-4493-b632-de77bc3bc967.aspx</id>
    <published>2008-04-23T12:12:39.164125+02:00</published>
    <updated>2008-04-23T12:12:39.164125+02:00</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Daniel Simmons commented on the next beta of EF where the team has worked with the
WCF team to allow for better serialization (in an interoperable way) of complete graphs
and relations. I'm very excited to hear that, but as Julie Lerman <a href="http://www.thedatafarm.com/blog/2008/04/16/RuurdBoekeHasSucceededInImplementingIPOCOAcrossTiers.aspx" target="_blank">pointed
out</a>: it's also kind of frustrating for me. ;-)
</p>
        <p>
As you know, I have 3 different pieces of technology that help make the possibility
of n-tier disconnected scenario easy.
</p>
        <p>
One of those pieces is the circular serializer, that was created to change the way
WCF serializes circular references. However, it has grown to also support 'original'
values.
</p>
        <p>
My current plan is as follows: 
<br />
I will wait to see how WCF serializes entity graphs in the next beta. I expect to
see that my circular serializer is no longer necessary. Hopefully I will be able to
remove it all together. 
<br />
What will still be necessary though is getting the original values across the wire.
So, I'll probably generate those properties inside of the classes themselves, negating
the use of a surrogate serializer. Then, on the client, you will just be able to use
your objects like before, and on the server you would notify the objectgraph of the
need to fill the original values just before you return them. This might work out
very well.
</p>
        <p>
The use of a surrogate is actually what is stopping me from targeting Silverlight,
so with a little luck, the changes in the next version will enable the use of Silverlight
as well. I'm looking forward to it!
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=b3f65a57-3309-4493-b632-de77bc3bc967" />
      </div>
    </content>
  </entry>
  <entry>
    <title>New sample application for disconnected n-tier EntityFramework objects</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/NewSampleApplicationForDisconnectedNtierEntityFrameworkObjects.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,eb673ee6-bcbe-4b4a-b76d-9235ef7df79d.aspx</id>
    <published>2008-04-16T15:55:10.6074375+02:00</published>
    <updated>2008-04-16T15:55:10.6074375+02:00</updated>
    <category term="EF (Entity Framework)" label="EF (Entity Framework)" scheme="http://www.sitechno.com/Blog/CategoryView,category,EF%2B(Entity%2BFramework).aspx" />
    <category term="EF-Contrib" label="EF-Contrib" scheme="http://www.sitechno.com/Blog/CategoryView,category,EF-Contrib.aspx" />
    <category term="WPF (Avalon)" label="WPF (Avalon)" scheme="http://www.sitechno.com/Blog/CategoryView,category,WPF%2B(Avalon).aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just finished a small sample application that illustrates a client/server application
using Entity Framework on the server and just regular objects on the client. The client
has custom changetracking and the server is able to attach the graph to a context
again. Source can be found at the <a href="http://www.codeplex.com/efcontrib" target="_blank">efcontrib</a> page,
and I guess I'm almost ready to do a proper release!
</p>
        <p>
[I used <a href="http://www.codeplex.com/prism" target="_blank">Prism</a> to build
the client in a Model View Controller approach. It was a fun exercise and I'm looking
forward to seeing that project released.]
</p>
        <p>
The application manages employees and allows for setting a 'teamleader' on an employee:
think of 'is managed by'. I thought it would be cool to send that over the wire.
</p>
        <p>
Here is a screenshot of the main view of the application:
</p>
        <p>
          <a href="http://www.sitechno.com/Blog/content/binary/WindowsLiveWriter/Newsampleapplicationfordisconnectedntier_D20E/image_2.png">
            <img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="214" alt="image" src="http://www.sitechno.com/Blog/content/binary/WindowsLiveWriter/Newsampleapplicationfordisconnectedntier_D20E/image_thumb.png" width="240" border="0" />
          </a>
        </p>
        <p>
As you can see, you can 'choose' an employee. When you press that button, you will
see another screen where you can enter a lastname. It will fill a grid with employees
matching that criteria and allows you to choose from that list. 
<br />
It is also allowed to 'add an employee'. There are actually 3 types of employees you
can add: Mort, Elvis and Einstein. 
</p>
        <p>
On the row of teamleader, you can again press the 'choose' button, which will allow
you to set a relation between the employee you are editing and another employee.
</p>
        <p>
On the server, there are a few methods like this:
</p>
        <p>
        </p>
        <div style="background: #000000; color: #f2f0df; font-family: monospace">
          <span style="color: teal"> 
0 </span>
          <span style="color: #eeeeee">  </span>
          <span style="color: #90ee90">public</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #ff0080">List</span>
          <span style="color: #c0c0c0">&lt;</span>
          <span style="color: #ff0080">Employee</span>
          <span style="color: #c0c0c0">&gt;</span>
          <span style="color: #eeeeee"> GetEmployees(</span>
          <span style="color: #90ee90">string</span>
          <span style="color: #eeeeee"> lastNameBeginsWith)</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  1 </span>
            <span style="color: #eeeeee"> 
{</span>
          </div>
          <span style="color: teal">  2 </span>
          <span style="color: #eeeeee">   </span>
          <span style="color: #90ee90">using</span>
          <span style="color: #eeeeee"> (</span>
          <span style="color: #ff0080">InheritanceTypeContext</span>
          <span style="color: #eeeeee"> context </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #90ee90">new</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #ff0080">InheritanceTypeContext</span>
          <span style="color: #eeeeee">())</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  3 </span>
            <span style="color: #eeeeee">  
{</span>
          </div>
          <span style="color: teal">  4 </span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  5 </span>
            <span style="color: #eeeeee">    </span>
            <span style="color: #ff0080">List</span>
            <span style="color: #c0c0c0">&lt;</span>
            <span style="color: #ff0080">Employee</span>
            <span style="color: #c0c0c0">&gt;</span>
            <span style="color: #eeeeee"> employees </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> (</span>
            <span style="color: #90ee90">from</span>
            <span style="color: #eeeeee"> e </span>
            <span style="color: #90ee90">in</span>
            <span style="color: #eeeeee"> context</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">Person</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">OfType</span>
            <span style="color: #c0c0c0">&lt;</span>
            <span style="color: #ff0080">Employee</span>
            <span style="color: #c0c0c0">&gt;</span>
            <span style="color: #eeeeee">()</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">Include(</span>
            <span style="color: #00ffff">"TeamLeader"</span>
            <span style="color: #eeeeee">)</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">Include(</span>
            <span style="color: #00ffff">"TeamMembers"</span>
            <span style="color: #eeeeee">)</span>
          </div>
          <span style="color: teal">  6 </span>
          <span style="color: #eeeeee">      </span>
          <span style="color: #90ee90">where</span>
          <span style="color: #eeeeee"> e</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">Lastname</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">StartsWith(lastNameBeginsWith)</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  7 </span>
            <span style="color: #eeeeee">      </span>
            <span style="color: #90ee90">select</span>
            <span style="color: #eeeeee"> e)</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">ToList();</span>
          </div>
          <span style="color: teal">  8 </span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  9 </span>
            <span style="color: #eeeeee">    </span>
          </div>
          <span style="color: teal">  10 </span>
          <span style="color: #eeeeee">   
employees</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">ForEach(p </span>
          <span style="color: #c0c0c0">=&gt;</span>
          <span style="color: #eeeeee"> context</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">PrepareForSerialization(p))
;</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  11 </span>
            <span style="color: #eeeeee">    </span>
            <span style="color: #90ee90">return</span>
            <span style="color: #eeeeee"> employees;</span>
          </div>
          <span style="color: teal">  12 </span>
          <span style="color: #eeeeee">  
}</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  13 </span>
            <span style="color: #eeeeee"> 
}</span>
          </div>
          <span style="color: teal">  14 </span>
          <span style="color: #000000">
          </span>
          <br />
        </div>
        <p>
        </p>
        <p>
 
</p>
        <p>
You can see me taking care to call the 'prepareForSerialization' on each graph that
I'm returning on line 10.
</p>
        <p>
The client can just use these objects like normal.
</p>
        <p>
 
</p>
        <p>
I'll look into delving into it a bit with a screencast soon.
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=eb673ee6-bcbe-4b4a-b76d-9235ef7df79d" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Inheritance support for EFContrib</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/InheritanceSupportForEFContrib.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,46346fcf-cd65-4493-a115-29dbd48fb645.aspx</id>
    <published>2008-04-16T12:18:32.2636875+02:00</published>
    <updated>2008-04-16T12:18:32.2636875+02:00</updated>
    <category term="EF (Entity Framework)" label="EF (Entity Framework)" scheme="http://www.sitechno.com/Blog/CategoryView,category,EF%2B(Entity%2BFramework).aspx" />
    <category term="EF-Contrib" label="EF-Contrib" scheme="http://www.sitechno.com/Blog/CategoryView,category,EF-Contrib.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I first wanted to focus on the other aspects of EFContrib, but I finally sat down
and finished the last missing piece of <a href="http://www.codeplex.com/efcontrib" target="_blank">EFContrib</a>:
full inheritance support for both the server bits and the client bits.
</p>
        <p>
Most work was in the serialization actually, since the surrogate classes need to now
also serialize the properties of base types. 
</p>
        <p>
I'm working on a sample right now that will show off the system in WPF. But you can
check out some of the code in the test project. 
<br />
This is the domain I'm using:
</p>
        <p>
          <a href="http://www.sitechno.com/Blog/content/binary/WindowsLiveWriter/InheritancesupportforEFContrib_AB70/image_2.png">
            <img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="image" src="http://www.sitechno.com/Blog/content/binary/WindowsLiveWriter/InheritancesupportforEFContrib_AB70/image_thumb.png" width="140" border="0" />
          </a>
        </p>
        <p>
In the following code I'm using it.
</p>
        <p>
        </p>
        <div style="background: #000000; color: #f2f0df; font-family: monospace">
          <span style="color: teal"> 
0 </span>
          <span style="color: #eeeeee">   </span>
          <span style="color: #90ee90">using</span>
          <span style="color: #eeeeee"> (</span>
          <span style="color: #ff0080">InheritanceTypeConnection</span>
          <span style="color: #eeeeee"> context </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #90ee90">new</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #ff0080">InheritanceTypeConnection</span>
          <span style="color: #eeeeee">())</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  1 </span>
            <span style="color: #eeeeee">  
{</span>
          </div>
          <span style="color: teal">  2 </span>
          <span style="color: #eeeeee">    </span>
          <span style="color: #90ee90">var</span>
          <span style="color: #eeeeee"> persons </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #90ee90">from</span>
          <span style="color: #eeeeee"> p </span>
          <span style="color: #90ee90">in</span>
          <span style="color: #eeeeee"> context</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">Person</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  3 </span>
            <span style="color: #eeeeee">         </span>
            <span style="color: #90ee90">select</span>
            <span style="color: #eeeeee"> p;</span>
          </div>
          <span style="color: teal">  4 </span>
          <span style="color: #eeeeee">    </span>
          <span style="color: #90ee90">foreach</span>
          <span style="color: #eeeeee"> (</span>
          <span style="color: #ff0080">Person</span>
          <span style="color: #eeeeee"> p </span>
          <span style="color: #90ee90">in</span>
          <span style="color: #eeeeee"> persons)</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  5 </span>
            <span style="color: #eeeeee">    
context</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">DeleteObject(p);</span>
          </div>
          <span style="color: teal">  6 </span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  7 </span>
            <span style="color: #eeeeee">   
context</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">SaveChanges();</span>
          </div>
          <span style="color: teal">  8 </span>
          <span style="color: #eeeeee">  
}</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  9 </span>
          </div>
          <span style="color: teal">  10 </span>
          <span style="color: #eeeeee">   </span>
          <span style="color: #90ee90">string</span>
          <span style="color: #eeeeee"> MsgOnWire </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #ff0080">String</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">Empty;</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  11 </span>
            <span style="color: #eeeeee">   </span>
            <span style="color: #90ee90">int</span>
            <span style="color: #eeeeee"> id;</span>
          </div>
          <span style="color: teal">  12 </span>
          <span style="color: #eeeeee">   </span>
          <span style="color: #90ee90">using</span>
          <span style="color: #eeeeee"> (</span>
          <span style="color: #ff0080">InheritanceTypeConnection</span>
          <span style="color: #eeeeee"> context </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #90ee90">new</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #ff0080">InheritanceTypeConnection</span>
          <span style="color: #eeeeee">())</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  13 </span>
            <span style="color: #eeeeee">  
{</span>
          </div>
          <span style="color: teal">  14 </span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  15 </span>
            <span style="color: #eeeeee">    </span>
            <span style="color: #ff0080">Einstein</span>
            <span style="color: #eeeeee"> lead </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #90ee90">new</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #ff0080">Einstein</span>
            <span style="color: #eeeeee"> {
Firstname </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #00ffff">"Bill"</span>
            <span style="color: #eeeeee">,
Lastname </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #00ffff">"G"</span>
            <span style="color: #eeeeee"> };</span>
          </div>
          <span style="color: teal">  16 </span>
          <span style="color: #eeeeee">   
context</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">AddToPerson(lead);</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  17 </span>
          </div>
          <span style="color: teal">  18 </span>
          <span style="color: #eeeeee">    </span>
          <span style="color: #ff0080">Mort</span>
          <span style="color: #eeeeee"> e1 </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #90ee90">new</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #ff0080">Mort</span>
          <span style="color: #eeeeee"> {
Firstname </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #00ffff">"Ruurd"</span>
          <span style="color: #eeeeee">,
Lastname </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #00ffff">"Boeke"</span>
          <span style="color: #eeeeee">,
Language </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #00ffff">"C#"</span>
          <span style="color: #eeeeee">,
EF</span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #90ee90">true</span>
          <span style="color: #eeeeee">,
WCF</span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #90ee90">true</span>
          <span style="color: #eeeeee">,
WF</span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #90ee90">true</span>
          <span style="color: #eeeeee">,
WPF</span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #90ee90">true</span>
          <span style="color: #eeeeee">,
TeamLeader</span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee">lead
};</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  19 </span>
            <span style="color: #eeeeee">   
context</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">AddToPerson(e1);</span>
          </div>
          <span style="color: teal">  20 </span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  21 </span>
            <span style="color: #eeeeee">    </span>
            <span style="color: #ff0080">Elvis</span>
            <span style="color: #eeeeee"> e2 </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #90ee90">new</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #ff0080">Elvis</span>
            <span style="color: #eeeeee"> {
Firstname </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #00ffff">"Elvis"</span>
            <span style="color: #eeeeee">,
Lastname </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #00ffff">"Presley"</span>
            <span style="color: #eeeeee">,
Language </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #00ffff">"Java"</span>
            <span style="color: #eeeeee">,
EF </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #90ee90">false</span>
            <span style="color: #eeeeee">,
WCF </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #90ee90">true</span>
            <span style="color: #eeeeee">,
WF </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #90ee90">false</span>
            <span style="color: #eeeeee">,
WPF </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #90ee90">true</span>
            <span style="color: #eeeeee">,
TeamLeader </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> lead
};</span>
          </div>
          <span style="color: teal">  22 </span>
          <span style="color: #eeeeee">   
context</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">AddToPerson(e2);</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  23 </span>
          </div>
          <span style="color: teal">  24 </span>
          <span style="color: #eeeeee">   
context</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">SaveChanges();</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  25 </span>
            <span style="color: #eeeeee">   
id </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> e1</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">PersonID;</span>
          </div>
          <span style="color: teal">  26 </span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  27 </span>
            <span style="color: #eeeeee">   
MsgOnWire </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> context</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">Serialize(e1);  </span>
            <span style="color: #a4a4a4">//
we'll take mort as the graphroot (no importance)</span>
          </div>
          <span style="color: teal">  28 </span>
          <span style="color: #eeeeee">  
}</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  29 </span>
          </div>
          <span style="color: teal">  30 </span>
          <span style="color: #eeeeee">   </span>
          <span style="color: #a4a4a4">//
deserialize</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  31 </span>
            <span style="color: #eeeeee">   </span>
            <span style="color: #ff0080">MortClient</span>
            <span style="color: #eeeeee"> mClient </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> MsgOnWire</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">DeserializeForClient</span>
            <span style="color: #c0c0c0">&lt;</span>
            <span style="color: #ff0080">MortClient</span>
            <span style="color: #c0c0c0">&gt;</span>
            <span style="color: #eeeeee">();</span>
          </div>
          <span style="color: teal">  32 </span>
          <span style="color: #eeeeee">  
mClient</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">Firstname </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #00ffff">"changedAt"</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #c0c0c0">+</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #ff8080">DateTime</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">Now</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">ToString();</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  33 </span>
            <span style="color: #eeeeee">   </span>
            <span style="color: #90ee90">string</span>
            <span style="color: #eeeeee"> nameToCheck </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> mClient</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">Firstname;</span>
          </div>
          <span style="color: teal">  34 </span>
          <span style="color: #eeeeee">  
mClient</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">EF </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #90ee90">false</span>
          <span style="color: #eeeeee">; </span>
          <span style="color: #a4a4a4">//
mort tends to forget skills</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  35 </span>
          </div>
          <span style="color: teal">  36 </span>
          <span style="color: #eeeeee">   </span>
          <span style="color: #ff0080">EmployeeClient</span>
          <span style="color: #eeeeee"> teamlead </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> mClient</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">TeamLeader;</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  37 </span>
          </div>
          <span style="color: teal">  38 </span>
          <span style="color: #eeeeee">   </span>
          <span style="color: #a4a4a4">//
elvis is a free soul, he can not be managed.</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  39 </span>
            <span style="color: #eeeeee">   </span>
            <span style="color: #ff0080">ElvisClient</span>
            <span style="color: #eeeeee"> eClient </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> (</span>
            <span style="color: #ff0080">ElvisClient</span>
            <span style="color: #eeeeee">)
mClient</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">TeamLeader</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">TeamMembers</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">Last();</span>
          </div>
          <span style="color: teal">  40 </span>
          <span style="color: #eeeeee">  
mClient</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">TeamLeader</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">TeamMembers</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">Remove(eClient);</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  41 </span>
            <span style="color: #eeeeee">  
eClient</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">TeamLeader </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> </span>
            <span style="color: #90ee90">null</span>
            <span style="color: #eeeeee">;</span>
          </div>
          <span style="color: teal">  42 </span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  43 </span>
            <span style="color: #eeeeee">   </span>
            <span style="color: #a4a4a4">//
always add more einsteins in the mix</span>
          </div>
          <span style="color: teal">  44 </span>
          <span style="color: #eeeeee">   </span>
          <span style="color: #ff0080">EinsteinClient</span>
          <span style="color: #eeeeee"> einClient </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #90ee90">new</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #ff0080">EinsteinClient</span>
          <span style="color: #eeeeee"> {
EF </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #90ee90">true</span>
          <span style="color: #eeeeee">,
WCF </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #90ee90">true</span>
          <span style="color: #eeeeee">,
WF </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #90ee90">false</span>
          <span style="color: #eeeeee">,
WPF </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #90ee90">false</span>
          <span style="color: #eeeeee">,
TeamLeader </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> teamlead,
Firstname </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #00ffff">"Albert"</span>
          <span style="color: #eeeeee">,
Language </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #00ffff">"C#"</span>
          <span style="color: #eeeeee">,
Lastname </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #00ffff">"Einstein"</span>
          <span style="color: #eeeeee"> };</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  45 </span>
            <span style="color: #eeeeee">  
teamlead</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">TeamMembers</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">Add(einClient);</span>
          </div>
          <span style="color: teal">  46 </span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  47 </span>
          </div>
          <span style="color: teal">  48 </span>
          <span style="color: #eeeeee">   </span>
          <span style="color: #a4a4a4">//
serialize</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  49 </span>
            <span style="color: #eeeeee">  
MsgOnWire </span>
            <span style="color: #c0c0c0">=</span>
            <span style="color: #eeeeee"> mClient</span>
            <span style="color: #c0c0c0">.</span>
            <span style="color: #eeeeee">SerializeForClient();</span>
          </div>
          <span style="color: teal">  50 </span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  51 </span>
          </div>
          <span style="color: teal">  52 </span>
          <span style="color: #eeeeee">   </span>
          <span style="color: #90ee90">using</span>
          <span style="color: #eeeeee"> (</span>
          <span style="color: #ff0080">InheritanceTypeConnection</span>
          <span style="color: #eeeeee"> context </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #90ee90">new</span>
          <span style="color: #eeeeee"> </span>
          <span style="color: #ff0080">InheritanceTypeConnection</span>
          <span style="color: #eeeeee">())</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  53 </span>
            <span style="color: #eeeeee">  
{</span>
          </div>
          <span style="color: teal">  54 </span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  55 </span>
            <span style="color: #eeeeee">    </span>
            <span style="color: #a4a4a4">//
deserialize</span>
          </div>
          <span style="color: teal">  56 </span>
          <span style="color: #eeeeee">    </span>
          <span style="color: #ff0080">Mort</span>
          <span style="color: #eeeeee"> m </span>
          <span style="color: #c0c0c0">=</span>
          <span style="color: #eeeeee"> context</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">Deserialize</span>
          <span style="color: #c0c0c0">&lt;</span>
          <span style="color: #ff0080">Mort</span>
          <span style="color: #c0c0c0">&gt;</span>
          <span style="color: #eeeeee">(MsgOnWire);</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  57 </span>
          </div>
          <span style="color: teal">  58 </span>
          <span style="color: #eeeeee">   
context</span>
          <span style="color: #c0c0c0">.</span>
          <span style="color: #eeeeee">SaveChanges();</span>
          <br />
          <div style="background: #222222">
            <span style="color: teal">  59 </span>
            <span style="color: #eeeeee">  
}</span>
          </div>
          <span style="color: teal">  60 </span>
          <span style="color: #000000">
          </span>
          <br />
        </div>
        <p>
        </p>
        <p>
Lines 31 to 41 represent the client. For testing purposes I created a copy of the
domain with the suffix Client. In normal usage this would obviously not be necessary. 
<br />
The client remembers all the original values, which allows the server to build up
an efficient graph when it is time to attach.
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=46346fcf-cd65-4493-a115-29dbd48fb645" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Spikes with Prism: Coupling commands to views</title>
    <link rel="alternate" type="text/html" href="http://www.sitechno.com/Blog/SpikesWithPrismCouplingCommandsToViews.aspx" />
    <id>http://www.sitechno.com/Blog/PermaLink,guid,c3d86392-dfd7-4f75-b236-f9b36bb0a992.aspx</id>
    <published>2008-04-15T18:50:12.30275+02:00</published>
    <updated>2008-04-15T18:50:12.30275+02:00</updated>
    <category term="WPF (Avalon)" label="WPF (Avalon)" scheme="http://www.sitechno.com/Blog/CategoryView,category,WPF%2B(Avalon).aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm building a small sample for <a href="http://www.codeplex.com/efcontrib" target="_blank">EFContrib</a>,
and thought it would be cool to use the new MVC framework <a href="http://www.codeplex.com/prism" target="_blank">'Prism'</a> for
it. Prism is a new framework currently under development by the patterns and practices
group. It is not feature complete and everything might change in the next drop. But,
well, it's fun to see such a framework develop and how best to understand it, than
by building something simple with it!
</p>
        <p>
I'm trying to do something fairly basic: I have a view that has a button on it. If
the button is pressed, a form should popup where we can search for employees. When
the search is over, the result should be accessible by my controller. 
<br />
At the same time though, I know that I'm going to have a detail screen as well with
the same button on it. Here the button chooses a teamleader for the employee.
</p>
        <p>
I want to define the command once, but need my controllers to behave differently.
It's quite possible that I would be better off just creating two commands (one for
the detail screen and one for the employee screen). You could argue that they perform
different actions: choose an employee versus choose a teamleader. 
<br />
But I don't swing that way and I feel it should be possible to have the same command
on a lot of buttons and let the appropriate controller deal with it.
</p>
        <p>
In the prism project are a few base classes for commands: the DelegateCommand and
also the ActiveAwareDispatchCommand. As far as I can see, they allow a command to
be hooked up by multiple views and allow controller to register their interest in
them. 
<br />
I created a static class with my 'ChooseEmployee' command:
</p>
        <p>
 
</p>
        <div style="font-family: courier new">
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    <span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: blue">class</span> EmployeeChooserCommands</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    {</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">        <span style="color: blue">public</span> <span style="color: blue">static</span> ActiveAwareMultiDispatchCommand
ChooseEmployee = <span style="color: blue">new</span> ActiveAwareMultiDispatchCommand();</pre>
      }
</div>
        <p>
Now, my views couple their buttons to this command in the regular way. 
</p>
        <p>
In my definition of MVC a controller is responsible for the logic and thus handles
this command. 
</p>
        <div style="font-family: courier new">
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">        <span style="color: blue">protected</span> ActiveAwareDelegateCommand
chooseEmployeeCommand;</pre>
        </div>
        <p>
It defines it's own command and in the ctor hooks it up:
</p>
        <div style="font-family: courier new">
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">            chooseEmployeeCommand = <span style="color: blue">new</span> ActiveAwareDelegateCommand(Choose,
CanChoose);</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">            <span style="color: green">//
register this instance on the global</span></pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">            EmployeeChooserCommands.ChooseEmployee.RegisterCommand(chooseEmployeeCommand);</pre>
        </div>
        <p>
The last line will make this controller react to executions of the command by every
source.
</p>
        <p>
This is the pattern that I see in the current Prism reference implementation project.
</p>
        <p>
The fun thing about the ActiveAwareDelegate is the way you can set it as Active and
not-Active. If it is not active, it will not be queried for canExecute information
and its execute delegate will not be called. 
</p>
        <p>
So, what I did, was to let my views implement the IActiveAware interface and throw
an event when they lose or get focus. The corresponding controllers react to it in
this way:
</p>
        <div style="font-family: courier new">
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">        <span style="color: blue">void</span> view_IsActiveChanged(<span style="color: blue">object</span> sender,
EventArgs e)</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">        {</pre>
          <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">            chooseEmployeeCommand.IsActive = view.IsActive;</pre>
          }
</div>
        <p>
Setting the command to only be active when the view is active. 
<br />
Downside here is that if one view is active, it gets to decide on the canExecute result,
but all buttons in all views will react to it: clearly not what we want.
</p>
        <p>
          <em>So, I feel I'm on the wrong track here</em>. I really miss being able to set some
sort of 'affinity' to the RegisterCommand method. I would like to let that method
know I'm interested in commands where the source is equal to my view. But then again,
maybe I should just create different commands :-)
</p>
        <img width="0" height="0" src="http://www.sitechno.com/Blog/aggbug.ashx?id=c3d86392-dfd7-4f75-b236-f9b36bb0a992" />
      </div>
    </content>
  </entry>
</feed>