<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>P&amp;P Software Factories</title>
        <link>http://geekswithblogs.net/Patware/category/6327.aspx</link>
        <description>SmartClient Software Factory, Web Client Software Factory, Web Service Software Factory</description>
        <language>en-US</language>
        <copyright>Patrice Calve</copyright>
        <managingEditor>patware@hotmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>CAB/SCSF Mocking Asynchronous Web Methods</title>
            <link>http://geekswithblogs.net/Patware/archive/2008/10/15/125854.aspx</link>
            <description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;How do you mock an asynchronous web method (web service) call?  You can skip the background and move on directly to the &lt;a href="#Solution"&gt;solution&lt;/a&gt;...&lt;/p&gt;
&lt;h2&gt;Background: &lt;/h2&gt;
&lt;ul&gt;
    &lt;li&gt;Visual Studio 2005 &lt;/li&gt;
    &lt;li&gt;CAB/SCSF May 2007 &lt;/li&gt;
    &lt;li&gt;C# 2.0 &lt;/li&gt;
    &lt;li&gt;Rhino Mocks (&lt;a href="http://ayende.com/projects/rhino-mocks/downloads.aspx"&gt;version 3.5 for 2.0&lt;/a&gt;) &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In a CAB/&lt;a href="http://www.codeplex.com/smartclient"&gt;SCSF&lt;/a&gt; project I'm working on, I'm testing a Presenter's method "OnViewReady".  In my implementation, this OnViewReady does basically 2 things:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Tells the View to Show a "Loading..." message to the user &lt;/li&gt;
    &lt;li&gt;Issues an asynchronous call to a Web Service &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When the call is returned from the Web Service, the Presenter tells the View to Show the message returned by the Web Service.  &lt;/p&gt;
&lt;p&gt;The method looks like this:&lt;font size="2"&gt; &lt;/font&gt; &lt;/p&gt;
&lt;h2&gt;&lt;a name="Solution"&gt;&lt;/a&gt;Solution&lt;/h2&gt;
&lt;font size="2"&gt;&lt;font size="2"&gt;
&lt;p dir="ltr"&gt;The solution is threefold: &lt;/p&gt;
&lt;ol dir="ltr"&gt;
    &lt;li&gt;Make the Web Service Mocking Friendly &lt;a href="#MakeTheWebServiceMockingFriendly"&gt;...&lt;/a&gt; &lt;/li&gt;
    &lt;li&gt;Make the presenter "interface friendly" &lt;a href="#InterfaceFriendly"&gt;...&lt;/a&gt; &lt;/li&gt;
    &lt;li&gt;Fine tune the Test Method! :) &lt;a href="#FineTuneTestMethod"&gt;...&lt;/a&gt; &lt;/li&gt;
&lt;/ol&gt;
&lt;/font&gt;&lt;/font&gt;
&lt;h3&gt;&lt;a name="MakeTheWebServiceMockingFriendly"&gt;&lt;/a&gt;Web Service Mocking friendly&lt;/h3&gt;
&lt;font size="2"&gt;&lt;font size="2"&gt;
&lt;p&gt;Making the Web Service Mocking friendly was not so evident.  Well, at least, the "mocking async methods" part.&lt;/p&gt;
&lt;p dir="ltr"&gt;To mock a Web Service, you have to extract an interface from the generated web service code (reference.cs), and make the web service code inherit from that interface.  You could make the web service "reference.cs" implement the interface, but may kill that code when you "update web reference".  The trick is to add a second "partial class" that will inherit from that interface.&lt;/p&gt;
&lt;p dir="ltr"&gt;Here goes:&lt;/p&gt;
&lt;ul dir="ltr"&gt;
    &lt;li&gt;In Visual Studio, &lt;/li&gt;
    &lt;li&gt;In your MyAppModule's project, click Add Web Reference and follow the wizard &lt;/li&gt;
    &lt;li&gt;Open the Reference.cs in the IDE (Show All Files) &lt;/li&gt;
    &lt;li&gt;Right Click on the public partial class MyWebService and choose "Refactor -&amp;gt; Extract interface" &lt;/li&gt;
    &lt;li&gt;This will create a IMyWebService interface with all of the methods from you Web Service. &lt;/li&gt;
    &lt;li&gt;Now, add a new class "MyWebService", make sure the namespace and class declaration is the same as the "real" web service.  "public partial class MyWebService", but make it implement the interface you created. &lt;/li&gt;
&lt;/ul&gt;
&lt;p dir="ltr"&gt;This is the web service's signature (in my example, the "MyWebService" is called "GeneralWS")&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;partial&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;GeneralWS&lt;/span&gt; : System.Web.Services.Protocols.&lt;span style="COLOR: #2b91af"&gt;SoapHttpClientProtocol&lt;/span&gt; { .. }&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#000000" size="2"&gt;So nothing changed.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p dir="ltr"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#000000" size="2"&gt;This is the interface extracted:&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;    &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;interface&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IGeneralWS&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; CancelAsync(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; userState);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; Ping();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; PingAsync(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; userState);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; PingAsync();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;event&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PingCompletedEventHandler&lt;/span&gt; PingCompleted;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; Url { &lt;span style="COLOR: blue"&gt;get&lt;/span&gt;; &lt;span style="COLOR: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;bool&lt;/span&gt; UseDefaultCredentials { &lt;span style="COLOR: blue"&gt;get&lt;/span&gt;; &lt;span style="COLOR: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    }&lt;/p&gt;
&lt;/div&gt;
&lt;p dir="ltr"&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;This is the second partial class.  Note that there's no code, just the interface:&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;    &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;partial&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;GeneralWS&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;IGeneralWS&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: green"&gt;//look ma, no hands&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    }&lt;/p&gt;
&lt;/div&gt;
&lt;p dir="ltr"&gt;Now, if you open the reference.cs, check the PingCompletedEventArgs code: The constructor is "internral" !   So, this means that we can't mock the async method because we can't create a new PingCompletedEventArgs when we mimic the callback.&lt;/p&gt;
&lt;p dir="ltr"&gt;Again, what you do, is create an interface and leverage the "partial" declaration of the PingCompletedEventArgs.  Repeat the steps for the Web Service class, but this time, for the EventArgs.&lt;/p&gt;
&lt;p dir="ltr"&gt;Here are my results:&lt;/p&gt;
&lt;font size="2"&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;    &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;interface&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IPingCompletedEventArgs&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; Result { &lt;span style="COLOR: blue"&gt;get&lt;/span&gt;; }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    }&lt;!--EndFragment--&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Add the second "partial" class:&lt;/p&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;    &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;partial&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PingCompletedEventArgs&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;IPingCompletedEventArgs&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; PingCompletedEventArgs(&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; results) : &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                &lt;span style="COLOR: blue"&gt;base&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;null&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;false&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;)&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: green"&gt;//We're hard coding the results to an 1-item array (object) since we know &lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: green"&gt;//that the web service's Ping method returns a string.&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.results = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: blue"&gt;object&lt;/span&gt;[1];&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.results[0] = results;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    }&lt;/p&gt;
&lt;/div&gt;
&lt;/font&gt;&lt;/font&gt;
&lt;p dir="ltr"&gt;&lt;font size="2"&gt;&lt;font color="#000000" size="2"&gt;Ok, that takes care of the "Web Service" part.  At this point, you can run the solution and it will work.  And if you update the web reference, you won't loose a thing.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;h3&gt;&lt;a name="InterfaceFriendly"&gt;&lt;/a&gt;Making the presenter "interface friendly"&lt;/h3&gt;
&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;font color="#000000"&gt;Making the presenter "interface friendly" is the well-known "multiple constructor" algorithm.&lt;/font&gt;&lt;/p&gt;
&lt;p dir="ltr"&gt;&lt;font size="2"&gt;&lt;font color="#000000" size="2"&gt;In a classic web service call, your method will be like this:&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;font size="2"&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; doSomethingWild()&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: #2b91af"&gt;GeneralWS&lt;/span&gt; gws = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;GeneralWS&lt;/span&gt;();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; returnValue = gws.Ping();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            View.ShowMessage(returnValue);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        }&lt;/p&gt;
&lt;/div&gt;
&lt;p dir="ltr"&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;In a "mocking friendly" class, you can't do that.  The class must work with an interface instead and the mocking framework will "mock" that interface for you.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p dir="ltr"&gt;&lt;font color="#000000"&gt;4 steps:&lt;/font&gt;&lt;/p&gt;
&lt;ol dir="ltr"&gt;
    &lt;li&gt;&lt;font color="#000000"&gt;Add a private variable of type Interface (that you created earlier)&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;&lt;font color="#000000"&gt;&lt;font size="2"&gt;Add a default constructor that will attach a "real web service" to that private interface variable&lt;/font&gt; &lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font color="#000000"&gt;&lt;font size="2"&gt;Add a "mockig friendly" constructor where pass in in the mocked interface (this is the real trick)&lt;/font&gt; &lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font color="#000000"&gt;&lt;font size="2"&gt;Change the call to the web service to not create a reference to the "real web service", but simply re-use the private variable of type interface&lt;/font&gt; &lt;/font&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p dir="ltr"&gt;&lt;font color="#000000" size="2"&gt;here's a sample from my presenter (construction part):&lt;/font&gt;&lt;/p&gt;
&lt;font color="#000000"&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;    &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;partial&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;HelloWorldViewPresenter&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;Presenter&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;IHelloWorldView&lt;/span&gt;&amp;gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;private&lt;/span&gt; PeopleCentralGeneral.&lt;span style="COLOR: #2b91af"&gt;IGeneralWS&lt;/span&gt; _gws;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: green"&gt;//default parameter-less Presenter, for normal code execution&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; HelloWorldViewPresenter()&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            _gws = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;GeneralWS&lt;/span&gt;();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            _gws.PingCompleted += &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PingCompletedEventHandler&lt;/span&gt;(gws_PingCompleted);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: green"&gt;//special constructor for "Mocking Friendlyness"&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; HelloWorldViewPresenter(&lt;span style="COLOR: #2b91af"&gt;IGeneralWS&lt;/span&gt; gws)&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            _gws = gws;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            _gws.PingCompleted += &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PingCompletedEventHandler&lt;/span&gt;(gws_PingCompleted);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        ...&lt;/p&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; This method is a placeholder that will be called by the view when it has been loaded.&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;override&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; OnViewReady()&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            View.ShowMessage(&lt;span style="COLOR: #a31515"&gt;"Loading..."&lt;/span&gt;);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: blue"&gt;base&lt;/span&gt;.OnViewReady();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            pingAsync();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        }&lt;/p&gt;
&lt;/div&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;!--EndFragment--&gt;&lt;/p&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; pingAsync()&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: green"&gt;//note that I'm not creating a new reference to the web service but re-using the interace instead..&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: green"&gt;//proper coding would check that _gws isn't null, of course ;)&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            _gws.PingAsync();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; gws_PingCompleted(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: #2b91af"&gt;PingCompletedEventArgs&lt;/span&gt; e)&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            View.ShowMessage(e.Result);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        }&lt;/p&gt;
&lt;/div&gt;
&lt;p style="MARGIN: 0px"&gt;        ...&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;}&lt;!--EndFragment--&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p dir="ltr"&gt; &lt;/p&gt;
&lt;/font&gt;&lt;font color="#000000"&gt;&lt;/font&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;h3&gt;&lt;a name="FineTuneTestMethod"&gt;&lt;/a&gt;Fine tuning the Test Method&lt;/h3&gt;
&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;font color="#000000"&gt;Fine tuning the Test Method for async web methods requires another trick with the Web Service.&lt;/font&gt;&lt;/p&gt;
&lt;font size="2"&gt;
&lt;p dir="ltr" align="left"&gt;&lt;font color="#000000"&gt;Finally, the Test Method !&lt;/font&gt;&lt;/p&gt;
&lt;p dir="ltr" align="left"&gt;&lt;font color="#000000"&gt;In the HelloWorldViewPresenterTest.cs, here's the Test Method for the OnViewReady:&lt;/font&gt;&lt;/p&gt;
&lt;p dir="ltr" align="left"&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt;A test for OnViewReady ()&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: gray"&gt;///&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        [&lt;span style="COLOR: #2b91af"&gt;TestMethod&lt;/span&gt;()]&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; OnViewReadyTest()&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: #2b91af"&gt;MockRepository&lt;/span&gt; repo = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;MockRepository&lt;/span&gt;();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: green"&gt;//the mocked general web service&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: #2b91af"&gt;IGeneralWS&lt;/span&gt; genWS = repo.StrictMock&amp;lt;&lt;span style="COLOR: #2b91af"&gt;IGeneralWS&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: green"&gt;//the mocked view&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: #2b91af"&gt;IHelloWorldView&lt;/span&gt; view = repo.StrictMock&amp;lt;&lt;span style="COLOR: #2b91af"&gt;IHelloWorldView&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            Support.&lt;span style="COLOR: #2b91af"&gt;TestableRootWorkItem&lt;/span&gt; workitem = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; Support.&lt;span style="COLOR: #2b91af"&gt;TestableRootWorkItem&lt;/span&gt;();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: green"&gt;//this will be used to simulate the call back from the web service&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            Rhino.Mocks.Interfaces.&lt;span style="COLOR: #2b91af"&gt;IEventRaiser&lt;/span&gt; pingCompletedRaiser;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: blue"&gt;using&lt;/span&gt; (repo.Record())&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                &lt;span style="COLOR: #2b91af"&gt;Expect&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                    .Call(&lt;span style="COLOR: blue"&gt;delegate&lt;/span&gt; { view.ShowMessage(&lt;span style="COLOR: #a31515"&gt;"Loading..."&lt;/span&gt;); });&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                &lt;span style="COLOR: green"&gt;//Expect that the PingAsynch() method will be called&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                &lt;span style="COLOR: #2b91af"&gt;Expect&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                    .Call(&lt;span style="COLOR: blue"&gt;delegate&lt;/span&gt; { genWS.PingAsync(); });&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                &lt;span style="COLOR: green"&gt;//Provide the entry point for the call back.&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                genWS.PingCompleted += &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                pingCompletedRaiser = &lt;span style="COLOR: #2b91af"&gt;LastCall&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                    .IgnoreArguments()&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                    .GetEventRaiser();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                &lt;span style="COLOR: #2b91af"&gt;Expect&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                    .Call(&lt;span style="COLOR: blue"&gt;delegate&lt;/span&gt; { view.ShowMessage(&lt;span style="COLOR: #a31515"&gt;"Pong"&lt;/span&gt;); });&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: #2b91af"&gt;HelloWorldViewPresenter&lt;/span&gt; target = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;HelloWorldViewPresenter&lt;/span&gt;(genWS);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            target.View = view;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            target.WorkItem = workitem;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: blue"&gt;using&lt;/span&gt; (repo.Playback())&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                target.OnViewReady();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                &lt;span style="COLOR: green"&gt;//This "new EventArgs" would be impossible without the second partial class&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                &lt;span style="COLOR: #2b91af"&gt;PingCompletedEventArgs&lt;/span&gt; args = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PingCompletedEventArgs&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"Pong"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                &lt;span style="COLOR: green"&gt;//make the callback call....   &lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                pingCompletedRaiser.Raise(genWS, args);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                &lt;span style="COLOR: green"&gt;//we're done!&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        }&lt;/p&gt;
&lt;/div&gt;
&lt;p dir="ltr" align="left"&gt;&lt;font color="#000000"&gt;I hope this info will help you in your quest for building better applications.  &lt;/font&gt;&lt;/p&gt;
&lt;p dir="ltr" align="left"&gt;&lt;font color="#000000"&gt;Patrice Calvé&lt;/font&gt;&lt;/p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125854"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125854" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Patware/aggbug/125854.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Patrice Calve</dc:creator>
            <guid>http://geekswithblogs.net/Patware/archive/2008/10/15/125854.aspx</guid>
            <pubDate>Wed, 15 Oct 2008 12:35:19 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Patware/comments/125854.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Patware/archive/2008/10/15/125854.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Patware/comments/commentRss/125854.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Patware/services/trackbacks/125854.aspx</trackback:ping>
        </item>
        <item>
            <title>Failed to access IIS metabase</title>
            <link>http://geekswithblogs.net/Patware/archive/2007/06/15/113263.aspx</link>
            <description>&lt;p&gt;Ha man !!!!&lt;/p&gt;
&lt;p&gt;2 evenings lost trying to make this darn simple web app.  It's a &lt;font face="Arial"&gt;Web Client Software Factory - June 2007 project on Vista box and whenever I was running the web app, I would be getting:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;  &lt;/span&gt;&lt;font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "&gt;&lt;strong&gt;Description: &lt;/strong&gt;An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Exception Details: &lt;/strong&gt;System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see &lt;a href="http://support.microsoft.com/?kbid=267904"&gt;http://support.microsoft.com/?kbid=267904&lt;/a&gt;.&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Source Error:&lt;/strong&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;h1&gt;Server Error in '/DevelopmentWebsite' Application. &lt;hr width="100%" color="#c0c0c0" size="1" /&gt;
&lt;/h1&gt;
&lt;h2&gt;&lt;em&gt;Failed to access IIS metabase.&lt;/em&gt; &lt;/h2&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;&lt;table width="100%" bgcolor="#ffffcc"&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;code&gt;
            &lt;pre&gt;Line 98:             else
Line 99:             {
&lt;font color="#ff0000"&gt;Line 100:                configuration = WebConfigurationManager.OpenWebConfiguration(context.Request.ApplicationPath + "/" + configFilePath.Replace(context.Request.PhysicalApplicationPath, ""));
&lt;/font&gt;Line 101:            }
Line 102:            return configuration;&lt;/pre&gt;
            &lt;/code&gt;&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;The solution is darn simple: &lt;strong&gt;run Visual Studio as an admin&lt;/strong&gt;.  I changed my shortcut in my Quick Launch to "Run as Administrator".    Being an administrator on my machine wasn't enough, I had to be an admin admin!&lt;/p&gt;
&lt;p&gt;The metaacl.vbs and adsutil.vbs aren't very usefull here as I'm running the Visual Studio WebServer.&lt;/p&gt;
&lt;p&gt;Pat&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113263"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113263" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Patware/aggbug/113263.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Patrice Calve</dc:creator>
            <guid>http://geekswithblogs.net/Patware/archive/2007/06/15/113263.aspx</guid>
            <pubDate>Sat, 16 Jun 2007 00:18:50 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Patware/comments/113263.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Patware/archive/2007/06/15/113263.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Patware/comments/commentRss/113263.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Patware/services/trackbacks/113263.aspx</trackback:ping>
        </item>
        <item>
            <title>Training on CAB/SCSF by David Platt</title>
            <link>http://geekswithblogs.net/Patware/archive/2007/03/09/108388.aspx</link>
            <description>&lt;P&gt;I'm finishing up my 4 day training course on CAB/SCSF by David Platt.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;It was a great class and encourage others to try it out.&lt;/P&gt;
&lt;P&gt;Sir, if you're reading this: thanks again.&lt;/P&gt;
&lt;P&gt;Pat&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=108388"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=108388" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Patware/aggbug/108388.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Patrice Calve</dc:creator>
            <guid>http://geekswithblogs.net/Patware/archive/2007/03/09/108388.aspx</guid>
            <pubDate>Fri, 09 Mar 2007 18:48:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Patware/comments/108388.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Patware/archive/2007/03/09/108388.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Patware/comments/commentRss/108388.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Patware/services/trackbacks/108388.aspx</trackback:ping>
        </item>
        <item>
            <title>Providing historical information to classes</title>
            <link>http://geekswithblogs.net/Patware/archive/2007/03/08/108301.aspx</link>
            <description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Last year, I was working on a CAB/SCSF&amp;nbsp;project that had to deal with concurrency (when a user tries to save changed data, but data on the server was already changed by someone else).&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;We used optimistic concurrency and tried to auto-resolve the issues whenever possible and where the business rules allowed it.&amp;nbsp; Whenever auto-merge was not possible, we had to inform the user and provide a mechanism to allow the user to first discover the conflicts and choose the best answer.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Anyway, we had to deal with 3 information:&lt;/FONT&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;The values changed by the user&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;The original values&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;The latest server values&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;On the client side, we kept 1 and 2 in separate variables:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Customer _customer;&lt;BR&gt;Customer _customer_original;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Something trivial.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;However, I didn't like the fact that for each class, the original/updated state handling had to be handled by objects outside the class's scope (basic rule of thumbs).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The project was canned and never had the chance to work on a solution, until now...&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I created a generic Historical&amp;lt;T&amp;gt; class that any business entity class could inherit.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Collections.Generic;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Text;&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;namespace&lt;/FONT&gt;&lt;FONT size=2&gt; ClassLibrary1&lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;class&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Historical&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;T&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;summary&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&amp;nbsp;Lorem Ipsum&amp;nbsp;about the Original Value&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;/summary&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;/FONT&gt;&lt;FONT size=2&gt; T _original = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;default&lt;/FONT&gt;&lt;FONT size=2&gt;(T);&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;bool&lt;/FONT&gt;&lt;FONT size=2&gt; _initializing = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;FONT size=2&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;object&lt;/FONT&gt;&lt;FONT size=2&gt; lockObject = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;object&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;internal&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;bool&lt;/FONT&gt;&lt;FONT size=2&gt; Initializing&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; _initializing; }&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lock&lt;/FONT&gt;&lt;FONT size=2&gt; (lockObject)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_initializing = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;value&lt;/FONT&gt;&lt;FONT size=2&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&lt;/FONT&gt;&lt;FONT size=2&gt; (_initializing == &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;false&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;makeACopy();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; makeACopy()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&lt;/FONT&gt;&lt;FONT size=2&gt; (_original == &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;null&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&lt;/FONT&gt;&lt;FONT size=2&gt; (!_initializing)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_original = (T)&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.MemberwiseClone();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/FONT&gt;&lt;FONT size=2&gt; Historical()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_original = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;default&lt;/FONT&gt;&lt;FONT size=2&gt;(T);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/FONT&gt;&lt;FONT size=2&gt; T OriginalValues&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; _original; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Now, for the Business Entity Class, all I have to do is to inherit from this Historical class:&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;FONT color=#008080&gt;Class1&lt;/FONT&gt; : &lt;FONT color=#008080&gt;Historical&lt;/FONT&gt;&amp;lt;&lt;FONT color=#008080&gt;Class1&lt;/FONT&gt;&amp;gt;&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;private&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; _name = &lt;FONT color=#800000&gt;"Not Set"&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; Name&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; _name; }&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set&lt;/FONT&gt; {_name = &lt;FONT color=#0000ff&gt;value&lt;/FONT&gt;; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I was presently supprised to see that it was possible (in C#) to declare a class&amp;nbsp;"Class1"&amp;nbsp;that inherits from&amp;nbsp;a generic&amp;nbsp;class "Historical" that referenced the child class!&amp;nbsp; Kind of a chicken and egg mystery broken !&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Now, let's go back to the Historical&amp;lt;T&amp;gt; class, notice how the bool Initialized property is Internal.&amp;nbsp; This means that to benefit from the OriginalValues can only be given if the Initializing is set to false by an internal class.&amp;nbsp; This fits well in the CAB world where the Business Entity Classes are "pictures" of data on a server;&amp;nbsp; A piece of code needs to fetch the data from the server, create the Business Entity Class and fill in the values.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Here's an example of the data store class:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff&gt;
&lt;P&gt;&lt;FONT size=2&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; System;&lt;BR&gt;&lt;FONT color=#0000ff&gt;using&lt;/FONT&gt; System.Collections.Generic;&lt;BR&gt;&lt;FONT color=#0000ff&gt;using&lt;/FONT&gt; System.Text;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff&gt;
&lt;P&gt;&lt;FONT size=2&gt;namespace&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; ClassLibrary1&lt;BR&gt;{&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#008080&gt;Store&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;static&lt;/FONT&gt; &lt;FONT color=#008080&gt;Class1&lt;/FONT&gt; GetClass1(&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt; id)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#008080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#008000 size=2&gt;//Get data from server and then set the values...&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#008080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Class1&lt;/FONT&gt; c = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;Class1&lt;/FONT&gt;();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;c.Name = &lt;FONT color=#800000&gt;"Pat"&lt;/FONT&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;c.DateOfBirth = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;DateTime&lt;/FONT&gt;(2000, 1, 2);&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//We're done with setting the values...&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;c.Initializing = &lt;FONT color=#0000ff&gt;false&lt;/FONT&gt;;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&lt;/FONT&gt; c;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;So, for a "client dev" point of view, the Class1 is very simple and easy to work with, allows modification to the data, while keeping track of the original values.&amp;nbsp; This "store" is a bad example&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;And quite frankly, we could go a step further and actually make the class1 partial,&amp;nbsp;create a second "partial" class&amp;nbsp;that inherits the Historical&amp;lt;T&amp;gt;.&amp;nbsp; This&amp;nbsp;would make the original class1 "code generator friendly".&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;This strategy is CAB/SCSF friendly because:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;The Business Entity class is easy to use from the GUI (add/update)&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Adds benefits for handling concurrency&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Non-intrusive&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Wadaya think?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Pat&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=108301"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=108301" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Patware/aggbug/108301.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Patrice Calve</dc:creator>
            <guid>http://geekswithblogs.net/Patware/archive/2007/03/08/108301.aspx</guid>
            <pubDate>Thu, 08 Mar 2007 19:55:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Patware/comments/108301.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Patware/archive/2007/03/08/108301.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Patware/comments/commentRss/108301.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Patware/services/trackbacks/108301.aspx</trackback:ping>
        </item>
    </channel>
</rss>