<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Adam Salvo (z) - Technology|Programming</title>
    <link>http://blog.salvoz.com/</link>
    <description>newtelligence powered</description>
    <language>en-us</language>
    <copyright>Adam Salvo</copyright>
    <lastBuildDate>Fri, 09 Jul 2010 18:02:00 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.2.8279.16125</generator>
    <managingEditor>adam@salvoz.com</managingEditor>
    <webMaster>adam@salvoz.com</webMaster>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=64b6ac5d-b2fe-4ff2-afeb-4449adbfb03b</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,64b6ac5d-b2fe-4ff2-afeb-4449adbfb03b.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,64b6ac5d-b2fe-4ff2-afeb-4449adbfb03b.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=64b6ac5d-b2fe-4ff2-afeb-4449adbfb03b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <strong>Today’s Task:</strong>
        </p>
        <p>
Add some Silverlight content to an existing Asp.Net MVC project. The MVC project contains
the standard CRUD for the application, while the Silverlight is meant to provide rich
visualization of the data.
</p>
        <p>
          <strong>Prerequisites:</strong>
        </p>
        <ul>
          <li>
VS 2010 
</li>
          <li>
An existing Asp.Net MVC 2.0 project 
</li>
          <li>
Expression Blend 4.0 (installs Silverlight 4 and Silverlight 4 SDK) 
</li>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=eff8a0da-0a4d-48e8-8366-6ddf2ecad801&amp;displaylang=en">Silverlight
4.0 tools</a> for Visual Studio 2010</li>
        </ul>
        <p>
          <strong>Creating the Project:</strong>
        </p>
        <p>
As stated in the opening and prerequisites, I am starting with an existing Asp.Net
MVC application. You should have Blend 4 installed, and have also installed the Silverlight
4 tools for Visual Studio.
</p>
        <p>
1) Right click on your web project and choose add new item (ctrl+shift+a). From the
add new Item window, click on Silverlight under Installed Templates and then select
the Silverlight Application. Name your Silverlight application appropriately. In my
example, I have named my project DataVisualization. Click Add
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb.png" width="244" height="171" />
          </a>
        </p>
        <p>
2) The next screen that comes up is the “Add Silverlight Application” screen. I accepted
the defaults with the follow exception, I changed the location from being a sub folder
of my MVC application to one level higher. The destination folder, ClientBin is still
created in your MVC application. Make sure that you select Silverlight 4 for the version.
Finally click Add.
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_4.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_1.png" width="244" height="225" />
          </a>
        </p>
        <p>
3) You should now have the following in your solution.
</p>
        <ul>
          <li>
Your existing Asp.Net MVC application 
</li>
          <li>
A new Silverlight 4 application named DataVisualization 
</li>
          <li>
A DataVisualizationTestPage.aspx in your MVC application 
</li>
          <li>
A DataVisualizationTestPage.html in your MVC application 
</li>
          <li>
A Silverlight.js in your MVC application</li>
        </ul>
        <p>
We will eventually remove the test pages, but for now we will leave them so that they
can serve their intended purpose. 
</p>
        <p>
4) Build the solution. You should see a DataVisualization.xap added to the ClientBin
folder in your MVC application.
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_6.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_2.png" width="244" height="235" />
          </a>  
</p>
        <p>
5) Right click on DataVisualization.html and choose view in browser. You should see
an empty page in the browser, but get no errors. Right clicking anywhere in the browser
window should bring up the Silverlight context menu.
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_8.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_3.png" width="244" height="208" />
          </a>
        </p>
        <p>
          <strong>
          </strong> 
</p>
        <p>
          <strong>Integrate the Silverlight Application</strong>
        </p>
        <p>
In this stage, we are going to make our new Silverlight application appear like it’s
part of the rest of our MVC application. Right now if you browse to it, it doesn’t
look like its part of anything. We also want to be able to allow our users to navigate
thru our web application so we need our existing menu to show up.
</p>
        <p>
1) Either create a new controller/view or re-use an existing controller/view in your
MVC application to house your Silverlight application. I’m going to reuse an existing
controller called Dashboard, which has one view, Index.
</p>
        <p>
2) Open up your view, and the DataVisualizationTestPage.aspx file. We need to move
some stuff over to our view so it displays our Silverlight application. I have some
pre existing styling and layout defined, so my view is going to look differently from
yours. I also store my java script files in a specific location, so I will be moving
the included silverlight.js as well. The screen shot below shows what I am starting
with in the view for reference.
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_10.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_4.png" width="244" height="121" />
          </a>
        </p>
        <p>
3) If you don’t have any existing standard for your JavaScript, you can place the
two script tags from the test page somewhere before the reference to the Silverlight
object. For example, place the two script tags just below the second content place
holder. Next, copy the form tag inclusive and paste it into your view. For me, I pasted
it into my div tag that I have setup to control my formatting. In the screen shots
below you can see my view, and resulting web page. We still have an empty Silverlight
control, but now it looks like its actually part of our website. 
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_12.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_5.png" width="343" height="186" />
          </a>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_14.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_6.png" width="244" height="187" />
          </a>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
4) Remove the DataVisualizationTest.aspx page, but keep the HTML page as we will need
it in the next section.
</p>
        <p>
          <strong>Working with Blend</strong>
        </p>
        <p>
The final step is to begin adding content to our Silverlight application. For this
we are going to switch to Blend to make sure that we are able to work in both tools. 
</p>
        <p>
1) Start up Blend and choose to open an existing project. Browse to the location of
your DataVisualization project (folder that contains DataVisualization.csproj) and
open it. You should see the content of your project listed on the left under the project
tab (assuming default Blend layout) and the empty MainPage.xaml in the middle. Notice
that we have a solution called DataVisualization, and that I did not open up my existing
MVC application solution. 
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_16.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_7.png" width="244" height="150" />
          </a>
        </p>
        <p>
2) Go to Project in the tool bar, and click Run Project (or press F5). You will see
that our empty MainPage is shown using the DataVisualizationTest.html page, and that
we are using the local Asp.Net development server. This is good enough for me. I’m
hoping that with this setup I can work independently of my MVC application, and more
importantly, a designer would be able to work independently as well. When deploying
my application to production, I can remove the DataVisualizationTest.html page. 
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_18.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_8.png" width="244" height="125" />
          </a>
        </p>
        <p>
3) TFS Integration – At this point I can’t figure out how to get Blend to work with
TFS. It’s possible since I downloaded the trial version that it does not include TFS
support, or I need to install Team Explorer on top of Blend. For now I can use the
Explorer add-in to get by. 
</p>
        <p>
          <strong>Conclusion</strong>
        </p>
        <p>
At this point we have a functioning Silverlight application, integrated with an existing
Asp.Net MVC application. We are able to work independently of the web application
in Blend and vice-versa. This is my first attempt at this type of solution, so I will
post a follow-up in the future to report back how well it worked, and if I needed
to make any changes. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=64b6ac5d-b2fe-4ff2-afeb-4449adbfb03b" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Silverlight in an Existing Asp.Net MVC Project</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,64b6ac5d-b2fe-4ff2-afeb-4449adbfb03b.aspx</guid>
      <link>http://blog.salvoz.com/2010/07/09/SilverlightInAnExistingAspNetMVCProject.aspx</link>
      <pubDate>Fri, 09 Jul 2010 18:02:00 GMT</pubDate>
      <description>&lt;p&gt;
&lt;strong&gt;Today’s Task:&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
Add some Silverlight content to an existing Asp.Net MVC project. The MVC project contains
the standard CRUD for the application, while the Silverlight is meant to provide rich
visualization of the data.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Prerequisites:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
VS 2010 
&lt;li&gt;
An existing Asp.Net MVC 2.0 project 
&lt;li&gt;
Expression Blend 4.0 (installs Silverlight 4 and Silverlight 4 SDK) 
&lt;li&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=eff8a0da-0a4d-48e8-8366-6ddf2ecad801&amp;amp;displaylang=en"&gt;Silverlight
4.0 tools&lt;/a&gt; for Visual Studio 2010&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Creating the Project:&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
As stated in the opening and prerequisites, I am starting with an existing Asp.Net
MVC application. You should have Blend 4 installed, and have also installed the Silverlight
4 tools for Visual Studio.
&lt;/p&gt;
&lt;p&gt;
1) Right click on your web project and choose add new item (ctrl+shift+a). From the
add new Item window, click on Silverlight under Installed Templates and then select
the Silverlight Application. Name your Silverlight application appropriately. In my
example, I have named my project DataVisualization. Click Add
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb.png" width="244" height="171"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
2) The next screen that comes up is the “Add Silverlight Application” screen. I accepted
the defaults with the follow exception, I changed the location from being a sub folder
of my MVC application to one level higher. The destination folder, ClientBin is still
created in your MVC application. Make sure that you select Silverlight 4 for the version.
Finally click Add.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_1.png" width="244" height="225"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
3) You should now have the following in your solution.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Your existing Asp.Net MVC application 
&lt;li&gt;
A new Silverlight 4 application named DataVisualization 
&lt;li&gt;
A DataVisualizationTestPage.aspx in your MVC application 
&lt;li&gt;
A DataVisualizationTestPage.html in your MVC application 
&lt;li&gt;
A Silverlight.js in your MVC application&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
We will eventually remove the test pages, but for now we will leave them so that they
can serve their intended purpose. 
&lt;/p&gt;
&lt;p&gt;
4) Build the solution. You should see a DataVisualization.xap added to the ClientBin
folder in your MVC application.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_2.png" width="244" height="235"&gt;&lt;/a&gt;&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
5) Right click on DataVisualization.html and choose view in browser. You should see
an empty page in the browser, but get no errors. Right clicking anywhere in the browser
window should bring up the Silverlight context menu.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_3.png" width="244" height="208"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Integrate the Silverlight Application&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
In this stage, we are going to make our new Silverlight application appear like it’s
part of the rest of our MVC application. Right now if you browse to it, it doesn’t
look like its part of anything. We also want to be able to allow our users to navigate
thru our web application so we need our existing menu to show up.
&lt;/p&gt;
&lt;p&gt;
1) Either create a new controller/view or re-use an existing controller/view in your
MVC application to house your Silverlight application. I’m going to reuse an existing
controller called Dashboard, which has one view, Index.
&lt;/p&gt;
&lt;p&gt;
2) Open up your view, and the DataVisualizationTestPage.aspx file. We need to move
some stuff over to our view so it displays our Silverlight application. I have some
pre existing styling and layout defined, so my view is going to look differently from
yours. I also store my java script files in a specific location, so I will be moving
the included silverlight.js as well. The screen shot below shows what I am starting
with in the view for reference.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_4.png" width="244" height="121"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
3) If you don’t have any existing standard for your JavaScript, you can place the
two script tags from the test page somewhere before the reference to the Silverlight
object. For example, place the two script tags just below the second content place
holder. Next, copy the form tag inclusive and paste it into your view. For me, I pasted
it into my div tag that I have setup to control my formatting. In the screen shots
below you can see my view, and resulting web page. We still have an empty Silverlight
control, but now it looks like its actually part of our website. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_5.png" width="343" height="186"&gt;&lt;/a&gt; &lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_14.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_6.png" width="244" height="187"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
4) Remove the DataVisualizationTest.aspx page, but keep the HTML page as we will need
it in the next section.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Working with Blend&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The final step is to begin adding content to our Silverlight application. For this
we are going to switch to Blend to make sure that we are able to work in both tools. 
&lt;/p&gt;
&lt;p&gt;
1) Start up Blend and choose to open an existing project. Browse to the location of
your DataVisualization project (folder that contains DataVisualization.csproj) and
open it. You should see the content of your project listed on the left under the project
tab (assuming default Blend layout) and the empty MainPage.xaml in the middle. Notice
that we have a solution called DataVisualization, and that I did not open up my existing
MVC application solution. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_16.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_7.png" width="244" height="150"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
2) Go to Project in the tool bar, and click Run Project (or press F5). You will see
that our empty MainPage is shown using the DataVisualizationTest.html page, and that
we are using the local Asp.Net development server. This is good enough for me. I’m
hoping that with this setup I can work independently of my MVC application, and more
importantly, a designer would be able to work independently as well. When deploying
my application to production, I can remove the DataVisualizationTest.html page. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_18.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/SilverlightinanExistingAsp.NetMVCProject_8B5E/image_thumb_8.png" width="244" height="125"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
3) TFS Integration – At this point I can’t figure out how to get Blend to work with
TFS. It’s possible since I downloaded the trial version that it does not include TFS
support, or I need to install Team Explorer on top of Blend. For now I can use the
Explorer add-in to get by. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
At this point we have a functioning Silverlight application, integrated with an existing
Asp.Net MVC application. We are able to work independently of the web application
in Blend and vice-versa. This is my first attempt at this type of solution, so I will
post a follow-up in the future to report back how well it worked, and if I needed
to make any changes. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=64b6ac5d-b2fe-4ff2-afeb-4449adbfb03b" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,64b6ac5d-b2fe-4ff2-afeb-4449adbfb03b.aspx</comments>
      <category>Technology/Asp.Net MVC</category>
      <category>Technology/Programming</category>
      <category>Technology/Silverlight</category>
      <category>Technology/Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=50c5ad5a-ce84-4c7b-aab3-63b22b1af93d</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,50c5ad5a-ce84-4c7b-aab3-63b22b1af93d.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,50c5ad5a-ce84-4c7b-aab3-63b22b1af93d.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=50c5ad5a-ce84-4c7b-aab3-63b22b1af93d</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <strong>Scenario</strong>
        </p>
        <p>
Locally developed Asp.Net MVC 2 application which needs to be deployed to a remote
web server. The web server, running IIS 7.5 is hosted by a 3rd party, but we have
full administrative access (Virtual Machine). In order to meet our deployment needs,
we will install and configure <a href="http://www.iis.net/expand/WebDeploymentTool">MSDeploy</a>.
MSDeploy is a new add-on for IIS 6 and above which enables the package and installation
of web applications, and optionally remote deployment and administration. You can
also use it to synchronize settings between web servers, for example in a Web Farm.
It is the remote deployment that we are most interested in, which is built upon the
packaging and installation piece. For this post I will be assuming a deployment source
of Visual Studio 2010 Beta 2. MSDeploy ships with an API which can be used to do the
deployment from say a build task on a Build Server (stay tuned for a follow-up post
on that). 
</p>
        <p>
          <strong>Installation</strong>
        </p>
        <p>
First you need to download MSDeploy to your remote web server and install it. Here
is the <a href="http://go.microsoft.com/?linkid=9684517">direct link</a> for the 64
bit version of MSDeploy. Other version can be downloaded from the <a href="http://www.iis.net/expand/WebDeploymentTool">MSDeploy</a> website.
Once downloaded, run the MSI installer and select the custom option. You need to select
the IIS 6 Deployment Hanlder to get the remote deployment feature. I also select the
UI Module and Management Service Delegation UI (See screen shot below). After selecting
the desire components, hit next, then install.
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb.png" width="244" height="189" />
          </a>
        </p>
        <p>
          <strong>Configuration Overview</strong>
        </p>
        <p>
If you had IIS Manager open during the installation, you will need to restart it.
Once restarted, you can right click on the Default Web Site and you should see a deploy
option listed.
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_6.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_2.png" width="244" height="164" />
          </a>
        </p>
        <p>
Next we will be configuring some accounts and permissions for our remote deployment,
following the instructions provided by Microsoft, which can be viewed in their entirety <a href="http://technet.microsoft.com/en-us/library/dd722796(WS.10).aspx">here</a>.
Following these rules we will be able to create a specific account for our application
which limits our external exposure. I’m happy to see we can use the new IIS Users/Management
feature instead of having to create a local or domain windows account. Here is an
overview of the steps we will be doing:
</p>
        <ol>
          <li>
            <p>
Create an IIS Manager user account for the customer.
</p>
          </li>
          <li>
            <p>
Give the WMSvc account access to the customer’s directory.
</p>
          </li>
          <li>
            <p>
Configure delegation for the customer.
</p>
          </li>
          <li>
            <p>
Add delegation rules for the customer.
</p>
          </li>
          <li>
            <p>
Restart the Web Management Service.
</p>
          </li>
          <li>
            <p>
Test the Web Deployment Handler.
</p>
          </li>
        </ol>
        <p>
          <strong>Step 1 – Create an IIS Manager User</strong>
        </p>
        <p>
In IIS manager, select the root server level (this is usually named after the name
of the computer IIS is running on, it’s the node just below Start Page). Once selected
scroll down in the middle pane to the Management section and select IIS Manager Users.
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_8.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_3.png" width="244" height="47" />
          </a>
        </p>
        <ul>
          <li>
Double click on IIS Manger Users 
</li>
          <li>
Click Add User from the actions list on the far right side 
</li>
          <li>
Enter a username, and a strong password 
</li>
          <li>
Click OK</li>
        </ul>
        <p>
I used the naming convention, [AppName]User, and a randomly generated password from <a href="http://keepass.info/">KeePass</a>.
Once created you get additional options for managing the user, like Change Password,
and Disable. 
</p>
        <p>
        </p>
        <p>
          <strong>Step 2 – Grant the WMSvc account access to our directory</strong>
        </p>
        <p>
The Service name (as shown in the Services MMC) is Web Management Service, and is
not started by default. Using the Services MMC, start the Web Management Service and
set it’s start-up type to Automatic, or Automatic-Delayed. 
</p>
        <p>
Note the user account that the service is running under. By default it runs as Local
Service. You will need to Grant the Local Service account full permissions to the
targeted deployment directory. Since I’d like to look into running the Web Management
Service as a lower privileged account in the future, I took the extra steps to create
a local user group called MSDeplyUsers, added Local Service to it, and granted permissions
to the group. This will allow me to more easily switch accounts in the future. 
</p>
        <p>
Before proceeding, you may need to make an additional change to your IIS server configuration.
By default, the Management Service is not configured to accept remote connections.
While the Web Management Service is stopped, in IIS Manager, click your top level
server node on the left, and then select Management Service under Management in the
center pane.
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_12.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_5.png" width="244" height="52" />
          </a>
        </p>
        <p>
Check the box for Enable remote connections, and select a SSL certificate. I’m using
a self signed SSL cert for now. I also added IP restrictions to restrict remote deployments
from my office only. You can use <a href="http://www.whatismyip.com">www.whatismyip.com</a> to
determine you IP, but unless you have a static IP, you may have to come back and change
this often. You will also need to add the port specified to your allow section in
your firewall rules. 
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_14.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_6.png" width="218" height="244" />
          </a>
        </p>
        <p>
          <strong>Step 3 – Configure Delegation</strong>
        </p>
        <p>
In order for our user account we created in Step 1 to have access to their folder,
we need to grant permissions on the folder (or site). You can only set folder level
permissions if the folder is setup as an Application.
</p>
        <p>
Once you have selected the level (using the navigation tree on the left) at which
to grant permissions, you can select the IIS Manger Permissions option in the central
pane.
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_10.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_4.png" width="244" height="114" />
          </a>
        </p>
        <ul>
          <li>
Click on IIS Manger Permissions 
</li>
          <li>
Click on Allow User on the far right pane 
</li>
          <li>
Select IIS User and then select the user you created in Step 1</li>
        </ul>
        <p>
          <strong>Step 4 – Add delegation rules</strong>
        </p>
        <p>
We now need to grant some specific rights to our user so they can deploy. This is
done using the Management tools at the server level.
</p>
        <ul>
          <li>
Double click on Management Service Delegation 
</li>
          <li>
Click on Add rule on the actions pane 
</li>
          <li>
Select the Deploy Content Only Template (I, as an administrator will handle the configuration
of the application directory and advanced configuration). 
</li>
          <li>
Accept all default 
<ul><li>
Providers: contentPath 
</li><li>
Actions: * 
</li><li>
Path Type: Path Prefix 
</li><li>
Path: {userScope} 
</li><li>
Run As: Current User</li></ul></li>
          <li>
When you click OK, you will be asked to provide the name of a user to add to the rule.
This is where you specify your user you created in Step 1. 
</li>
        </ul>
        <p>
The steps for IIS 7.5 may differ from IIS 7.
</p>
        <p>
          <strong>Step 6 – Restart Web Management Service</strong>
        </p>
        <p>
Pretty self explanatory, using the Services restart, or start the Web Management Service.
</p>
        <p>
          <strong>Step 7 – Test</strong>
        </p>
        <p>
In visual study, you need to publish your web application to your newly configured
remote server. Right click on your web project and choose Publish. In the screen that
comes up, select MSDeploy Publish as your Publish Method and fill in the settings
to match what we did in Steps 1 – 6.
</p>
        <p>
          <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_16.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_7.png" width="178" height="244" />
          </a>
        </p>
        <p>
Assuming everything is setup correctly, you should be able to publish you application
to your remote server. Based on the rules we setup in Step 4, this will only publish
content. It will not deploy database scripts, or create the application for you (mark
the folder as an application). You can follow the more <a href="http://technet.microsoft.com/en-us/library/dd722796(WS.10).aspx">detailed
instructions</a> to set this up, but I wanted to keep this simple for now. 
</p>
        <p>
          <strong>Trouble Shooting</strong>
        </p>
        <p>
Nothing ever works right on the first time does it? It took me a couple of tries (by
couple I mean hundreds) to get all the configuration setup on the client and server.
Here are some of the errors I got and what I did to fix them:
</p>
        <blockquote>
          <p>
            <strong>Connection Timeout</strong>
          </p>
          <p>
Could not complete the request to remote agent URL '<a href="https://Server:8172/msdeploy.axd?site=&lt;site&gt;'">https://Server:8172/msdeploy.axd?site=&lt;site&gt;'</a>.<br />
Unable to connect to the remote server<br />
A connection attempt failed because the connected party did not properly respond after
a period of time, or established connection failed because connected host has failed
to respond &lt;Server&gt;:8172
</p>
        </blockquote>
        <blockquote>
          <p>
If you get connection timeouts, make sure you can browse to the Service URL entered
above in the publish web screen. If you can’t, you hosting provider may be blocking
port 8172. You should at least get prompted for credentials when using a Web Browser.
If using a self signed cert, you will also get a certificate warning in the browser.
Finally, you should see you attempt in the Log Files for the Management Service. The
default path for the log files is: %SystemDrive%\Inetpub\logs\WMSvc
</p>
          <p>
            <strong>Error 400 Bad Request</strong>
          </p>
          <p>
Remote agent (URL <a href="https://Server:8172/MsDeploy.axd:8172/msdeploy.axd?site=&lt;site&gt;)">https://Server:8172/MsDeploy.axd:8172/msdeploy.axd?site=&lt;site&gt;)</a> could
not be contacted.  Make sure the remote agent service is installed and started
on the target computer.<br />
An unsupported response was received. The response header 'MSDeploy.Response' was
'' but 'v1' was expected.<br />
The remote server returned an error: (400) Bad Request.
</p>
        </blockquote>
        <blockquote>
          <p>
This one was driving me nuts, and the fix/cause is absolutely ridiculous. Notice the
two /MsDeploy.axd, one pascal cased, and the other all lower case. Now take a look
at the following screen shot and compare have I have in the ServiceUrl and the example
service URL provided in the same dialog.
</p>
          <p>
            <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_20.png">
              <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_1.png" width="244" height="35" />
            </a>
          </p>
          <p>
Looks like it should work right? Nope, doesn’t work. What fixed it, changing it so
that the /MsDeploy was all lower case as in <a href="https://Server:8172/msdeploy.axd">https://Server:8172/msdeploy.axd</a>.
This got rid of the first MsDeploy.axd.
</p>
          <p>
            <strong>Error 401 </strong> 
</p>
        </blockquote>
        <p>
        </p>
        <blockquote>
          <p>
Remote agent (URL <a href="https://Server:8172/msdeploy.axd?site=Default">https://Server:8172/msdeploy.axd?site=Default</a> Web
Site) could not be contacted.  Make sure the remote agent service is installed
and started on the target computer.<br />
An unsupported response was received. The response header 'MSDeploy.Response' was
'' but 'v1' was expected.<br />
The remote server returned an error: (401) Unauthorized.
</p>
        </blockquote>
        <blockquote>
          <p>
The first question I had was, is the site “Default Web Site” correct? I was worried
about the spaces in the name, but after reviewing the log files, the correct escape
characters for a space where present. The full result code was a 401.2. I saw that
my user account I created in Step 1 was being passed thru, and assumed that it had
something to do with that.
</p>
        </blockquote>
        <blockquote>
          <p>
I changed my credentials to an Windows Administrative account and gave that a go,
and it worked. This means the service itself works, but either my authentication or
authorization for the IIS user account is incorrect. If you are having problems with
an administrative account, you need to make sure that you have the option enabled
for Administrators to bypass rules. This is under Management Service Delegate, Edit
Features. If you change this setting, you need to restart the Management Service.
</p>
        </blockquote>
        <blockquote>
          <p>
            <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_22.png">
              <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_9.png" width="244" height="113" />
            </a>
          </p>
        </blockquote>
        <blockquote>
          <p>
When I had the Allow Administrators to bypass rules box unchecked, I got a different
error message, one that said I was unauthorized to perform an action, not a 401. This
led me to believe that my IIS User was suffering from an Authentication issue, not
authorization. 
</p>
        </blockquote>
        <blockquote>
          <p>
Since the IIS Users are for management, I decided to try connecting to my Application
using the IIS Management tool. Running this as a non-administrator you presented with
a “empty” view. Right clicking on clicking on Start Page allows you to Connect to
a Server, Web Site or Application. Selecting Application, and entering my credentials
left me with a 401 Unauthorized error, confirming my belief that its a problem with
the IIS User and not MSDeploy.<br /></p>
          <p>
            <a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_24.png">
              <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_10.png" width="244" height="206" />
            </a>
          </p>
        </blockquote>
        <p>
        </p>
        <blockquote>
          <p>
After playing around with the IIS settings, the IIS User account started working when
connecting via IIS Manager, but not via VS. I do not believe I changed anything (without
changing it back) to explain why it started working in IIS manager. The result codes
when it was failing was the same 401.2 as I was getting when connecting via IIS.
</p>
          <p>
            <strike>For now I have to leave this as an open issue, and maybe try again on a local
server.</strike>
          </p>
          <p>
            <strong>UPDATE:</strong>
          </p>
          <p>
I got it working more or less. Check out the comments for what I had to do.
</p>
        </blockquote>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=50c5ad5a-ce84-4c7b-aab3-63b22b1af93d" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Deploying Asp.Net MVC 2 Application to Remote WebServer using MSDeploy</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,50c5ad5a-ce84-4c7b-aab3-63b22b1af93d.aspx</guid>
      <link>http://blog.salvoz.com/2010/02/03/DeployingAspNetMVC2ApplicationToRemoteWebServerUsingMSDeploy.aspx</link>
      <pubDate>Wed, 03 Feb 2010 21:45:53 GMT</pubDate>
      <description>&lt;p&gt;
&lt;strong&gt;Scenario&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Locally developed Asp.Net MVC 2 application which needs to be deployed to a remote
web server. The web server, running IIS 7.5 is hosted by a 3rd party, but we have
full administrative access (Virtual Machine). In order to meet our deployment needs,
we will install and configure &lt;a href="http://www.iis.net/expand/WebDeploymentTool"&gt;MSDeploy&lt;/a&gt;.
MSDeploy is a new add-on for IIS 6 and above which enables the package and installation
of web applications, and optionally remote deployment and administration. You can
also use it to synchronize settings between web servers, for example in a Web Farm.
It is the remote deployment that we are most interested in, which is built upon the
packaging and installation piece. For this post I will be assuming a deployment source
of Visual Studio 2010 Beta 2. MSDeploy ships with an API which can be used to do the
deployment from say a build task on a Build Server (stay tuned for a follow-up post
on that). 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Installation&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
First you need to download MSDeploy to your remote web server and install it. Here
is the &lt;a href="http://go.microsoft.com/?linkid=9684517"&gt;direct link&lt;/a&gt; for the 64
bit version of MSDeploy. Other version can be downloaded from the &lt;a href="http://www.iis.net/expand/WebDeploymentTool"&gt;MSDeploy&lt;/a&gt; website.
Once downloaded, run the MSI installer and select the custom option. You need to select
the IIS 6 Deployment Hanlder to get the remote deployment feature. I also select the
UI Module and Management Service Delegation UI (See screen shot below). After selecting
the desire components, hit next, then install.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb.png" width="244" height="189"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Configuration Overview&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
If you had IIS Manager open during the installation, you will need to restart it.
Once restarted, you can right click on the Default Web Site and you should see a deploy
option listed.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_2.png" width="244" height="164"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Next we will be configuring some accounts and permissions for our remote deployment,
following the instructions provided by Microsoft, which can be viewed in their entirety &lt;a href="http://technet.microsoft.com/en-us/library/dd722796(WS.10).aspx"&gt;here&lt;/a&gt;.
Following these rules we will be able to create a specific account for our application
which limits our external exposure. I’m happy to see we can use the new IIS Users/Management
feature instead of having to create a local or domain windows account. Here is an
overview of the steps we will be doing:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;
Create an IIS Manager user account for the customer.
&lt;/p&gt;
&lt;li&gt;
&lt;p&gt;
Give the WMSvc account access to the customer’s directory.
&lt;/p&gt;
&lt;li&gt;
&lt;p&gt;
Configure delegation for the customer.
&lt;/p&gt;
&lt;li&gt;
&lt;p&gt;
Add delegation rules for the customer.
&lt;/p&gt;
&lt;li&gt;
&lt;p&gt;
Restart the Web Management Service.
&lt;/p&gt;
&lt;li&gt;
&lt;p&gt;
Test the Web Deployment Handler.
&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&lt;strong&gt;Step 1 – Create an IIS Manager User&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
In IIS manager, select the root server level (this is usually named after the name
of the computer IIS is running on, it’s the node just below Start Page). Once selected
scroll down in the middle pane to the Management section and select IIS Manager Users.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_3.png" width="244" height="47"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Double click on IIS Manger Users 
&lt;li&gt;
Click Add User from the actions list on the far right side 
&lt;li&gt;
Enter a username, and a strong password 
&lt;li&gt;
Click OK&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I used the naming convention, [AppName]User, and a randomly generated password from &lt;a href="http://keepass.info/"&gt;KeePass&lt;/a&gt;.
Once created you get additional options for managing the user, like Change Password,
and Disable. 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Step 2 – Grant the WMSvc account access to our directory&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The Service name (as shown in the Services MMC) is Web Management Service, and is
not started by default. Using the Services MMC, start the Web Management Service and
set it’s start-up type to Automatic, or Automatic-Delayed. 
&lt;/p&gt;
&lt;p&gt;
Note the user account that the service is running under. By default it runs as Local
Service. You will need to Grant the Local Service account full permissions to the
targeted deployment directory. Since I’d like to look into running the Web Management
Service as a lower privileged account in the future, I took the extra steps to create
a local user group called MSDeplyUsers, added Local Service to it, and granted permissions
to the group. This will allow me to more easily switch accounts in the future. 
&lt;/p&gt;
&lt;p&gt;
Before proceeding, you may need to make an additional change to your IIS server configuration.
By default, the Management Service is not configured to accept remote connections.
While the Web Management Service is stopped, in IIS Manager, click your top level
server node on the left, and then select Management Service under Management in the
center pane.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_5.png" width="244" height="52"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Check the box for Enable remote connections, and select a SSL certificate. I’m using
a self signed SSL cert for now. I also added IP restrictions to restrict remote deployments
from my office only. You can use &lt;a href="http://www.whatismyip.com"&gt;www.whatismyip.com&lt;/a&gt; to
determine you IP, but unless you have a static IP, you may have to come back and change
this often. You will also need to add the port specified to your allow section in
your firewall rules. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_14.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_6.png" width="218" height="244"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Step 3 – Configure Delegation&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
In order for our user account we created in Step 1 to have access to their folder,
we need to grant permissions on the folder (or site). You can only set folder level
permissions if the folder is setup as an Application.
&lt;/p&gt;
&lt;p&gt;
Once you have selected the level (using the navigation tree on the left) at which
to grant permissions, you can select the IIS Manger Permissions option in the central
pane.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_4.png" width="244" height="114"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Click on IIS Manger Permissions 
&lt;li&gt;
Click on Allow User on the far right pane 
&lt;li&gt;
Select IIS User and then select the user you created in Step 1&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Step 4 – Add delegation rules&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
We now need to grant some specific rights to our user so they can deploy. This is
done using the Management tools at the server level.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Double click on Management Service Delegation 
&lt;li&gt;
Click on Add rule on the actions pane 
&lt;li&gt;
Select the Deploy Content Only Template (I, as an administrator will handle the configuration
of the application directory and advanced configuration). 
&lt;li&gt;
Accept all default 
&lt;ul&gt;
&lt;li&gt;
Providers: contentPath 
&lt;li&gt;
Actions: * 
&lt;li&gt;
Path Type: Path Prefix 
&lt;li&gt;
Path: {userScope} 
&lt;li&gt;
Run As: Current User&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
When you click OK, you will be asked to provide the name of a user to add to the rule.
This is where you specify your user you created in Step 1. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The steps for IIS 7.5 may differ from IIS 7.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Step 6 – Restart Web Management Service&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Pretty self explanatory, using the Services restart, or start the Web Management Service.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Step 7 – Test&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
In visual study, you need to publish your web application to your newly configured
remote server. Right click on your web project and choose Publish. In the screen that
comes up, select MSDeploy Publish as your Publish Method and fill in the settings
to match what we did in Steps 1 – 6.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_16.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_7.png" width="178" height="244"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Assuming everything is setup correctly, you should be able to publish you application
to your remote server. Based on the rules we setup in Step 4, this will only publish
content. It will not deploy database scripts, or create the application for you (mark
the folder as an application). You can follow the more &lt;a href="http://technet.microsoft.com/en-us/library/dd722796(WS.10).aspx"&gt;detailed
instructions&lt;/a&gt; to set this up, but I wanted to keep this simple for now. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Trouble Shooting&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Nothing ever works right on the first time does it? It took me a couple of tries (by
couple I mean hundreds) to get all the configuration setup on the client and server.
Here are some of the errors I got and what I did to fix them:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;Connection Timeout&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Could not complete the request to remote agent URL '&lt;a href="https://Server:8172/msdeploy.axd?site=&amp;lt;site&amp;gt;'"&gt;https://Server:8172/msdeploy.axd?site=&amp;lt;site&amp;gt;'&lt;/a&gt;.&lt;br&gt;
Unable to connect to the remote server&lt;br&gt;
A connection attempt failed because the connected party did not properly respond after
a period of time, or established connection failed because connected host has failed
to respond &amp;lt;Server&amp;gt;:8172
&lt;/p&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
If you get connection timeouts, make sure you can browse to the Service URL entered
above in the publish web screen. If you can’t, you hosting provider may be blocking
port 8172. You should at least get prompted for credentials when using a Web Browser.
If using a self signed cert, you will also get a certificate warning in the browser.
Finally, you should see you attempt in the Log Files for the Management Service. The
default path for the log files is: %SystemDrive%\Inetpub\logs\WMSvc
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Error 400 Bad Request&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Remote agent (URL &lt;a href="https://Server:8172/MsDeploy.axd:8172/msdeploy.axd?site=&amp;lt;site&amp;gt;)"&gt;https://Server:8172/MsDeploy.axd:8172/msdeploy.axd?site=&amp;lt;site&amp;gt;)&lt;/a&gt; could
not be contacted.&amp;nbsp; Make sure the remote agent service is installed and started
on the target computer.&lt;br&gt;
An unsupported response was received. The response header 'MSDeploy.Response' was
'' but 'v1' was expected.&lt;br&gt;
The remote server returned an error: (400) Bad Request.
&lt;/p&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
This one was driving me nuts, and the fix/cause is absolutely ridiculous. Notice the
two /MsDeploy.axd, one pascal cased, and the other all lower case. Now take a look
at the following screen shot and compare have I have in the ServiceUrl and the example
service URL provided in the same dialog.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_20.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_1.png" width="244" height="35"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Looks like it should work right? Nope, doesn’t work. What fixed it, changing it so
that the /MsDeploy was all lower case as in &lt;a href="https://Server:8172/msdeploy.axd"&gt;https://Server:8172/msdeploy.axd&lt;/a&gt;.
This got rid of the first MsDeploy.axd.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Error 401 &lt;/strong&gt;&amp;nbsp;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Remote agent (URL &lt;a href="https://Server:8172/msdeploy.axd?site=Default"&gt;https://Server:8172/msdeploy.axd?site=Default&lt;/a&gt; Web
Site) could not be contacted.&amp;nbsp; Make sure the remote agent service is installed
and started on the target computer.&lt;br&gt;
An unsupported response was received. The response header 'MSDeploy.Response' was
'' but 'v1' was expected.&lt;br&gt;
The remote server returned an error: (401) Unauthorized.
&lt;/p&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
The first question I had was, is the site “Default Web Site” correct? I was worried
about the spaces in the name, but after reviewing the log files, the correct escape
characters for a space where present. The full result code was a 401.2. I saw that
my user account I created in Step 1 was being passed thru, and assumed that it had
something to do with that.
&lt;/p&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
I changed my credentials to an Windows Administrative account and gave that a go,
and it worked. This means the service itself works, but either my authentication or
authorization for the IIS user account is incorrect. If you are having problems with
an administrative account, you need to make sure that you have the option enabled
for Administrators to bypass rules. This is under Management Service Delegate, Edit
Features. If you change this setting, you need to restart the Management Service.
&lt;/p&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_22.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_9.png" width="244" height="113"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
When I had the Allow Administrators to bypass rules box unchecked, I got a different
error message, one that said I was unauthorized to perform an action, not a 401. This
led me to believe that my IIS User was suffering from an Authentication issue, not
authorization. 
&lt;/p&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
Since the IIS Users are for management, I decided to try connecting to my Application
using the IIS Management tool. Running this as a non-administrator you presented with
a “empty” view. Right clicking on clicking on Start Page allows you to Connect to
a Server, Web Site or Application. Selecting Application, and entering my credentials
left me with a 401 Unauthorized error, confirming my belief that its a problem with
the IIS User and not MSDeploy.&lt;br&gt;
&lt;p&gt;
&lt;a href="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_24.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.salvoz.com/content/binary/WindowsLiveWriter/Dep.NetMVC2ApplicationtoRemoteWebServeru_9778/image_thumb_10.png" width="244" height="206"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
After playing around with the IIS settings, the IIS User account started working when
connecting via IIS Manager, but not via VS. I do not believe I changed anything (without
changing it back) to explain why it started working in IIS manager. The result codes
when it was failing was the same 401.2 as I was getting when connecting via IIS.
&lt;/p&gt;
&lt;p&gt;
&lt;strike&gt;For now I have to leave this as an open issue, and maybe try again on a local
server.&lt;/strike&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;UPDATE:&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I got it working more or less. Check out the comments for what I had to do.
&lt;/p&gt;
&lt;/blockquote&gt;&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=50c5ad5a-ce84-4c7b-aab3-63b22b1af93d" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,50c5ad5a-ce84-4c7b-aab3-63b22b1af93d.aspx</comments>
      <category>Technology/Programming</category>
      <category>Technology/Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=352853be-a882-42df-a7ec-12e5d1f1790a</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,352853be-a882-42df-a7ec-12e5d1f1790a.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,352853be-a882-42df-a7ec-12e5d1f1790a.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=352853be-a882-42df-a7ec-12e5d1f1790a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I have been a big fan of log4net for the past several years. It’s a light weight,
reliable, open source logging platform. Today I needed to create FileAppender that
created a log file that had the current date in ISO 8601 format. 
</p>
        <p>
After playing around with various options for the RollingFileAppender, I finally figured
out the correct way to accomplish my goal. By adding the <strong>type="log4net.Util.PatternString"</strong> to
the file element in configuration file, you can change the name of the log file at
runtime based on properties within log4net. It just so happens, that one of the properties
is the current date and time.
</p>
        <p>
Here is my appender that I ended up with:
</p>
        <blockquote>
          <p>
&lt;appender name="MyAppender" type="log4net.Appender.FileAppender"&gt;<br />
            &lt;file type="log4net.Util.PatternString"
value="logs\%date{yyyyMMddTHHmmss}.txt" /&gt;<br />
            &lt;appendToFile
value="true"/&gt;<br />
            &lt;layout type="log4net.Layout.PatternLayout"&gt;<br />
               
&lt;conversionPattern value="%date %-5level %logger - %message%newline"/&gt;<br />
            &lt;/layout&gt;<br />
&lt;/appender&gt;
</p>
        </blockquote>
        <p>
I had just never seen the type attribute in the file element in any of the samples
I’ve worked with before, so it took me awhile to figure out the correct search terms
to narrow things down. I also found a site that makes it a lot easier to search the
user mailing list: <a title="http://old.nabble.com/Log4net---Users-f154.html" href="http://old.nabble.com/Log4net---Users-f154.html">http://old.nabble.com/Log4net---Users-f154.html</a></p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=352853be-a882-42df-a7ec-12e5d1f1790a" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>log4net One file per execution by date</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,352853be-a882-42df-a7ec-12e5d1f1790a.aspx</guid>
      <link>http://blog.salvoz.com/2009/12/18/log4netOneFilePerExecutionByDate.aspx</link>
      <pubDate>Fri, 18 Dec 2009 16:44:01 GMT</pubDate>
      <description>&lt;p&gt;
I have been a big fan of log4net for the past several years. It’s a light weight,
reliable, open source logging platform. Today I needed to create FileAppender that
created a log file that had the current date in ISO 8601 format. 
&lt;/p&gt;
&lt;p&gt;
After playing around with various options for the RollingFileAppender, I finally figured
out the correct way to accomplish my goal. By adding the &lt;strong&gt;type="log4net.Util.PatternString"&lt;/strong&gt; to
the file element in configuration file, you can change the name of the log file at
runtime based on properties within log4net. It just so happens, that one of the properties
is the current date and time.
&lt;/p&gt;
&lt;p&gt;
Here is my appender that I ended up with:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&amp;lt;appender name="MyAppender" type="log4net.Appender.FileAppender"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;file type="log4net.Util.PatternString"
value="logs\%date{yyyyMMddTHHmmss}.txt" /&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;appendToFile
value="true"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;layout type="log4net.Layout.PatternLayout"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;conversionPattern value="%date %-5level %logger - %message%newline"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/layout&amp;gt;&lt;br&gt;
&amp;lt;/appender&amp;gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
I had just never seen the type attribute in the file element in any of the samples
I’ve worked with before, so it took me awhile to figure out the correct search terms
to narrow things down. I also found a site that makes it a lot easier to search the
user mailing list: &lt;a title="http://old.nabble.com/Log4net---Users-f154.html" href="http://old.nabble.com/Log4net---Users-f154.html"&gt;http://old.nabble.com/Log4net---Users-f154.html&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=352853be-a882-42df-a7ec-12e5d1f1790a" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,352853be-a882-42df-a7ec-12e5d1f1790a.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=a227c0a1-2c77-4356-b460-1c40de2d71b7</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,a227c0a1-2c77-4356-b460-1c40de2d71b7.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,a227c0a1-2c77-4356-b460-1c40de2d71b7.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a227c0a1-2c77-4356-b460-1c40de2d71b7</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Tomorrow night I am presenting at the Madison .Net Users group. Tonight, I am pulling
my hair out, trying to get my demos to work. How far am I? Well I’m on my second demo,
but the first one involves 0 programming, so I don’t think that counts.
</p>
        <p>
What <strike>is</strike> was getting in my way, was a nasty System.Data.Services.Client.DataServiceRequestException,
complaining of an invalid DateTime value…somewhere. 
</p>
        <blockquote>
          <p>
            <font color="#ff0000" face="Consolas">System.Data.Services.Client.DataServiceRequestException
was unhandled<br />
  Message=An error occurred while processing this request.<br />
  Source=Microsoft.Data.Services.Client<br />
  StackTrace:<br />
       at System.Data.Services.Client.DataServiceContext.SaveResult.HandleBatchResponse()<br />
       at System.Data.Services.Client.DataServiceContext.SaveResult.EndRequest()<br />
       at System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions
options)<br />
       at System.Data.Services.Client.DataServiceContext.SaveChanges()<br />
       at Demo1.Program.AddEmployees() in C:\_Files\Projects\Demo1\Demo1Completed\Demo1Completed\Program.cs:line
48<br />
       at Demo1.Program.Main(String[] args) in C:\_Files\Projects\Demo1\Demo1Completed\Demo1Completed\Program.cs:line
19<br />
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly
assembly, String[] args)<br />
       at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)<br />
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()<br />
       at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)<br />
       at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)<br />
       at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)<br />
       at System.Threading.ThreadHelper.ThreadStart()<br />
  InnerException: System.Data.Services.Client.DataServiceClientException<br />
       Message=&lt;?xml version="1.0" encoding="utf-8"
standalone="yes"?&gt;<br />
&lt;error xmlns="</font>
            <a href="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata&quot;">
              <font color="#ff0000" face="Consolas">http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"</font>
            </a>
            <font color="#ff0000" face="Consolas">&gt;<br />
  &lt;code&gt;&lt;/code&gt;<br />
  &lt;message xml:lang="en-US"&gt;<strong>Error reading syndication item: 'Error
in line 5 position 14. An error was encountered when parsing a DateTime value in the
XML</strong>.'.&lt;/message&gt;<br />
&lt;/error&gt;<br />
       Source=Microsoft.Data.Services.Client<br />
       StatusCode=400<br />
       StackTrace:<br />
            at System.Data.Services.Client.DataServiceContext.SaveResult.&lt;HandleBatchResponse&gt;d__20.MoveNext()<br />
       InnerException: </font>
          </p>
        </blockquote>
        <p>
After installing Fiddler so I could analyze the post and it’s subsequent response,
I tried setting the Modified and Created properties on the Entity to DateTime.Now
to give them an actual value. The Modified and Created properties are on all SharePoint
list objects. I hadn’t bothered setting them, because they were of type DateTime?
and I assumed that SharePoint would set them. As a matter of fact, I watched a <a href="http://microsoftpdc.com/Sessions/FT12">PDC
session</a> on this very topic and <a href="http://blog.salvoz.com/2009/11/25/PDC09FT12WCFDataServices.aspx">blogged</a> about
it. In the demo, the only thing Pablo set was the name and the job title and posted
it via CURL, and it worked.
</p>
        <p>
I tried setting the values to null, but I got the same error (and why wouldn’t I).
I ended up setting the values to DateTime.Min value. This allows the POST operation
to succeed, and the Created and Modified values are correctly set by SharePoint.
</p>
        <p>
Other notes of interest:
</p>
        <ul>
          <li>
Even though I installed VS 2010 with .Net 4.0, I still had to install the Ado.Net
Data services 1.5 CTP2 for SharePoint 2010 to expose data via ListData.svc</li>
          <li>
When building an application in VS 2010 with the .Net 4.0, System.Data.Services.Client
is added for you when you add a Service Reference. You do not need to add a reference
to Microsoft.Data.Services.Client in the CTP 2.</li>
          <li>
Be sure to check out the different SaveChangesOptions available when you call SaveChanges
for your service. The batch option really speeds things up, but if one update fails,
they all fail. 
</li>
        </ul>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=a227c0a1-2c77-4356-b460-1c40de2d71b7" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>SharePoint 2010 WCF Data Services Time Waster</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,a227c0a1-2c77-4356-b460-1c40de2d71b7.aspx</guid>
      <link>http://blog.salvoz.com/2009/12/02/SharePoint2010WCFDataServicesTimeWaster.aspx</link>
      <pubDate>Wed, 02 Dec 2009 04:36:17 GMT</pubDate>
      <description>&lt;p&gt;
Tomorrow night I am presenting at the Madison .Net Users group. Tonight, I am pulling
my hair out, trying to get my demos to work. How far am I? Well I’m on my second demo,
but the first one involves 0 programming, so I don’t think that counts.
&lt;/p&gt;
&lt;p&gt;
What &lt;strike&gt;is&lt;/strike&gt; was getting in my way, was a nasty System.Data.Services.Client.DataServiceRequestException,
complaining of an invalid DateTime value…somewhere. 
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font color="#ff0000" face="Consolas"&gt;System.Data.Services.Client.DataServiceRequestException
was unhandled&lt;br&gt;
&amp;nbsp; Message=An error occurred while processing this request.&lt;br&gt;
&amp;nbsp; Source=Microsoft.Data.Services.Client&lt;br&gt;
&amp;nbsp; StackTrace:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.Data.Services.Client.DataServiceContext.SaveResult.HandleBatchResponse()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.Data.Services.Client.DataServiceContext.SaveResult.EndRequest()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions
options)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.Data.Services.Client.DataServiceContext.SaveChanges()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Demo1.Program.AddEmployees() in C:\_Files\Projects\Demo1\Demo1Completed\Demo1Completed\Program.cs:line
48&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Demo1.Program.Main(String[] args) in C:\_Files\Projects\Demo1\Demo1Completed\Demo1Completed\Program.cs:line
19&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.AppDomain._nExecuteAssembly(RuntimeAssembly
assembly, String[] args)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.Threading.ThreadHelper.ThreadStart()&lt;br&gt;
&amp;nbsp; InnerException: System.Data.Services.Client.DataServiceClientException&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Message=&amp;lt;?xml version="1.0" encoding="utf-8"
standalone="yes"?&amp;gt;&lt;br&gt;
&amp;lt;error xmlns="&lt;/font&gt;&lt;a href="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata&amp;quot;"&gt;&lt;font color="#ff0000" face="Consolas"&gt;http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"&lt;/font&gt;&lt;/a&gt;&lt;font color="#ff0000" face="Consolas"&gt;&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;message xml:lang="en-US"&amp;gt;&lt;strong&gt;Error reading syndication item: 'Error
in line 5 position 14. An error was encountered when parsing a DateTime value in the
XML&lt;/strong&gt;.'.&amp;lt;/message&amp;gt;&lt;br&gt;
&amp;lt;/error&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Source=Microsoft.Data.Services.Client&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StatusCode=400&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StackTrace:&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; at System.Data.Services.Client.DataServiceContext.SaveResult.&amp;lt;HandleBatchResponse&amp;gt;d__20.MoveNext()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InnerException: &lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
After installing Fiddler so I could analyze the post and it’s subsequent response,
I tried setting the Modified and Created properties on the Entity to DateTime.Now
to give them an actual value. The Modified and Created properties are on all SharePoint
list objects. I hadn’t bothered setting them, because they were of type DateTime?
and I assumed that SharePoint would set them. As a matter of fact, I watched a &lt;a href="http://microsoftpdc.com/Sessions/FT12"&gt;PDC
session&lt;/a&gt; on this very topic and &lt;a href="http://blog.salvoz.com/2009/11/25/PDC09FT12WCFDataServices.aspx"&gt;blogged&lt;/a&gt; about
it. In the demo, the only thing Pablo set was the name and the job title and posted
it via CURL, and it worked.
&lt;/p&gt;
&lt;p&gt;
I tried setting the values to null, but I got the same error (and why wouldn’t I).
I ended up setting the values to DateTime.Min value. This allows the POST operation
to succeed, and the Created and Modified values are correctly set by SharePoint.
&lt;/p&gt;
&lt;p&gt;
Other notes of interest:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Even though I installed VS 2010 with .Net 4.0, I still had to install the Ado.Net
Data services 1.5 CTP2 for SharePoint 2010 to expose data via ListData.svc&lt;/li&gt;
&lt;li&gt;
When building an application in VS 2010 with the .Net 4.0, System.Data.Services.Client
is added for you when you add a Service Reference. You do not need to add a reference
to Microsoft.Data.Services.Client in the CTP 2.&lt;/li&gt;
&lt;li&gt;
Be sure to check out the different SaveChangesOptions available when you call SaveChanges
for your service. The batch option really speeds things up, but if one update fails,
they all fail. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=a227c0a1-2c77-4356-b460-1c40de2d71b7" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,a227c0a1-2c77-4356-b460-1c40de2d71b7.aspx</comments>
      <category>Technology/Data Access</category>
      <category>Technology/Programming</category>
      <category>Technology/SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=627d0421-c6c6-4838-9ac3-1f2058f0a1b4</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,627d0421-c6c6-4838-9ac3-1f2058f0a1b4.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,627d0421-c6c6-4838-9ac3-1f2058f0a1b4.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=627d0421-c6c6-4838-9ac3-1f2058f0a1b4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I have been using Xunit and Test Driven.Net for almost a year now. The Xunit unit
testing framework is clean, concise and powerful. Test Drive.Net allows you to run
most 3rd party unit testing frameworks from within Visual Studio.
</p>
        <p>
I was a little worried that these tools would not work in VS2010 Beta 2 which I just
installed, but thankfully they do work. However, you have to use keyboard short cut
commands in VS2010 since command bar extensibility is not present. 
</p>
        <p>
Jamie, the author of TDD.Net has a <a href="http://weblogs.asp.net/nunitaddin/archive/2009/06/03/testdriven-net-2-22-support-for-visual-studio-2010-beta-1.aspx">post</a> in
which he explains how to setup the keyboard shortcuts. He also has a <a href="http://www.testdriven.net/downloads/TestDrivenVS2010.zip">link</a> to
a .vsSettings file that will setup the shortcuts for you. All I can say is, outstanding
work.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=627d0421-c6c6-4838-9ac3-1f2058f0a1b4" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Xunit, TestDriven.Net and VS2010 Beta 2</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,627d0421-c6c6-4838-9ac3-1f2058f0a1b4.aspx</guid>
      <link>http://blog.salvoz.com/2009/10/20/XunitTestDrivenNetAndVS2010Beta2.aspx</link>
      <pubDate>Tue, 20 Oct 2009 14:02:50 GMT</pubDate>
      <description>&lt;p&gt;
I have been using Xunit and Test Driven.Net for almost a year now. The Xunit unit
testing framework is clean, concise and powerful. Test Drive.Net allows you to run
most 3rd party unit testing frameworks from within Visual Studio.
&lt;/p&gt;
&lt;p&gt;
I was a little worried that these tools would not work in VS2010 Beta 2 which I just
installed, but thankfully they do work. However, you have to use keyboard short cut
commands in VS2010 since command bar extensibility is not present. 
&lt;/p&gt;
&lt;p&gt;
Jamie, the author of TDD.Net has a &lt;a href="http://weblogs.asp.net/nunitaddin/archive/2009/06/03/testdriven-net-2-22-support-for-visual-studio-2010-beta-1.aspx"&gt;post&lt;/a&gt; in
which he explains how to setup the keyboard shortcuts. He also has a &lt;a href="http://www.testdriven.net/downloads/TestDrivenVS2010.zip"&gt;link&lt;/a&gt; to
a .vsSettings file that will setup the shortcuts for you. All I can say is, outstanding
work.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=627d0421-c6c6-4838-9ac3-1f2058f0a1b4" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,627d0421-c6c6-4838-9ac3-1f2058f0a1b4.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=ff0c385a-aa20-4183-8eb3-5265e73a108f</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,ff0c385a-aa20-4183-8eb3-5265e73a108f.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,ff0c385a-aa20-4183-8eb3-5265e73a108f.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ff0c385a-aa20-4183-8eb3-5265e73a108f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I was reading a short post by Ayende on coding things that make the giant red warning
light go off in your head. One of the examples he gives is using a WCF service in
a using block, but he didn’t go into any detail as to why that is bad. A quick Bing
search led me to this article by Dan Rigsby entitled <a href="http://www.danrigsby.com/blog/index.php/2008/02/26/dont-wrap-wcf-service-hosts-or-clients-in-a-using-statement/">Don’t
Wrap Wcf Service Hosts or Clients in a Using Statement</a>. 
</p>
        <p>
The gist of it is that IDisposable is implemented in an uncommon way in some of the
WCF objects. A common problem is that if the service fails to open due to an exception,
the Dispose method will be called. In Dispose, a call to Close() is made, which will
throw an InvalidOperationException and a CommunicationObjectFaultedException. Dan’s
article has some code that shows what's going on that makes this a little more clear. 
</p>
        <p>
So it’s not the end of the world if you use a Using statement, but you will get some
unexpected exceptions at times. You just need to be aware of how Dispose works and
the exceptions that can be thrown and act accordingly. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=ff0c385a-aa20-4183-8eb3-5265e73a108f" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Don’t wrap your WCF clients in a using statement?</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,ff0c385a-aa20-4183-8eb3-5265e73a108f.aspx</guid>
      <link>http://blog.salvoz.com/2009/07/27/DontWrapYourWCFClientsInAUsingStatement.aspx</link>
      <pubDate>Mon, 27 Jul 2009 14:02:33 GMT</pubDate>
      <description>&lt;p&gt;
I was reading a short post by Ayende on coding things that make the giant red warning
light go off in your head. One of the examples he gives is using a WCF service in
a using block, but he didn’t go into any detail as to why that is bad. A quick Bing
search led me to this article by Dan Rigsby entitled &lt;a href="http://www.danrigsby.com/blog/index.php/2008/02/26/dont-wrap-wcf-service-hosts-or-clients-in-a-using-statement/"&gt;Don’t
Wrap Wcf Service Hosts or Clients in a Using Statement&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
The gist of it is that IDisposable is implemented in an uncommon way in some of the
WCF objects. A common problem is that if the service fails to open due to an exception,
the Dispose method will be called. In Dispose, a call to Close() is made, which will
throw an InvalidOperationException and a CommunicationObjectFaultedException. Dan’s
article has some code that shows what's going on that makes this a little more clear. 
&lt;/p&gt;
&lt;p&gt;
So it’s not the end of the world if you use a Using statement, but you will get some
unexpected exceptions at times. You just need to be aware of how Dispose works and
the exceptions that can be thrown and act accordingly. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=ff0c385a-aa20-4183-8eb3-5265e73a108f" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,ff0c385a-aa20-4183-8eb3-5265e73a108f.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=47b05006-f510-4154-9a5a-36b1a4a0b2fc</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,47b05006-f510-4154-9a5a-36b1a4a0b2fc.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,47b05006-f510-4154-9a5a-36b1a4a0b2fc.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=47b05006-f510-4154-9a5a-36b1a4a0b2fc</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
On Saturday May 30th I attended the first ever <a href="http://www.chicagocodecamp.com/">Chicago
Code Camp</a>. Thankfully it wasn’t actually in Chicago, but closer to Wisconsin which
made the drive bearable. I rode down with <a href="http://sleeplessmonkey.blogspot.com/2009/05/chicago-code-camp-retrospective.html">Steve</a> (thanks
for driving) and I-Lin, and met up with Lance down there. Overall, the event was a
great success I think, and it’s something we’d like to put on in Madison sometime
in the near future.
</p>
        <p>
          <strong>Session #1 – </strong>Introduction to AOP with <a href="http://www.postsharp.org/">Post
Sharp</a> by <a href="http://www.just3ws.com">Michael Hall</a></p>
        <p>
This was a good introduction to Aspect Orientated Programming (AOP) using Post Sharp
(.Net Environment). I’ve looked into Post Sharp before when it first came out, but
it looks like it has come a long way in terms of stability and features. 
</p>
        <p>
AOP involves moving code which implements non-functional requirements such as logging,
security, transaction management, into Aspects which can be then applied across your
application. Another term for non-functional requirements would be cross cutting concerns.
An aspect can be though of as a class, and is made up of advice, or methods.
</p>
        <p>
A common example used when describing AOP is the cross cutting concern or non-functional
requirement of tracing. Typically, in each class where you require tracing, you will
create a static read-only variable for your tracing object, and then in each method,
you will call Trace.Write(). With AOP, you can apply an attribute to the class to
perform tracing for all methods, or on specific methods. When the method is invoked,
the tracing code is executed, either before and/or after the method body depending
on how the aspect is coded. The advantage in this scenario is that you do not have
to declare that tracing variable or write the code to write the trace statement every
time. This way if you need to change the way the tracing works, you only have to do
it in one location. 
</p>
        <p>
Post Sharp provide a framework for building and applying the aspects. The aspects
are applied at compile time by injecting code into the compiled MSIL code. Aspects
are created as attributes by inheriting from several Post Sharp base classes, which
include:
</p>
        <ul>
          <li>
OnMethodBoundaryAspect: Used with code you own. Allows for code to be executed before
and after the method body. 
</li>
          <li>
OnMethodInvocationAspect: Used with code you do not own, allows for code to be executed
before method. 
</li>
          <li>
OnExceptionAspect: Code to be executed if an exception occurs. 
</li>
          <li>
OnFieldAccessAspect: Code to be executed when a field is accessed, providing for property
getter/setting like functionality on fields. 
</li>
          <li>
CompositionAspect: Change code at compile time. For example, you can force a type
to implement a specific interface.</li>
        </ul>
        <p>
Out of the box, Post Sharp gives you an incredible amount of functionality with those
base classes, but you can add new custom aspects if needed. Normally Post Sharp needs
to be installed with the MSI installer since it is integrating with Visual Studio.
However, instructions are available for an XCopy deployment.
</p>
        <p>
          <strong>Session #2 – </strong>Guarding your code with <a href="http://research.microsoft.com/en-us/projects/contracts/">Code
Contracts</a> by <a href="http://devlicio.us/blogs/derik_whittaker/default.aspx">Derik
Whittaker</a></p>
        <p>
Code contracts is a project from Microsoft Research which is being integrated into
VS2010, and is available in VS2010 Beta I, or as a download for VS2008. Code Contracts
are a way to define static assertions at design time, to be validated at compile and
run time. 
</p>
        <p>
You probably have written a “code contract before”, but have never realized it. A
simple example is where you check to see if an object is null at the beginning of
a method, and if it is, you throw an ArgumentNullExpcetion. The Microsoft version
of Code Contracts replaces the If Then Throw convention with Contracts.Assert(boolean
expression).
</p>
        <p>
So why is the Microsoft Solution better? The Microsoft solution integrates directly
into Visual Studio giving you support for Static Analysis at design time. This means
that if you call a method with a Contract.Assert(paramter != null) and pass in null,
you will get an error at compile time, as well as a warning in the form of a squiggly
line under the method call at design time. Automatic testing tools like <a title="Pex" href="http://research.microsoft.com/pex">Pex</a> can
take advantage of the code contracts as well. 
</p>
        <p>
The real power of Code Contracts can be seen when you look at some of the advanced
contracts offered. For example, you can validate that a return variable is not null,
as well as validate a condition every time a method is called using the Invariant
contract.
</p>
        <p>
Run time errors are displayed using Debug.Assert behind the scenes. This is automatically
disabled in the build type is set to release. You can also handle the debug assertion
yourself by implementing an failed contract event handler.
</p>
        <p>
          <strong>Session #3 –</strong>
          <a href="http://fluentnhibernate.org/">Fluent NHibernate</a> by <a href="http://www.bestguesstheory.com/">Hudson
Akridge</a></p>
        <p>
This was an excellent session and probably my favorite of the conference. Hudson is
a member of the Fluent NHibernate team, so he obviously is an authority on the topic,
and also has a deep passion for Fluent NHibernate that is hard to reproduce. Hudson
had all of his demos compiled and running ahead of time. He simply created new projects
and used printed copies of the source to type from. This saved a tremendous amount
of time. When time did start to run out, Hudson simply switched over to his already
completed projects to finish things up. <strong>Memo to presenters, follow this approach!</strong></p>
        <p>
The Fluent NHibernate (FNH) wiki, as well as the project members blogs provide an
excellent amount of documentation, that I simply can not duplicate in this blog post,
so be sure to check out those resources. 
</p>
        <p>
FNH is built on top of NHibernate, and it’s purpose is to replace the NHibernate Mapping
Files (HBM) with a strongly typed fluent interface, with the goal of making the use
of NHibernate easier, while producing more maintainable code. It succeeds on both
fronts. 
</p>
        <p>
FNH provides two mapping options, AutoMapper, and Fluent, both of which can be used
at the same time. AutoMapper uses a convention based approach where Property and Class
names map to tables in the database. This is great for simple domains and green field
projects with simpler database schema requirements. The fluent interface provides
for a much more granular approach to mapping, and currently supports most of the functionality
provided by HBM files (most people will not know that anything is missing). The fluent
interface allows you define conventions which allow you to reduce repetive mappings.
For example, if all of your entities have an integer based Id field, you can define
that, saving yourself from having to write the mapping code over and over.
</p>
        <p>
FNH does have some limitations, such as, all properties must be public. Obviously
there are some situations where this is not desirable, so you could switch to HBM
files, or utilize on of three work-arounds for fluent. The first two involve nesting
code at some level, while the 3rd involves the use of strings to identify the non-public
field names. While you loose the strong typing and compile time checking, I think
I like the string option the best.
</p>
        <p>
Two general tips I learned during the session, was to always make your public properties
virtual so that NHibernate’s default behavior of lazy loading will work. Hudson made
the comment that you should not try to outsmart NHibernate’s lazy load mechanism.
The only time you should consider eager load is if you have to detach your object
from the NHibernate session. The other tip was the feature that allows you to generate
a complete database schema from the NHibernate mappings. From comments I heard in
the crowd, the schema generation is very impressive compared to other ORMs. 
</p>
        <p>
          <strong>Session #4 –</strong>
          <a href="http://code.google.com/p/masstransit/">Mass
Transit</a> by <a href="http://www.drusellers.com/">Dru Sellers</a></p>
        <p>
Mass Transit is an Enterprise Service Bus (ESB) written in .Net 3.5 and is designed
around simplicity and speed. I had a general idea of what Mass Transit was going into
this presentation, and was hoping I would learn that it would be directly applicable
to a project at work. However, it’s a little too much functionality for what we need,
and that’s not a bad thing, as we could probably make use of it in the future. 
</p>
        <p>
While I have no immediate need for an ESB at work, I was very impressed with the .Net
3.5 syntax the project uses to handle subscriptions. I’m currently starting a prototype
project that could make use of an in memory service bus, and I think I will be reviewing
the Mass Transit source to see what I can borrow. 
</p>
        <p>
Coming from a BizTalk background, a lot of the features and functionality was comparable.
However, whereas BizTalk costs money, Mass Transit is free, open source, and would
probably meet the needs of most organizations. Both of the authors (Dru, the presenter
is one of them) use Mass Transit daily in their jobs in the banking industry.
</p>
        <p>
          <strong>Session #5 –</strong> Solid WPF by <a href="http://mjeaton.net/blog/">Michael
Eaton</a></p>
        <p>
This presentation could have been titled WPF and the MVVM pattern. Not that Solid
WPF is a bad name, but for those of you at home, it was a talk on MVVM with some YAGNI
thrown in for good measure.
</p>
        <p>
This is not my first MVVM presentation, and it probably won’t be the last. Unfortunately
I’m still struggling to fully understand the pattern, which is partly due to my lack
of experience with WPF (which I need to remedy soon). 
</p>
        <p>
However, the approach that Michael took in presenting MVVM was different, in that
he started with a WPF app coded using just the code behind, then did a copy/paste
to a new project and tried a MVC pattern, and then finally worked in MVVM. Seeing
the transformation of the application from the first to the third project did help
solidify some of the MVVM concepts.    
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=47b05006-f510-4154-9a5a-36b1a4a0b2fc" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Chicago Code Camp V1.0 – May 2009</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,47b05006-f510-4154-9a5a-36b1a4a0b2fc.aspx</guid>
      <link>http://blog.salvoz.com/2009/05/31/ChicagoCodeCampV10May2009.aspx</link>
      <pubDate>Sun, 31 May 2009 15:30:49 GMT</pubDate>
      <description>&lt;p&gt;
On Saturday May 30th I attended the first ever &lt;a href="http://www.chicagocodecamp.com/"&gt;Chicago
Code Camp&lt;/a&gt;. Thankfully it wasn’t actually in Chicago, but closer to Wisconsin which
made the drive bearable. I rode down with &lt;a href="http://sleeplessmonkey.blogspot.com/2009/05/chicago-code-camp-retrospective.html"&gt;Steve&lt;/a&gt; (thanks
for driving) and I-Lin, and met up with Lance down there. Overall, the event was a
great success I think, and it’s something we’d like to put on in Madison sometime
in the near future.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Session #1 – &lt;/strong&gt;Introduction to AOP with &lt;a href="http://www.postsharp.org/"&gt;Post
Sharp&lt;/a&gt; by &lt;a href="http://www.just3ws.com"&gt;Michael Hall&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
This was a good introduction to Aspect Orientated Programming (AOP) using Post Sharp
(.Net Environment). I’ve looked into Post Sharp before when it first came out, but
it looks like it has come a long way in terms of stability and features. 
&lt;/p&gt;
&lt;p&gt;
AOP involves moving code which implements non-functional requirements such as logging,
security, transaction management, into Aspects which can be then applied across your
application. Another term for non-functional requirements would be cross cutting concerns.
An aspect can be though of as a class, and is made up of advice, or methods.
&lt;/p&gt;
&lt;p&gt;
A common example used when describing AOP is the cross cutting concern or non-functional
requirement of tracing. Typically, in each class where you require tracing, you will
create a static read-only variable for your tracing object, and then in each method,
you will call Trace.Write(). With AOP, you can apply an attribute to the class to
perform tracing for all methods, or on specific methods. When the method is invoked,
the tracing code is executed, either before and/or after the method body depending
on how the aspect is coded. The advantage in this scenario is that you do not have
to declare that tracing variable or write the code to write the trace statement every
time. This way if you need to change the way the tracing works, you only have to do
it in one location. 
&lt;/p&gt;
&lt;p&gt;
Post Sharp provide a framework for building and applying the aspects. The aspects
are applied at compile time by injecting code into the compiled MSIL code. Aspects
are created as attributes by inheriting from several Post Sharp base classes, which
include:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
OnMethodBoundaryAspect: Used with code you own. Allows for code to be executed before
and after the method body. 
&lt;li&gt;
OnMethodInvocationAspect: Used with code you do not own, allows for code to be executed
before method. 
&lt;li&gt;
OnExceptionAspect: Code to be executed if an exception occurs. 
&lt;li&gt;
OnFieldAccessAspect: Code to be executed when a field is accessed, providing for property
getter/setting like functionality on fields. 
&lt;li&gt;
CompositionAspect: Change code at compile time. For example, you can force a type
to implement a specific interface.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Out of the box, Post Sharp gives you an incredible amount of functionality with those
base classes, but you can add new custom aspects if needed. Normally Post Sharp needs
to be installed with the MSI installer since it is integrating with Visual Studio.
However, instructions are available for an XCopy deployment.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Session #2 – &lt;/strong&gt;Guarding your code with &lt;a href="http://research.microsoft.com/en-us/projects/contracts/"&gt;Code
Contracts&lt;/a&gt; by &lt;a href="http://devlicio.us/blogs/derik_whittaker/default.aspx"&gt;Derik
Whittaker&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Code contracts is a project from Microsoft Research which is being integrated into
VS2010, and is available in VS2010 Beta I, or as a download for VS2008. Code Contracts
are a way to define static assertions at design time, to be validated at compile and
run time. 
&lt;/p&gt;
&lt;p&gt;
You probably have written a “code contract before”, but have never realized it. A
simple example is where you check to see if an object is null at the beginning of
a method, and if it is, you throw an ArgumentNullExpcetion. The Microsoft version
of Code Contracts replaces the If Then Throw convention with Contracts.Assert(boolean
expression).
&lt;/p&gt;
&lt;p&gt;
So why is the Microsoft Solution better? The Microsoft solution integrates directly
into Visual Studio giving you support for Static Analysis at design time. This means
that if you call a method with a Contract.Assert(paramter != null) and pass in null,
you will get an error at compile time, as well as a warning in the form of a squiggly
line under the method call at design time. Automatic testing tools like &lt;a title="Pex" href="http://research.microsoft.com/pex"&gt;Pex&lt;/a&gt; can
take advantage of the code contracts as well. 
&lt;/p&gt;
&lt;p&gt;
The real power of Code Contracts can be seen when you look at some of the advanced
contracts offered. For example, you can validate that a return variable is not null,
as well as validate a condition every time a method is called using the Invariant
contract.
&lt;/p&gt;
&lt;p&gt;
Run time errors are displayed using Debug.Assert behind the scenes. This is automatically
disabled in the build type is set to release. You can also handle the debug assertion
yourself by implementing an failed contract event handler.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Session #3 –&lt;/strong&gt; &lt;a href="http://fluentnhibernate.org/"&gt;Fluent NHibernate&lt;/a&gt; by &lt;a href="http://www.bestguesstheory.com/"&gt;Hudson
Akridge&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
This was an excellent session and probably my favorite of the conference. Hudson is
a member of the Fluent NHibernate team, so he obviously is an authority on the topic,
and also has a deep passion for Fluent NHibernate that is hard to reproduce. Hudson
had all of his demos compiled and running ahead of time. He simply created new projects
and used printed copies of the source to type from. This saved a tremendous amount
of time. When time did start to run out, Hudson simply switched over to his already
completed projects to finish things up. &lt;strong&gt;Memo to presenters, follow this approach!&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The Fluent NHibernate (FNH) wiki, as well as the project members blogs provide an
excellent amount of documentation, that I simply can not duplicate in this blog post,
so be sure to check out those resources. 
&lt;/p&gt;
&lt;p&gt;
FNH is built on top of NHibernate, and it’s purpose is to replace the NHibernate Mapping
Files (HBM) with a strongly typed fluent interface, with the goal of making the use
of NHibernate easier, while producing more maintainable code. It succeeds on both
fronts. 
&lt;/p&gt;
&lt;p&gt;
FNH provides two mapping options, AutoMapper, and Fluent, both of which can be used
at the same time. AutoMapper uses a convention based approach where Property and Class
names map to tables in the database. This is great for simple domains and green field
projects with simpler database schema requirements. The fluent interface provides
for a much more granular approach to mapping, and currently supports most of the functionality
provided by HBM files (most people will not know that anything is missing). The fluent
interface allows you define conventions which allow you to reduce repetive mappings.
For example, if all of your entities have an integer based Id field, you can define
that, saving yourself from having to write the mapping code over and over.
&lt;/p&gt;
&lt;p&gt;
FNH does have some limitations, such as, all properties must be public. Obviously
there are some situations where this is not desirable, so you could switch to HBM
files, or utilize on of three work-arounds for fluent. The first two involve nesting
code at some level, while the 3rd involves the use of strings to identify the non-public
field names. While you loose the strong typing and compile time checking, I think
I like the string option the best.
&lt;/p&gt;
&lt;p&gt;
Two general tips I learned during the session, was to always make your public properties
virtual so that NHibernate’s default behavior of lazy loading will work. Hudson made
the comment that you should not try to outsmart NHibernate’s lazy load mechanism.
The only time you should consider eager load is if you have to detach your object
from the NHibernate session. The other tip was the feature that allows you to generate
a complete database schema from the NHibernate mappings. From comments I heard in
the crowd, the schema generation is very impressive compared to other ORMs. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Session #4 –&lt;/strong&gt; &lt;a href="http://code.google.com/p/masstransit/"&gt;Mass
Transit&lt;/a&gt; by &lt;a href="http://www.drusellers.com/"&gt;Dru Sellers&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Mass Transit is an Enterprise Service Bus (ESB) written in .Net 3.5 and is designed
around simplicity and speed. I had a general idea of what Mass Transit was going into
this presentation, and was hoping I would learn that it would be directly applicable
to a project at work. However, it’s a little too much functionality for what we need,
and that’s not a bad thing, as we could probably make use of it in the future. 
&lt;/p&gt;
&lt;p&gt;
While I have no immediate need for an ESB at work, I was very impressed with the .Net
3.5 syntax the project uses to handle subscriptions. I’m currently starting a prototype
project that could make use of an in memory service bus, and I think I will be reviewing
the Mass Transit source to see what I can borrow. 
&lt;/p&gt;
&lt;p&gt;
Coming from a BizTalk background, a lot of the features and functionality was comparable.
However, whereas BizTalk costs money, Mass Transit is free, open source, and would
probably meet the needs of most organizations. Both of the authors (Dru, the presenter
is one of them) use Mass Transit daily in their jobs in the banking industry.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Session #5 –&lt;/strong&gt; Solid WPF by &lt;a href="http://mjeaton.net/blog/"&gt;Michael
Eaton&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
This presentation could have been titled WPF and the MVVM pattern. Not that Solid
WPF is a bad name, but for those of you at home, it was a talk on MVVM with some YAGNI
thrown in for good measure.
&lt;/p&gt;
&lt;p&gt;
This is not my first MVVM presentation, and it probably won’t be the last. Unfortunately
I’m still struggling to fully understand the pattern, which is partly due to my lack
of experience with WPF (which I need to remedy soon). 
&lt;/p&gt;
&lt;p&gt;
However, the approach that Michael took in presenting MVVM was different, in that
he started with a WPF app coded using just the code behind, then did a copy/paste
to a new project and tried a MVC pattern, and then finally worked in MVVM. Seeing
the transformation of the application from the first to the third project did help
solidify some of the MVVM concepts.&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=47b05006-f510-4154-9a5a-36b1a4a0b2fc" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,47b05006-f510-4154-9a5a-36b1a4a0b2fc.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=19b31023-5c88-4742-a7f2-22cdafea11de</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,19b31023-5c88-4742-a7f2-22cdafea11de.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,19b31023-5c88-4742-a7f2-22cdafea11de.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=19b31023-5c88-4742-a7f2-22cdafea11de</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
        </p>
        <p>
Back in March, I posted about <a href="http://blog.salvoz.com/2009/03/14/PartialSSLAndAuthorizationWithAspNetMVC.aspx">creating
a custom authorization filter</a> to enable Partial SSL. While using the filter on
an application I was porting to Windows Azure, I discovered a bug, which has led me
to revisit my implementation. Here is the original code.
</p>
        <div id="codeSnippetWrapper">
          <div id="codeSnippet" class="csharpcode">
            <pre class="alt">
              <span id="lnum1" class="lnum">
              </span>
            </pre>
          </div>
          <div id="codeSnippetWrapper">
            <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
              <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
                <span style="color: #606060" id="lnum1"> 1:</span>
                <span style="color: #0000ff">public</span>
                <span style="color: #0000ff">class</span> RequireSslFilter:AuthorizeAttribute</pre>
              <!--CRLF-->
              <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
                <span style="color: #606060" id="lnum2"> 2:</span> {</pre>
              <!--CRLF-->
              <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
                <span style="color: #606060" id="lnum3"> 3:</span>
                <span style="color: #0000ff">protected</span>
                <span style="color: #0000ff">override</span>
                <span style="color: #0000ff">bool</span> AuthorizeCore(HttpContextBase
httpContext)</pre>
              <!--CRLF-->
              <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
                <span style="color: #606060" id="lnum4"> 4:</span> {</pre>
              <!--CRLF-->
              <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
                <span style="color: #606060" id="lnum5"> 5:</span>
                <span style="color: #0000ff">if</span> (httpContext.Request.IsLocal
== <span style="color: #0000ff">false</span> &amp;&amp; httpContext.Request.IsSecureConnection
== <span style="color: #0000ff">false</span>)</pre>
              <!--CRLF-->
              <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
                <span style="color: #606060" id="lnum6"> 6:</span> httpContext.Response.Redirect(httpContext.Request.Url.ToString().ToLower().Replace(<span style="color: #006080">"http"</span>, <span style="color: #006080">"https"</span>));</pre>
              <!--CRLF-->
              <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
                <span style="color: #606060" id="lnum7"> 7:</span>  </pre>
              <!--CRLF-->
              <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
                <span style="color: #606060" id="lnum8"> 8:</span>
                <span style="color: #0000ff">return</span>
                <span style="color: #0000ff">base</span>.AuthorizeCore(httpContext);</pre>
              <!--CRLF-->
              <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
                <span style="color: #606060" id="lnum9"> 9:</span> }</pre>
              <!--CRLF-->
              <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
                <span style="color: #606060" id="lnum10"> 10:</span> }</pre>
              <!--CRLF-->
            </div>
          </div>
        </div>
        <p>
 
</p>
        <p>
As you can see, I’m calling base.AuthorizeCore at the end, which is what you usually
do when overriding a method. However, since the purpose of he Authorize Filter is
to, well authorize, the call to base.AuthorizeCore will return false if the user is
not authenticated. This is a problem because you might not be authenticated at the
time that this filter runs. 
</p>
        <p>
The reason I chose to use the Authorize Filter, is because it’s called before any
other filter, as explained by <a href="http://haacked.com/archive/2008/08/14/aspnetmvc-filters.aspx">Phill
Haack</a>. At first I thought about removing the call to the base.AuthorzieCore, but
that seemed more like a hack, then a correct solution. Digging deeper, I discovered
that the AuthorizeAttribute that I am inheriting from, implements the IAuthorizeFilter,
which requires you implement the OnAuthorization method. So instead of inheriting
from AuthorizeAttribute, I could just implement IAuthorizeFilter.
</p>
        <p>
However, someone already did it for me. In the <a href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24471">Asp.Net
MVC futures project</a>, released with the Asp.Net MVC RTM source, there is a RequireSSL
attribute ready to use. The future’s project has more functionality then mine, allowing
for the option to redirect or throw an exception. It’s nice to see I was on the right
track at least.
</p>
        <p>
RequireSSL Attribute from Asp.Net MVC Futures:
</p>
        <div id="codeSnippetWrapper">
          <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum1"> 1:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">void</span> OnAuthorization(AuthorizationContext
filterContext) {</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum2"> 2:</span>
              <span style="color: #0000ff">if</span> (filterContext
== <span style="color: #0000ff">null</span>) {</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum3"> 3:</span>
              <span style="color: #0000ff">throw</span>
              <span style="color: #0000ff">new</span> ArgumentNullException(<span style="color: #006080">"filterContext"</span>);</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum4"> 4:</span> }</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum5"> 5:</span>  </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum6"> 6:</span>
              <span style="color: #0000ff">if</span> (!filterContext.HttpContext.Request.IsSecureConnection)
{</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum7"> 7:</span>
              <span style="color: #008000">//
request is not SSL-protected, so throw or redirect</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum8"> 8:</span>
              <span style="color: #0000ff">if</span> (Redirect)
{</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum9"> 9:</span>
              <span style="color: #008000">//
form new URL</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum10"> 10:</span> UriBuilder
builder = <span style="color: #0000ff">new</span> UriBuilder() {</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum11"> 11:</span> Scheme
= <span style="color: #006080">"https"</span>,</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum12"> 12:</span> Host
= filterContext.HttpContext.Request.Url.Host,</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum13"> 13:</span>
              <span style="color: #008000">//
use the RawUrl since it works with URL Rewriting</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum14"> 14:</span> Path
= filterContext.HttpContext.Request.RawUrl</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum15"> 15:</span> };</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum16"> 16:</span> filterContext.Result
= <span style="color: #0000ff">new</span> RedirectResult(builder.ToString());</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum17"> 17:</span> }</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum18"> 18:</span>
              <span style="color: #0000ff">else</span> {</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum19"> 19:</span>
              <span style="color: #0000ff">throw</span>
              <span style="color: #0000ff">new</span> HttpException((<span style="color: #0000ff">int</span>)HttpStatusCode.Forbidden,
MvcResources.RequireSslAttribute_MustUseSsl);</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum20"> 20:</span> }</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum21"> 21:</span> }</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060" id="lnum22"> 22:</span> }</pre>
            <!--CRLF-->
          </div>
        </div>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=19b31023-5c88-4742-a7f2-22cdafea11de" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Partial SSL and Authorization with Asp.Net MVC – Revisited</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,19b31023-5c88-4742-a7f2-22cdafea11de.aspx</guid>
      <link>http://blog.salvoz.com/2009/04/25/PartialSSLAndAuthorizationWithAspNetMVCRevisited.aspx</link>
      <pubDate>Sat, 25 Apr 2009 21:08:27 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Back in March, I posted about &lt;a href="http://blog.salvoz.com/2009/03/14/PartialSSLAndAuthorizationWithAspNetMVC.aspx"&gt;creating
a custom authorization filter&lt;/a&gt; to enable Partial SSL. While using the filter on
an application I was porting to Windows Azure, I discovered a bug, which has led me
to revisit my implementation. Here is the original code.
&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span id="lnum1" class="lnum"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt; 1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; RequireSslFilter:AuthorizeAttribute&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt; 2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt; 3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; AuthorizeCore(HttpContextBase
httpContext)&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt; 4:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt; 5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (httpContext.Request.IsLocal
== &lt;span style="color: #0000ff"&gt;false&lt;/span&gt; &amp;amp;&amp;amp; httpContext.Request.IsSecureConnection
== &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt; 6:&lt;/span&gt; httpContext.Response.Redirect(httpContext.Request.Url.ToString().ToLower().Replace(&lt;span style="color: #006080"&gt;"http"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"https"&lt;/span&gt;));&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt; 7:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt; 8:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;base&lt;/span&gt;.AuthorizeCore(httpContext);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt; 9:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt; 10:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
As you can see, I’m calling base.AuthorizeCore at the end, which is what you usually
do when overriding a method. However, since the purpose of he Authorize Filter is
to, well authorize, the call to base.AuthorizeCore will return false if the user is
not authenticated. This is a problem because you might not be authenticated at the
time that this filter runs. 
&lt;/p&gt;
&lt;p&gt;
The reason I chose to use the Authorize Filter, is because it’s called before any
other filter, as explained by &lt;a href="http://haacked.com/archive/2008/08/14/aspnetmvc-filters.aspx"&gt;Phill
Haack&lt;/a&gt;. At first I thought about removing the call to the base.AuthorzieCore, but
that seemed more like a hack, then a correct solution. Digging deeper, I discovered
that the AuthorizeAttribute that I am inheriting from, implements the IAuthorizeFilter,
which requires you implement the OnAuthorization method. So instead of inheriting
from AuthorizeAttribute, I could just implement IAuthorizeFilter.
&lt;/p&gt;
&lt;p&gt;
However, someone already did it for me. In the &lt;a href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24471"&gt;Asp.Net
MVC futures project&lt;/a&gt;, released with the Asp.Net MVC RTM source, there is a RequireSSL
attribute ready to use. The future’s project has more functionality then mine, allowing
for the option to redirect or throw an exception. It’s nice to see I was on the right
track at least.
&lt;/p&gt;
&lt;p&gt;
RequireSSL Attribute from Asp.Net MVC Futures:
&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt; 1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; OnAuthorization(AuthorizationContext
filterContext) {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt; 2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (filterContext
== &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;) {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt; 3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color: #006080"&gt;"filterContext"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt; 4:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt; 5:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt; 6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!filterContext.HttpContext.Request.IsSecureConnection)
{&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt; 7:&lt;/span&gt; &lt;span style="color: #008000"&gt;//
request is not SSL-protected, so throw or redirect&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt; 8:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (Redirect)
{&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt; 9:&lt;/span&gt; &lt;span style="color: #008000"&gt;//
form new URL&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt; 10:&lt;/span&gt; UriBuilder
builder = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; UriBuilder() {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt; 11:&lt;/span&gt; Scheme
= &lt;span style="color: #006080"&gt;"https"&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt; 12:&lt;/span&gt; Host
= filterContext.HttpContext.Request.Url.Host,&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt; 13:&lt;/span&gt; &lt;span style="color: #008000"&gt;//
use the RawUrl since it works with URL Rewriting&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt; 14:&lt;/span&gt; Path
= filterContext.HttpContext.Request.RawUrl&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt; 15:&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt; 16:&lt;/span&gt; filterContext.Result
= &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; RedirectResult(builder.ToString());&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt; 17:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt; 18:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt; 19:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpException((&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;)HttpStatusCode.Forbidden,
MvcResources.RequireSslAttribute_MustUseSsl);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt; 20:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt; 21:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt; 22:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=19b31023-5c88-4742-a7f2-22cdafea11de" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,19b31023-5c88-4742-a7f2-22cdafea11de.aspx</comments>
      <category>Technology/Asp.Net MVC</category>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=61b527dc-9b5c-4813-a735-89eda7dfc031</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,61b527dc-9b5c-4813-a735-89eda7dfc031.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,61b527dc-9b5c-4813-a735-89eda7dfc031.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=61b527dc-9b5c-4813-a735-89eda7dfc031</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’m using LinqToSql as a quick way to access my database for some brownfield testing.
I needed to execute a stored procedure that returned a result set, but after adding
it to the LinqToSql design surface, I noticed that the return value was set to none,
and I was unable to change it. 
</p>
        <p>
This stored procedure had two exec statements, and a Set Transaction Isolation level
statement as well.  After commenting these out and re-adding the stored procedure
to the design surface, I was still faced with a return value of none. I ended up deleting
the stored procedure, rebuilding, and then re-adding. This finally resulted in a auto
generated return value. I then uncommented the lines I had previously commented out. 
</p>
        <p>
While researching this, I found some other people with a similar problem, and rebuilding
helped a few people, but not all, so your mileage may vary. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=61b527dc-9b5c-4813-a735-89eda7dfc031" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>No Return Value specified in LinqToSql after adding Stored Procedure</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,61b527dc-9b5c-4813-a735-89eda7dfc031.aspx</guid>
      <link>http://blog.salvoz.com/2009/04/13/NoReturnValueSpecifiedInLinqToSqlAfterAddingStoredProcedure.aspx</link>
      <pubDate>Mon, 13 Apr 2009 21:15:42 GMT</pubDate>
      <description>&lt;p&gt;
I’m using LinqToSql as a quick way to access my database for some brownfield testing.
I needed to execute a stored procedure that returned a result set, but after adding
it to the LinqToSql design surface, I noticed that the return value was set to none,
and I was unable to change it. 
&lt;/p&gt;
&lt;p&gt;
This stored procedure had two exec statements, and a Set Transaction Isolation level
statement as well.&amp;nbsp; After commenting these out and re-adding the stored procedure
to the design surface, I was still faced with a return value of none. I ended up deleting
the stored procedure, rebuilding, and then re-adding. This finally resulted in a auto
generated return value. I then uncommented the lines I had previously commented out. 
&lt;/p&gt;
&lt;p&gt;
While researching this, I found some other people with a similar problem, and rebuilding
helped a few people, but not all, so your mileage may vary. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=61b527dc-9b5c-4813-a735-89eda7dfc031" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,61b527dc-9b5c-4813-a735-89eda7dfc031.aspx</comments>
      <category>Technology/Programming</category>
      <category>Technology/Sql</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=d10d9f70-cb94-4c38-8860-55b810031b23</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,d10d9f70-cb94-4c38-8860-55b810031b23.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,d10d9f70-cb94-4c38-8860-55b810031b23.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d10d9f70-cb94-4c38-8860-55b810031b23</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
On Wednesday, March 25, the first meeting of the <a href="http://www.maddotnet.com/SIGs/ALLNETSIG/tabid/181/Default.aspx">Madison
All.Net</a> special interest group (SIG) was held at <a href="http://www.herzing.edu/campus.php?id=8">Herzing
College</a>. The All.Net SIG is all about discussing all things related to Microsoft
.Net technologies in an open spaces style meeting. Instead of the lecture hall style
room we traditionally use for the Madison .Net User Group meetings, we opted for a
classroom style room due to the format of the meeting itself. Aside from a brief survey
form I created to get an idea on what people were interested in, we had no set agenda. 
</p>
        <p>
Below are the results of the survey, which I took to get a general idea of what people
were looking to get out of the group. Just because something didn’t get a lot of votes
(i.e. Windows Embedded only got one vote, which was me) doesn’t mean people can’t
come to a meeting to ask for help, share their code and participate.
</p>
        <blockquote>
          <p>
            <strong>Topics</strong>
          </p>
          <table border="0" cellspacing="0" cellpadding="2" width="653">
            <tbody>
              <tr>
                <td valign="top" width="204">
Asp.Net MVC</td>
                <td valign="top" width="70">
8</td>
                <td valign="top" width="135">
WCF</td>
                <td valign="top" width="68">
5</td>
                <td valign="top" width="144">
Windows Mobile</td>
                <td valign="top" width="30">
2</td>
              </tr>
              <tr>
                <td valign="top" width="204">
Architecture</td>
                <td valign="top" width="70">
8</td>
                <td valign="top" width="135">
Project Management</td>
                <td valign="top" width="68">
5</td>
                <td valign="top" width="144">
Windows Forms</td>
                <td valign="top" width="30">
2</td>
              </tr>
              <tr>
                <td valign="top" width="204">
Silverlight</td>
                <td valign="top" width="70">
8</td>
                <td valign="top" width="135">
SQL Server</td>
                <td valign="top" width="68">
4</td>
                <td valign="top" width="144">
IIS 
</td>
                <td valign="top" width="30">
2</td>
              </tr>
              <tr>
                <td valign="top" width="204">
Agile</td>
                <td valign="top" width="70">
7</td>
                <td valign="top" width="135">
Asp.Net Web Forms</td>
                <td valign="top" width="68">
4</td>
                <td valign="top" width="144">
BizTalk</td>
                <td valign="top" width="30">
2</td>
              </tr>
              <tr>
                <td valign="top" width="204">
Test Driven Design/Development</td>
                <td valign="top" width="70">
7</td>
                <td valign="top" width="135">
TFS</td>
                <td valign="top" width="68">
4</td>
                <td valign="top" width="144">
Other ORM</td>
                <td valign="top" width="30">
1</td>
              </tr>
              <tr>
                <td valign="top" width="204">
Entity Framework</td>
                <td valign="top" width="70">
6</td>
                <td valign="top" width="135">
WPF</td>
                <td valign="top" width="68">
4</td>
                <td valign="top" width="144">
XNA</td>
                <td valign="top" width="30">
1</td>
              </tr>
              <tr>
                <td valign="top" width="204">
Alt.Net (General)</td>
                <td valign="top" width="70">
6</td>
                <td valign="top" width="135">
Sharepoint</td>
                <td valign="top" width="68">
4</td>
                <td valign="top" width="144">
Linq2Sql</td>
                <td valign="top" width="30">
1</td>
              </tr>
              <tr>
                <td valign="top" width="204">
Domain Driven Design</td>
                <td valign="top" width="70">
6</td>
                <td valign="top" width="135">
nHibernate</td>
                <td valign="top" width="68">
3</td>
                <td valign="top" width="144">
Windows Embedded</td>
                <td valign="top" width="30">
1</td>
              </tr>
            </tbody>
          </table>
          <p>
 
</p>
          <p>
            <strong>Topics – Write-in Suggestions</strong>
          </p>
          <p>
Scrum, Prototyping, Requirements Gathering and Analysis, Networking (Wired, Wireless,
etc), Dynamic Languages (Iron Ruby/Python), Security, WMI, Debugging, Best Practices,
Subversion, db40 SQL CE, Sync Framework, Ado.Net Data Services, Azure
</p>
          <p>
            <strong>Meeting Formats</strong>
          </p>
          <table border="0" cellspacing="0" cellpadding="2" width="600">
            <tbody>
              <tr>
                <td valign="top" width="100">
Group Project</td>
                <td valign="top" width="104">
8</td>
                <td valign="top" width="136">
Peer Code Reviews</td>
                <td valign="top" width="105">
6</td>
                <td valign="top" width="113">
Open Spaces</td>
                <td valign="top" width="42">
3</td>
              </tr>
              <tr>
                <td valign="top" width="100">
Pair Coding</td>
                <td valign="top" width="104">
6</td>
                <td valign="top" width="136">
Scheduled Topics</td>
                <td valign="top" width="105">
6</td>
                <td valign="top" width="113">
Guest Speakers</td>
                <td valign="top" width="42">
3</td>
              </tr>
            </tbody>
          </table>
        </blockquote>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
After the survey, I talked about the Mix09 conference I attended last week. This was
a two way discussion, with lots of good questions, and not a presentation (no power
point at all!). We talked briefly about Silverlight 3, Blend 3 (Sketchflow), Expression
Web 3 (Super Preview), and .Net RIA services. While we were enjoying some Pizza, we
watched a bit of the Bill Buxton/Scott Guthrie keynote, and had a good laugh at Scott’s
intro video.
</p>
        <p>
After the Pizza break we started looking at the Entity Framework, and some ideas on
a group project. I did a quick tally in my head of the technologies people were interested
in, and Asp.Net MVC, ORM (EF, nHibernate, etc), and general architecture were the
top 3. I sketched out a pretty lame diagram showing how we could create a project
that allowed us to tackle the top 3 (and other) technologies. 
</p>
        <p>
        </p>
        <p>
        </p>
        <p>
The project I proposed was basically a typical 3 tier application consisting of a
Asp.Net MVC front end, domain layer (business logic/objects), and a data access layer
implemented using a variety of ORMs. The reason for working with multiple ORMs, is
that everyone has different needs, wants and desires, and we’re trying to be as inclusive
as possible. I think almost everybody has some type of standard they need to use at
work, and in addition to pushing the boundaries of technology they be already familiar
with, they also want to try new things, and see how things work when implemented with
a different ORM. 
</p>
        <p>
In order to allow for the use of multiple ORMs, I suggested the use of a <a href="http://martinfowler.com/eaaCatalog/repository.html">repository
pattern</a>, which in simple terms, is a in memory collection of domain objects. To
implement, you define a set of interfaces in your domain (business layer), and then
create concrete implementations of the interfaces for each ORM you wish to implement.
This is quite a common approach in Domain Driven design, and in the Alt.Net space,
however, it’s usually done to aid in the testability and maintainability of the code
base.
</p>
        <p>
The following is my best attempt to create a list of all the web sites and projects
that I referenced during the discussion (in no particular order). It is important
to note that everyone’s implementation and terminology is a little bit different. 
</p>
        <ul>
          <li>
            <a href="http://jeffreypalermo.com/blog/the-onion-architecture-part-1/">Jeff Palermo's
Onion Architecture</a>
          </li>
          <li>
            <a href="http://code.google.com/p/codecampserver/">Code Camp Server</a> – Asp.Net
application used to manage code camps 
</li>
          <li>
Foundations of Programming <a href="http://codebetter.com/blogs/karlseguin/archive/2008/06/24/foundations-of-programming-ebook.aspx">E-Book</a> and <a href="http://codebetter.com/blogs/karlseguin/archive/2008/07/18/foundations-of-programming-learning-application.aspx">Sample
Application</a></li>
          <li>
            <a href="http://code.google.com/p/sharp-architecture/">Sharp Architecture</a> – “a
solid architectural foundation for rapidly building maintainable web applications
leveraging the ASP.NET MVC framework with NHibernate” 
</li>
          <li>
            <a href="http://www.asp.net/mvc/">ASP.NET MVC Storefront Starter Kit</a> – It’s listed
under sample applications halfway down the page</li>
        </ul>
        <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>
        <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>
        <p>
        </p>
        <p>
        </p>
        <p>
I don’t believe there was any final decision made on if or when we will start a group
project, but I am excited to continue to talk about this. I already got one e-mail
from someone who attended asking for examples which is why I included the list above. 
</p>
        <p>
Our next meeting should be around April 15th, but be sure to check the MadDotNet web
site for the official date and time. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=d10d9f70-cb94-4c38-8860-55b810031b23" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Madison All.Net SIG</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,d10d9f70-cb94-4c38-8860-55b810031b23.aspx</guid>
      <link>http://blog.salvoz.com/2009/03/28/MadisonAllNetSIG.aspx</link>
      <pubDate>Sat, 28 Mar 2009 02:14:01 GMT</pubDate>
      <description>&lt;p&gt;
On Wednesday, March 25, the first meeting of the &lt;a href="http://www.maddotnet.com/SIGs/ALLNETSIG/tabid/181/Default.aspx"&gt;Madison
All.Net&lt;/a&gt; special interest group (SIG) was held at &lt;a href="http://www.herzing.edu/campus.php?id=8"&gt;Herzing
College&lt;/a&gt;. The All.Net SIG is all about discussing all things related to Microsoft
.Net technologies in an open spaces style meeting. Instead of the lecture hall style
room we traditionally use for the Madison .Net User Group meetings, we opted for a
classroom style room due to the format of the meeting itself. Aside from a brief survey
form I created to get an idea on what people were interested in, we had no set agenda. 
&lt;/p&gt;
&lt;p&gt;
Below are the results of the survey, which I took to get a general idea of what people
were looking to get out of the group. Just because something didn’t get a lot of votes
(i.e. Windows Embedded only got one vote, which was me) doesn’t mean people can’t
come to a meeting to ask for help, share their code and participate.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;Topics&lt;/strong&gt;
&lt;/p&gt;
&lt;table border="0" cellspacing="0" cellpadding="2" width="653"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="204"&gt;
Asp.Net MVC&lt;/td&gt;
&lt;td valign="top" width="70"&gt;
8&lt;/td&gt;
&lt;td valign="top" width="135"&gt;
WCF&lt;/td&gt;
&lt;td valign="top" width="68"&gt;
5&lt;/td&gt;
&lt;td valign="top" width="144"&gt;
Windows Mobile&lt;/td&gt;
&lt;td valign="top" width="30"&gt;
2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="204"&gt;
Architecture&lt;/td&gt;
&lt;td valign="top" width="70"&gt;
8&lt;/td&gt;
&lt;td valign="top" width="135"&gt;
Project Management&lt;/td&gt;
&lt;td valign="top" width="68"&gt;
5&lt;/td&gt;
&lt;td valign="top" width="144"&gt;
Windows Forms&lt;/td&gt;
&lt;td valign="top" width="30"&gt;
2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="204"&gt;
Silverlight&lt;/td&gt;
&lt;td valign="top" width="70"&gt;
8&lt;/td&gt;
&lt;td valign="top" width="135"&gt;
SQL Server&lt;/td&gt;
&lt;td valign="top" width="68"&gt;
4&lt;/td&gt;
&lt;td valign="top" width="144"&gt;
IIS 
&lt;/td&gt;
&lt;td valign="top" width="30"&gt;
2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="204"&gt;
Agile&lt;/td&gt;
&lt;td valign="top" width="70"&gt;
7&lt;/td&gt;
&lt;td valign="top" width="135"&gt;
Asp.Net Web Forms&lt;/td&gt;
&lt;td valign="top" width="68"&gt;
4&lt;/td&gt;
&lt;td valign="top" width="144"&gt;
BizTalk&lt;/td&gt;
&lt;td valign="top" width="30"&gt;
2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="204"&gt;
Test Driven Design/Development&lt;/td&gt;
&lt;td valign="top" width="70"&gt;
7&lt;/td&gt;
&lt;td valign="top" width="135"&gt;
TFS&lt;/td&gt;
&lt;td valign="top" width="68"&gt;
4&lt;/td&gt;
&lt;td valign="top" width="144"&gt;
Other ORM&lt;/td&gt;
&lt;td valign="top" width="30"&gt;
1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="204"&gt;
Entity Framework&lt;/td&gt;
&lt;td valign="top" width="70"&gt;
6&lt;/td&gt;
&lt;td valign="top" width="135"&gt;
WPF&lt;/td&gt;
&lt;td valign="top" width="68"&gt;
4&lt;/td&gt;
&lt;td valign="top" width="144"&gt;
XNA&lt;/td&gt;
&lt;td valign="top" width="30"&gt;
1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="204"&gt;
Alt.Net (General)&lt;/td&gt;
&lt;td valign="top" width="70"&gt;
6&lt;/td&gt;
&lt;td valign="top" width="135"&gt;
Sharepoint&lt;/td&gt;
&lt;td valign="top" width="68"&gt;
4&lt;/td&gt;
&lt;td valign="top" width="144"&gt;
Linq2Sql&lt;/td&gt;
&lt;td valign="top" width="30"&gt;
1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="204"&gt;
Domain Driven Design&lt;/td&gt;
&lt;td valign="top" width="70"&gt;
6&lt;/td&gt;
&lt;td valign="top" width="135"&gt;
nHibernate&lt;/td&gt;
&lt;td valign="top" width="68"&gt;
3&lt;/td&gt;
&lt;td valign="top" width="144"&gt;
Windows Embedded&lt;/td&gt;
&lt;td valign="top" width="30"&gt;
1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Topics – Write-in Suggestions&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Scrum, Prototyping, Requirements Gathering and Analysis, Networking (Wired, Wireless,
etc), Dynamic Languages (Iron Ruby/Python), Security, WMI, Debugging, Best Practices,
Subversion, db40 SQL CE, Sync Framework, Ado.Net Data Services, Azure
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Meeting Formats&lt;/strong&gt;
&lt;/p&gt;
&lt;table border="0" cellspacing="0" cellpadding="2" width="600"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="100"&gt;
Group Project&lt;/td&gt;
&lt;td valign="top" width="104"&gt;
8&lt;/td&gt;
&lt;td valign="top" width="136"&gt;
Peer Code Reviews&lt;/td&gt;
&lt;td valign="top" width="105"&gt;
6&lt;/td&gt;
&lt;td valign="top" width="113"&gt;
Open Spaces&lt;/td&gt;
&lt;td valign="top" width="42"&gt;
3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="100"&gt;
Pair Coding&lt;/td&gt;
&lt;td valign="top" width="104"&gt;
6&lt;/td&gt;
&lt;td valign="top" width="136"&gt;
Scheduled Topics&lt;/td&gt;
&lt;td valign="top" width="105"&gt;
6&lt;/td&gt;
&lt;td valign="top" width="113"&gt;
Guest Speakers&lt;/td&gt;
&lt;td valign="top" width="42"&gt;
3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
After the survey, I talked about the Mix09 conference I attended last week. This was
a two way discussion, with lots of good questions, and not a presentation (no power
point at all!). We talked briefly about Silverlight 3, Blend 3 (Sketchflow), Expression
Web 3 (Super Preview), and .Net RIA services. While we were enjoying some Pizza, we
watched a bit of the Bill Buxton/Scott Guthrie keynote, and had a good laugh at Scott’s
intro video.
&lt;/p&gt;
&lt;p&gt;
After the Pizza break we started looking at the Entity Framework, and some ideas on
a group project. I did a quick tally in my head of the technologies people were interested
in, and Asp.Net MVC, ORM (EF, nHibernate, etc), and general architecture were the
top 3. I sketched out a pretty lame diagram showing how we could create a project
that allowed us to tackle the top 3 (and other) technologies. 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
The project I proposed was basically a typical 3 tier application consisting of a
Asp.Net MVC front end, domain layer (business logic/objects), and a data access layer
implemented using a variety of ORMs. The reason for working with multiple ORMs, is
that everyone has different needs, wants and desires, and we’re trying to be as inclusive
as possible. I think almost everybody has some type of standard they need to use at
work, and in addition to pushing the boundaries of technology they be already familiar
with, they also want to try new things, and see how things work when implemented with
a different ORM. 
&lt;/p&gt;
&lt;p&gt;
In order to allow for the use of multiple ORMs, I suggested the use of a &lt;a href="http://martinfowler.com/eaaCatalog/repository.html"&gt;repository
pattern&lt;/a&gt;, which in simple terms, is a in memory collection of domain objects. To
implement, you define a set of interfaces in your domain (business layer), and then
create concrete implementations of the interfaces for each ORM you wish to implement.
This is quite a common approach in Domain Driven design, and in the Alt.Net space,
however, it’s usually done to aid in the testability and maintainability of the code
base.
&lt;/p&gt;
&lt;p&gt;
The following is my best attempt to create a list of all the web sites and projects
that I referenced during the discussion (in no particular order). It is important
to note that everyone’s implementation and terminology is a little bit different. 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://jeffreypalermo.com/blog/the-onion-architecture-part-1/"&gt;Jeff Palermo's
Onion Architecture&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://code.google.com/p/codecampserver/"&gt;Code Camp Server&lt;/a&gt; – Asp.Net
application used to manage code camps 
&lt;li&gt;
Foundations of Programming &lt;a href="http://codebetter.com/blogs/karlseguin/archive/2008/06/24/foundations-of-programming-ebook.aspx"&gt;E-Book&lt;/a&gt; and &lt;a href="http://codebetter.com/blogs/karlseguin/archive/2008/07/18/foundations-of-programming-learning-application.aspx"&gt;Sample
Application&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://code.google.com/p/sharp-architecture/"&gt;Sharp Architecture&lt;/a&gt; – “a
solid architectural foundation for rapidly building maintainable web applications
leveraging the ASP.NET MVC framework with NHibernate” 
&lt;li&gt;
&lt;a href="http://www.asp.net/mvc/"&gt;ASP.NET MVC Storefront Starter Kit&lt;/a&gt; – It’s listed
under sample applications halfway down the page&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
I don’t believe there was any final decision made on if or when we will start a group
project, but I am excited to continue to talk about this. I already got one e-mail
from someone who attended asking for examples which is why I included the list above. 
&lt;/p&gt;
&lt;p&gt;
Our next meeting should be around April 15th, but be sure to check the MadDotNet web
site for the official date and time. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=d10d9f70-cb94-4c38-8860-55b810031b23" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,d10d9f70-cb94-4c38-8860-55b810031b23.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=c4e3f6d6-59de-4288-b4b8-5c4b38d892b9</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,c4e3f6d6-59de-4288-b4b8-5c4b38d892b9.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,c4e3f6d6-59de-4288-b4b8-5c4b38d892b9.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c4e3f6d6-59de-4288-b4b8-5c4b38d892b9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <strong>UPDATED: 4/25/2008 – </strong>See my <a href="http://blog.salvoz.com/2009/04/25/PartialSSLAndAuthorizationWithAspNetMVCRevisited.aspx">new
post</a> of Partial SSL in Asp.Net MVC using the RequireSSL attribute from the MVC
Futures Project
</p>
        <p>
Tonight I was working on a small Asp.Net MVC project and was trying to add authorization
and “require ssl” to specific pages using IIS. Of course you don’t have pages like
you used to in Web Forms, so setting security and SSL on a per directory and per file
basis doesn’t work like I’m used to. 
</p>
        <p>
The authorization requirement is actually pretty easy to handle once I approached
the problem from a strictly MVC point of view. Using the Authorize attribute, which
is included with Asp.Net MVC, I was able to pick and choose which controller actions
I wanted to secure. In the code sample below I’m requiring the requestor to belong
to the Users role.
</p>
        <blockquote>
          <p>
[AcceptVerbs(HttpVerbs.Get), RequireSslFilter(Order=1), Authorize(Roles="Users",Order=2)]<br />
public ActionResult ToServer()<br />
{<br />
   return View("ToServer");<br />
}
</p>
        </blockquote>
        <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>
When you need a little more control, you can implement a class that inherits from
AuthorizeAttribute. Examples of when you might want to do this, would be if you wanted
to change the authorized role at runtime, or not require any role (perhaps in your
dev environment), or when you want to require SSL. In the above example you can see
the RequiresSslFilter, which is a custom filter implemented as shown below which requires
the use of SSL.
</p>
        <blockquote>public class RequireSslFilter:AuthorizeAttribute<br />
{<br />
protected override bool AuthorizeCore(HttpContextBase httpContext)<br />
{<br />
   if (httpContext.Request.IsLocal == false &amp;&amp; httpContext.Request.IsSecureConnection
== false)<br />
   httpContext.Response.Redirect(httpContext.Request.Url.ToString().ToLower().Replace("http",
"https"));<br /><br />
   return base.AuthorizeCore(httpContext);<br />
}<br /><br />
}</blockquote>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
In the code, I’m checking for if the request is local and secure, and redirecting
to a secure version of the request. The check for IsLocal is useful for development
scenarios. I added the Order parameter to the use of the RequiresSslFilter attribute
to ensure that I check for the use of SSL before the check for the role. This helps
ensure that credentials are only sent over SSL. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=c4e3f6d6-59de-4288-b4b8-5c4b38d892b9" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Partial SSL and Authorization with Asp.Net MVC</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,c4e3f6d6-59de-4288-b4b8-5c4b38d892b9.aspx</guid>
      <link>http://blog.salvoz.com/2009/03/14/PartialSSLAndAuthorizationWithAspNetMVC.aspx</link>
      <pubDate>Sat, 14 Mar 2009 03:44:29 GMT</pubDate>
      <description>&lt;p&gt;
&lt;strong&gt;UPDATED: 4/25/2008 – &lt;/strong&gt;See my &lt;a href="http://blog.salvoz.com/2009/04/25/PartialSSLAndAuthorizationWithAspNetMVCRevisited.aspx"&gt;new
post&lt;/a&gt; of Partial SSL in Asp.Net MVC using the RequireSSL attribute from the MVC
Futures Project
&lt;/p&gt;
&lt;p&gt;
Tonight I was working on a small Asp.Net MVC project and was trying to add authorization
and “require ssl” to specific pages using IIS. Of course you don’t have pages like
you used to in Web Forms, so setting security and SSL on a per directory and per file
basis doesn’t work like I’m used to. 
&lt;/p&gt;
&lt;p&gt;
The authorization requirement is actually pretty easy to handle once I approached
the problem from a strictly MVC point of view. Using the Authorize attribute, which
is included with Asp.Net MVC, I was able to pick and choose which controller actions
I wanted to secure. In the code sample below I’m requiring the requestor to belong
to the Users role.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
[AcceptVerbs(HttpVerbs.Get), RequireSslFilter(Order=1), Authorize(Roles="Users",Order=2)]&lt;br&gt;
public ActionResult ToServer()&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp; return View("ToServer");&lt;br&gt;
}
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
When you need a little more control, you can implement a class that inherits from
AuthorizeAttribute. Examples of when you might want to do this, would be if you wanted
to change the authorized role at runtime, or not require any role (perhaps in your
dev environment), or when you want to require SSL. In the above example you can see
the RequiresSslFilter, which is a custom filter implemented as shown below which requires
the use of SSL.
&lt;/p&gt;
&lt;blockquote&gt;public class RequireSslFilter:AuthorizeAttribute&lt;br&gt;
{&lt;br&gt;
protected override bool AuthorizeCore(HttpContextBase httpContext)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp; if (httpContext.Request.IsLocal == false &amp;amp;&amp;amp; httpContext.Request.IsSecureConnection
== false)&lt;br&gt;
&amp;nbsp;&amp;nbsp; httpContext.Response.Redirect(httpContext.Request.Url.ToString().ToLower().Replace("http",
"https"));&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp; return base.AuthorizeCore(httpContext);&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
}&lt;/blockquote&gt; 
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
In the code, I’m checking for if the request is local and secure, and redirecting
to a secure version of the request. The check for IsLocal is useful for development
scenarios. I added the Order parameter to the use of the RequiresSslFilter attribute
to ensure that I check for the use of SSL before the check for the role. This helps
ensure that credentials are only sent over SSL. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=c4e3f6d6-59de-4288-b4b8-5c4b38d892b9" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,c4e3f6d6-59de-4288-b4b8-5c4b38d892b9.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=47a249c5-a2c9-43a6-a512-f9ad512ab4e5</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,47a249c5-a2c9-43a6-a512-f9ad512ab4e5.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,47a249c5-a2c9-43a6-a512-f9ad512ab4e5.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=47a249c5-a2c9-43a6-a512-f9ad512ab4e5</wfw:commentRss>
      <title>Madison .Net Users Group Meeting &amp;ndash; February</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,47a249c5-a2c9-43a6-a512-f9ad512ab4e5.aspx</guid>
      <link>http://blog.salvoz.com/2009/02/06/MadisonNetUsersGroupMeetingNdashFebruary.aspx</link>
      <pubDate>Fri, 06 Feb 2009 05:07:02 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Last night was the regularly scheduled meeting for the &lt;a href="http://www.maddotnet.com/"&gt;Madison
.Net Users Group&lt;/a&gt; and consisted of a presentation on MVVM by Christopher Huganen,
and the first meeting of the TFS SIG, led by &lt;a href="http://www.feirtech.com/"&gt;Travis
Feirtag&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;MVVM&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
MVVM stands for Model, View, View Model, and is an architectural pattern that focuses
on testability and separation of concerns. While MVVM can be used in a variety of
application environments, the focus of this presentation was on it’s use with WPF.
As a matter of fact, I’m seeing MVVM paired specifically with WPF more and more.
&lt;/p&gt;
&lt;p&gt;
Some key advantages of MVVM that were talked about include:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Separation of Concerns 
&lt;li&gt;
Use the force of WPF (bindings) 
&lt;li&gt;
Write less code 
&lt;li&gt;
Easy to Unit test 
&lt;li&gt;
Split Designer/Developer responsibilities&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
To the inexperienced WPF developer (which includes myself), it may seem difficult
to believe that MVVM leads to writing less code. At first glance, and from reviewing
numerous (short) examples, it basically looks like you are rewriting your business
entity class, but adding support for binding and other View concerns. I believe that
overall it will lead to less code, but I can’t comment directly on it until I actually
implement something using this pattern (which I hope to start soon). 
&lt;/p&gt;
&lt;p&gt;
Here are a few links that were provided last night that talk more about the MVVM pattern:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a title="WPF Apps With The Model-View-ViewModel Design Pattern" href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx"&gt;MSDN
Article - WPF Apps With The Model-View-ViewModel Design Pattern&lt;/a&gt; written by &lt;a title="Josh Smith&amp;rsquo;s" href="http://joshsmithonwpf.wordpress.com/"&gt;Josh
Smith&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://karlshifflett.wordpress.com/"&gt;Karl Shifflett's&lt;/a&gt; blog and &lt;a href="http://karlshifflett.wordpress.com/mvvm/"&gt;section&lt;/a&gt; of
MVVM&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
And for the sake of completeness, here are a couple of definitions for some similar
patterns.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://martinfowler.com/eaaDev/SupervisingPresenter.html"&gt;Supervising Presenter&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://martinfowler.com/eaaDev/PassiveScreen.html"&gt;Passive View&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;TFS&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
As I mentioned in my opening, last night was the first meeting of the TFS SIG. Travis
put together a short slide deck outlining the purpose of the SIG (&lt;a href="http://www.maddotnet.com/LinkClick.aspx?fileticket=b0sZG8CK8Tk%3d&amp;amp;tabid=151&amp;amp;mid=559"&gt;TFS
SIG Slides&lt;/a&gt;), and also brought an external hard drive with a VPC image containing
TFS 2008 and Team Suite 2008 (running on top of Win2k3 Server). 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.microsoft.com/DownLoads/details.aspx?FamilyID=72262ead-e49d-43d4-aa45-1da2a27d9a65&amp;amp;displaylang=en"&gt;VPC
Image&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.microsoft.com/DownLoads/details.aspx?familyid=39644CDD-DB4D-445E-B087-DD3E3CDF03FB&amp;amp;displaylang=en"&gt;Hyper-V
Image&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I am really excited about participating in the TFS SIG, as TFS is something I started,
but I guess you could say never finished. So in addition to the labs and topics covered
initially at the SIG, I’m hoping to start a project with the purpose of better understanding
TFS from the project management point of view.
&lt;/p&gt;
&lt;p&gt;
Here are some links to some of the things I brought up during the SIG portion of the
meeting (and a few other links):
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
My blog posts (&lt;a href="http://blog.salvoz.com/2007/10/21/InstallingTFS2008Beta2.aspx"&gt;part1&lt;/a&gt;, &lt;a href="http://blog.salvoz.com/2007/10/23/TFS2008TheSagaContinues.aspx"&gt;part2&lt;/a&gt;)
on migrating from TFS 2005 to 2008 Beta, which covers migrating between domains and
servers&lt;/li&gt;
&lt;li&gt;
&lt;a title="TFS Branching Guide 2.0" href="http://www.codeplex.com/TFSBranchingGuideII"&gt;TFS
Branching Guide 2.0&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a title="MSBuild Extension Pack" href="http://www.codeplex.com/MSBuildExtensionPack"&gt;MSBuild
Extension Pack&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a title="SvnBridge - Use TortoiseSVN with Team Foundation Server" href="http://www.codeplex.com/SvnBridge"&gt;SvnBridge
- Use TortoiseSVN with Team Foundation Server&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://localhost:8080/Warehouse/v1.0/warehousecontroller.asmx"&gt;http://localhost:8080/Warehouse/v1.0/warehousecontroller.asmx&lt;/a&gt; –
This is the URL to the warehouse controller web service in TFS. From here you can
manually invoke the warehouse update job so you can get updated reports. Also great
for trouble shooting.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;MVC&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
After the meeting I got to talking with a couple of people about Asp.Net MVC and promised
a couple of links:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://jeffreypalermo.com/"&gt;Jeff Palermo's Blog&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a title="http://www.codeplex.com/MVCContrib" href="http://www.codeplex.com/MVCContrib"&gt;http://www.codeplex.com/MVCContrib&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://code.google.com/p/codecampserver/"&gt;Code Camp Server&lt;/a&gt; – A “reference”
application built using Asp.Net MVC, TDD and DDD.&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=47a249c5-a2c9-43a6-a512-f9ad512ab4e5" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,47a249c5-a2c9-43a6-a512-f9ad512ab4e5.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=d27ee1b0-61a7-4ae8-bd25-99e2e9ef0535</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,d27ee1b0-61a7-4ae8-bd25-99e2e9ef0535.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,d27ee1b0-61a7-4ae8-bd25-99e2e9ef0535.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d27ee1b0-61a7-4ae8-bd25-99e2e9ef0535</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Like a lot of developers, I am an early adopter, and as such I downloaded and installed
Windows 7 beta (blog post forthcoming) on a variety of my computers and created new
VM’s. I decided to try to switch over to a Windows 7 beta dev machine at home, to
see if there are any gotchas. So far there is nothing related to Windows 7, but getting
VS to work fully with my projects stored on a network share took some additional time.
</p>
        <p>
Apparently I completely forgot I had to set Code Access Security on my original development
machine, and even after I remember vaguely doing it, I don’t remember what I did.
Going back and looking at the settings via mscorcfg.msc, it looks like I just granted
the local intranet full trust. This time around I wanted to just grant the full trust
permission set to my projects folder on my network share. Not that I don’t trust my
local intranet, it just seems like the correct thing to do.
</p>
        <p>
First I tried messing around with the command like tool, caspol, but my command line
skills just were not cutting it. I looked for mscorcfg, but it’s no longer installed
with Visual Studio (2008), so I downloaded and installed the latest .net SDK. I figure
there are some other good tools in it any way. With access to mscorcfg, I set out
to grant my user share, U:\Projects full trust permissions.
</p>
        <p>
I figured out that I needed to add a new code group, but I didn’t know under which
zone. Reviewing the error in Visual Studio, it referenced both My Computer and Local
Intranet. I decided to try My Computer first, and that didn’t work, so I created a
second code group under Local Intranet and that did work. I didn’t want to leave extra
stuff around, so I removed the code group from My Computer and everything still worked.
</p>
        <p>
Here are the steps I took:
</p>
        <ol>
          <li>
Open mscorcfg (as an administrator if you want to modify the CAS at the machine level)</li>
          <li>
Under Runtime Security Policy, expand the Enterprise, Machine, or User, and then under
Code Groups drill down to the Local Intranet Zone</li>
          <li>
Right click on Local Intranet Zone and choose new</li>
        </ol>
        <ol>
          <li>
Ender a name and description for your code group and click next</li>
          <li>
For the condition condition, change it to URL. 
</li>
          <li>
This is the tricky part, entering a correct URL. The path I wanted to add, as shown
in windows explorer is U:\Projects, but the error message in VS showed file:///U:/Projects/,
so I used that as the URL and added a * at the end, so I ended up with <a href="file:///U:/Projects/">file:///U:/Projects/</a>*.
Click Next.</li>
        </ol>
        <li>
Select Full Trust, and click next</li>
        <li>
Click finish</li>
        <p>
You need to restart Visual Studio after you make a change. While looking for some
help on the Internet, I also saw that you can use mscorcfg to create a MSI installer
package with your CAS settings, which you can run on other machines, or deploy via
group policy. This option is available as “Create Deployment Package” when you left
click and select Runtime Security Policy.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=d27ee1b0-61a7-4ae8-bd25-99e2e9ef0535" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Code Access Security (CAS)</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,d27ee1b0-61a7-4ae8-bd25-99e2e9ef0535.aspx</guid>
      <link>http://blog.salvoz.com/2009/01/24/CodeAccessSecurityCAS.aspx</link>
      <pubDate>Sat, 24 Jan 2009 04:12:53 GMT</pubDate>
      <description>&lt;p&gt;
Like a lot of developers, I am an early adopter, and as such I downloaded and installed
Windows 7 beta (blog post forthcoming) on a variety of my computers and created new
VM’s. I decided to try to switch over to a Windows 7 beta dev machine at home, to
see if there are any gotchas. So far there is nothing related to Windows 7, but getting
VS to work fully with my projects stored on a network share took some additional time.
&lt;/p&gt;
&lt;p&gt;
Apparently I completely forgot I had to set Code Access Security on my original development
machine, and even after I remember vaguely doing it, I don’t remember what I did.
Going back and looking at the settings via mscorcfg.msc, it looks like I just granted
the local intranet full trust. This time around I wanted to just grant the full trust
permission set to my projects folder on my network share. Not that I don’t trust my
local intranet, it just seems like the correct thing to do.
&lt;/p&gt;
&lt;p&gt;
First I tried messing around with the command like tool, caspol, but my command line
skills just were not cutting it. I looked for mscorcfg, but it’s no longer installed
with Visual Studio (2008), so I downloaded and installed the latest .net SDK. I figure
there are some other good tools in it any way. With access to mscorcfg, I set out
to grant my user share, U:\Projects full trust permissions.
&lt;/p&gt;
&lt;p&gt;
I figured out that I needed to add a new code group, but I didn’t know under which
zone. Reviewing the error in Visual Studio, it referenced both My Computer and Local
Intranet. I decided to try My Computer first, and that didn’t work, so I created a
second code group under Local Intranet and that did work. I didn’t want to leave extra
stuff around, so I removed the code group from My Computer and everything still worked.
&lt;/p&gt;
&lt;p&gt;
Here are the steps I took:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Open mscorcfg (as an administrator if you want to modify the CAS at the machine level)&lt;/li&gt;
&lt;li&gt;
Under Runtime Security Policy, expand the Enterprise, Machine, or User, and then under
Code Groups drill down to the Local Intranet Zone&lt;/li&gt;
&lt;li&gt;
Right click on Local Intranet Zone and choose new&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;
Ender a name and description for your code group and click next&lt;/li&gt;
&lt;li&gt;
For the condition condition, change it to URL. 
&lt;/li&gt;
&lt;li&gt;
This is the tricky part, entering a correct URL. The path I wanted to add, as shown
in windows explorer is U:\Projects, but the error message in VS showed file:///U:/Projects/,
so I used that as the URL and added a * at the end, so I ended up with &lt;a href="file:///U:/Projects/"&gt;file:///U:/Projects/&lt;/a&gt;*.
Click Next.&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;
Select Full Trust, and click next&lt;/li&gt;
&lt;li&gt;
Click finish&lt;/li&gt;&gt;
&lt;p&gt;
You need to restart Visual Studio after you make a change. While looking for some
help on the Internet, I also saw that you can use mscorcfg to create a MSI installer
package with your CAS settings, which you can run on other machines, or deploy via
group policy. This option is available as “Create Deployment Package” when you left
click and select Runtime Security Policy.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=d27ee1b0-61a7-4ae8-bd25-99e2e9ef0535" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,d27ee1b0-61a7-4ae8-bd25-99e2e9ef0535.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=d58be85c-ad2f-4499-853f-49fba2e8aabc</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,d58be85c-ad2f-4499-853f-49fba2e8aabc.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,d58be85c-ad2f-4499-853f-49fba2e8aabc.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d58be85c-ad2f-4499-853f-49fba2e8aabc</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This week I started working on my first Asp.Net MVC project. The requirements I am
working with approximately 5 pages or views, and is read-only in nature, which I thought
would be perfect for trying out the MVC stuff. I am also trying to take a incorporate
some other methodologies, tools and techniques I have been reading up on, including:
</p>
        <ul>
          <li>
Domain Driven Design (DDD) 
<ul><li>
Repository Pattern 
</li><li>
Your not going to need it principle (YNGTNI) 
</li><li>
Keep it simple stupid (KISS)</li></ul></li>
          <li>
Test Driven Design (TDD) 
</li>
          <li>
Mocking (<a href="http://ayende.com/projects/rhino-mocks.aspx">RhinoMocks</a>) 
</li>
          <li>
Inversion of Control (<a href="http://ninject.org/">Ninject</a>)</li>
        </ul>
        <p>
So far the project is going really well. I’ve created all of my views, controllers,
and basic page navigation, including some URL validation that redirects the user to
a page when a parameter is missing from the URL (id part of the default route). 
I’ve also added Inversion of Control using the Ninject framework, which I am using
to specify my data store type (In memory for testing, or a Sql based store for actual
data). I choose Ninject due to it’s small footprint, focused feature set, and Compact
Framework and Silverlight compatibility (while not needed for this project, I have
a use for that level of compatibility on another project and wanted to limit the number
of frameworks I’m using).
</p>
        <p>
          <strong>CodeBetter: </strong>I should have thrown this out in the beginning, but I’m
using the <a href="http://codebetter.com/blogs/karlseguin/archive/2008/06/24/foundations-of-programming-ebook.aspx">Foundations
of Programming</a> Ebook and learning application written by Karl Seguin as a starting
point. I highly recommend it for people looking to get into the Alt.Net mindset (DDD,
TDD, mocking, etc). 
</p>
        <p>
          <strong>Solution Structure: </strong>At the start of this project, I was working up
an elaborate solution (directory) structure, where I would separate out my Infrastructure,
MVC, Domain, and Data Stores into separate projects. I quickly realized, that this
wasn’t needed based on my requirements, nor did it follow KISS or YNGTNI. Instead,
I separate out my concerns in the MVC project using namespaces. Since I am making
heavy use of Unit Testing, if the need ever arose I could split stuff out into separate
projects in less then a day, update my tests and be good to go. So in the end, I have
one MVC project, a unit test project, and a Web Test project.
</p>
        <p>
          <strong>TDD: </strong>I have two testing projects, one for unit tests, using Xunit,
RhinoMocks, and TestDriven.Net. This project tests all of the code for the model/domain,
controllers, and infrastructure. My other project uses MSTest and is for my Web Tests,
which are more of integration tests. There are some things you just can’t unit test
that well, like did the menu get hidden when no account number was present in the
URL.
</p>
        <p>
          <strong>Routes:</strong> I am using the default route Controller/Action/Id that comes
with the sample project. This fits my requirements perfectly, as I need the Id part
for an account number. My requirement was to have a URL in the form of <a href="http://Website/Home?Account=123456">http://Website/Home?Account=123456</a> which
I was able to change to <a href="http://Website/Home/Account/123456">http://Website/Home/Account/123456</a></p>
        <p>
          <strong>Code Behind: </strong>I’ve gone ahead and removed all of the code behind files
on my views and user controls to make sure I don’t take any shortcuts with the code
behind files. I’ve read several work around's for getting strongly typed views without
a code behind file, so I’m covered there. By removing the code behind you eliminate
2 extra files per view/user control (ViewName.cs and ViewName.Designer.cs). Just remove
the AutoEventWireup and Codebehind attributes in your view, and change the inherits
attribute to System.Web.Mvc.ViewPage or ViewUserControl
</p>
        <p>
&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage"
%&gt;
</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>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
          <strong>Passing Id: </strong>One thing I found out I needed to do often, was construct
a URL the conformed to my routing. Thankfully there is a helper method you can use
in your view called Html.ActionLink, which has several overloads. I’m using the overloaded
method that takes the name of the controller, action, an object for values, and an
object for html attributes. Getting the object passed for values was not apparent
right away, but you make use anonymous types.  The following code creates the
following link, Home/Account/123456 (assuming ViewData[“Id”] is set to 123456), and
gives it a text value of Home.
</p>
        <p>
Html.ActionLink("Home", "Account", "Home", new { id = ViewData["Id"] }, null)
</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>
        </p>
        <p>
          <strong>Filters: </strong>As I mentioned before, in using the default route, I’m “mapping”
id to an account number. If there is no account number present, or the account number
does not correspond to an actual account, I need to take some action. At first I had
a helper method that I would call from each action that needed the account number,
and redirect to a certain view if the account number was missing. Then I read about
filters, and the OnActionExecuting override in the controller object, and thought
that would be a better way to go. However, I’m going to go back to calling a method
in each action for the following reasons:
</p>
        <ul>
          <li>
Easier to unit test. With OnActionExecuting override, I havn’t been able to find a
way to unit test the method or the overall behavior.</li>
          <li>
Code Smell. While one could argue writing the same line of code in each each action
method smells, it is not as bad as having to check for certain action names in OnActionExecuting.
For example, I didn’t want to redirect to the account entry page if I was already
there. This way, I can call the method only on the action methods that need it.</li>
          <li>
Easier to understand. To the uninitiated MVC programmer, it’s simpler to follow then
attributes or a base class override. 
</li>
        </ul>
        <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>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
That’s all for now. I’ll try to write an update after I finish the project. I need
to work with grids, and the new MS Charting controls, so that would be worthy of a
follow up post.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=d58be85c-ad2f-4499-853f-49fba2e8aabc" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>My First Asp.Net MVC Project</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,d58be85c-ad2f-4499-853f-49fba2e8aabc.aspx</guid>
      <link>http://blog.salvoz.com/2009/01/02/MyFirstAspNetMVCProject.aspx</link>
      <pubDate>Fri, 02 Jan 2009 02:23:06 GMT</pubDate>
      <description>&lt;p&gt;
This week I started working on my first Asp.Net MVC project. The requirements I am
working with approximately 5 pages or views, and is read-only in nature, which I thought
would be perfect for trying out the MVC stuff. I am also trying to take a incorporate
some other methodologies, tools and techniques I have been reading up on, including:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Domain Driven Design (DDD) 
&lt;ul&gt;
&lt;li&gt;
Repository Pattern 
&lt;li&gt;
Your not going to need it principle (YNGTNI) 
&lt;li&gt;
Keep it simple stupid (KISS)&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Test Driven Design (TDD) 
&lt;li&gt;
Mocking (&lt;a href="http://ayende.com/projects/rhino-mocks.aspx"&gt;RhinoMocks&lt;/a&gt;) 
&lt;li&gt;
Inversion of Control (&lt;a href="http://ninject.org/"&gt;Ninject&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
So far the project is going really well. I’ve created all of my views, controllers,
and basic page navigation, including some URL validation that redirects the user to
a page when a parameter is missing from the URL (id part of the default route).&amp;nbsp;
I’ve also added Inversion of Control using the Ninject framework, which I am using
to specify my data store type (In memory for testing, or a Sql based store for actual
data). I choose Ninject due to it’s small footprint, focused feature set, and Compact
Framework and Silverlight compatibility (while not needed for this project, I have
a use for that level of compatibility on another project and wanted to limit the number
of frameworks I’m using).
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;CodeBetter: &lt;/strong&gt;I should have thrown this out in the beginning, but I’m
using the &lt;a href="http://codebetter.com/blogs/karlseguin/archive/2008/06/24/foundations-of-programming-ebook.aspx"&gt;Foundations
of Programming&lt;/a&gt; Ebook and learning application written by Karl Seguin as a starting
point. I highly recommend it for people looking to get into the Alt.Net mindset (DDD,
TDD, mocking, etc). 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Solution Structure: &lt;/strong&gt;At the start of this project, I was working up
an elaborate solution (directory) structure, where I would separate out my Infrastructure,
MVC, Domain, and Data Stores into separate projects. I quickly realized, that this
wasn’t needed based on my requirements, nor did it follow KISS or YNGTNI. Instead,
I separate out my concerns in the MVC project using namespaces. Since I am making
heavy use of Unit Testing, if the need ever arose I could split stuff out into separate
projects in less then a day, update my tests and be good to go. So in the end, I have
one MVC project, a unit test project, and a Web Test project.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;TDD: &lt;/strong&gt;I have two testing projects, one for unit tests, using Xunit,
RhinoMocks, and TestDriven.Net. This project tests all of the code for the model/domain,
controllers, and infrastructure. My other project uses MSTest and is for my Web Tests,
which are more of integration tests. There are some things you just can’t unit test
that well, like did the menu get hidden when no account number was present in the
URL.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Routes:&lt;/strong&gt; I am using the default route Controller/Action/Id that comes
with the sample project. This fits my requirements perfectly, as I need the Id part
for an account number. My requirement was to have a URL in the form of &lt;a href="http://Website/Home?Account=123456"&gt;http://Website/Home?Account=123456&lt;/a&gt; which
I was able to change to &lt;a href="http://Website/Home/Account/123456"&gt;http://Website/Home/Account/123456&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Code Behind: &lt;/strong&gt;I’ve gone ahead and removed all of the code behind files
on my views and user controls to make sure I don’t take any shortcuts with the code
behind files. I’ve read several work around's for getting strongly typed views without
a code behind file, so I’m covered there. By removing the code behind you eliminate
2 extra files per view/user control (ViewName.cs and ViewName.Designer.cs). Just remove
the AutoEventWireup and Codebehind attributes in your view, and change the inherits
attribute to System.Web.Mvc.ViewPage or ViewUserControl
&lt;/p&gt;
&lt;p&gt;
&amp;lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage"
%&amp;gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Passing Id: &lt;/strong&gt;One thing I found out I needed to do often, was construct
a URL the conformed to my routing. Thankfully there is a helper method you can use
in your view called Html.ActionLink, which has several overloads. I’m using the overloaded
method that takes the name of the controller, action, an object for values, and an
object for html attributes. Getting the object passed for values was not apparent
right away, but you make use anonymous types.&amp;nbsp; The following code creates the
following link, Home/Account/123456 (assuming ViewData[“Id”] is set to 123456), and
gives it a text value of Home.
&lt;/p&gt;
&lt;p&gt;
Html.ActionLink("Home", "Account", "Home", new { id = ViewData["Id"] }, null)
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Filters: &lt;/strong&gt;As I mentioned before, in using the default route, I’m “mapping”
id to an account number. If there is no account number present, or the account number
does not correspond to an actual account, I need to take some action. At first I had
a helper method that I would call from each action that needed the account number,
and redirect to a certain view if the account number was missing. Then I read about
filters, and the OnActionExecuting override in the controller object, and thought
that would be a better way to go. However, I’m going to go back to calling a method
in each action for the following reasons:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Easier to unit test. With OnActionExecuting override, I havn’t been able to find a
way to unit test the method or the overall behavior.&lt;/li&gt;
&lt;li&gt;
Code Smell. While one could argue writing the same line of code in each each action
method smells, it is not as bad as having to check for certain action names in OnActionExecuting.
For example, I didn’t want to redirect to the account entry page if I was already
there. This way, I can call the method only on the action methods that need it.&lt;/li&gt;
&lt;li&gt;
Easier to understand. To the uninitiated MVC programmer, it’s simpler to follow then
attributes or a base class override. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
That’s all for now. I’ll try to write an update after I finish the project. I need
to work with grids, and the new MS Charting controls, so that would be worthy of a
follow up post.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=d58be85c-ad2f-4499-853f-49fba2e8aabc" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,d58be85c-ad2f-4499-853f-49fba2e8aabc.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=18b84c58-4b38-4310-afe1-ac74f66d1937</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,18b84c58-4b38-4310-afe1-ac74f66d1937.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,18b84c58-4b38-4310-afe1-ac74f66d1937.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=18b84c58-4b38-4310-afe1-ac74f66d1937</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
In <a href="http://blog.salvoz.com/2008/12/05/BizTalkWebAdminNdashPart1.aspx">part
I</a>, I talked about how I had a need for a way to managed suspended messages in
BizTalk using something other then the BizTalk Administration tool. Using a combination
of BizTalk dll’s I was able to query, read and suspend BizTalk messages. The need
for a “web” based tool is one of accessibility to our BizTalk server from remote machines
that are not directly connected to the DMZ zone that they reside in. I’ve also been
wanting to create a tech support tool for myself to manage other aspects of our hosted
solution, and this would fit in nicely with it.
</p>
        <p>
Being a glutton for punishment, I decided to sacrifice my weekend and go for the more
complex, but really cool sounding idea of a set of web services that interface with
SilverLight 2. I choose SilverLight as I’ve been wanting to get my hands dirty with
it for some time, and another member of the team was talking about doing the same,
and what’s a little friendly competition? While I had a grand vision of what my tool
would look like, which I will refer to as the Unified Administration Tool (UAT), I
knew I wouldn’t be able to code everything in one weekend. I had to set some realistic
goals and try to add only what was needed, while still allowing for future functionality
to be “plugged-in”. The good thing was, since this was pretty much just for me, I
didn’t have to worry about other peoples requirements ;) 
</p>
        <p>
The UAT is an n-tier application which will provide administrative functionality over
our hosted solution that is distributed among several servers in different DMZ zones
(as mentioned in Part I of the BizTalk Web Admin). In addition to dealing with the
distributed nature of our servers, the tool must also account for the various environments,
with one environment consisting of an instance of our solution deployed across one
or more servers. Perhaps to put this more simply is that I wanted to be able to perform
the same functions on our development, staging, demonstration and production environments.
</p>
        <p>
          <br />
I started out by created a new project folder to which all my various Visual Studio
projects will be added. I moved my BizTalkUtilities projects into the Components folder
as shown below, and then started adding the other components and UI projects as needed.
Below is an overview of how I have my solution folder setup, which will probably change
over time. The idea is that Components are reusable across all the UI and Services,
and will probably have some more domain specific wrappers. Controllers under UI will
be re-usable across each of the UI projects and provide an interface between the components
and the UI.
</p>
        <ul>
          <li>
UnifiedAdmin 
<ul><li>
_Solutions 
</li><li>
Components 
<ul><li>
BizTalkUtilities 
</li><li>
BizTalkUtilitiesTest</li></ul></li><li>
Documentation 
</li><li>
Scracth (Prototypes and other throw away code used for quick tests) 
<ul><li>
BizTalkMessageBrowser (Test win forms app for BizTalk Utilities)</li></ul></li><li>
Services 
</li><li>
UI 
<ul><li>
Controllers 
</li><li>
Silverlight 
</li><li>
SilverlightMobile (Future project) 
</li><li>
WPF (Future Project)</li></ul></li></ul></li>
        </ul>
        <p>
I decided that I will use the Entity Framework as my “ORM”, combined with Ado.Net
Data Services as my primary web services mechanism. Combined with Silverlight, I’ll
get to tackle three new technologies at once, and either learn allot, or give up,
ultimately frustrated, wishing I would have chosen a few older tried and true technologies.
Before we even get to the UI, I needed to start setting up my services and entity
model. I have a feeling I’ll be re-arranging some of these projects, but for now I
have a class library called Entities under Components, and a web project called UnifiedAdminService
under Services. 
</p>
        <p>
I really don’t know what the best practice way for organizing my entity models are,
and it seems like one entity model per project seems a bit of an over kill, however,
putting all the entities I will be working with in the same project doesn’t seem to
smell good either, as there defiantly a clear break between them. I started out with
an entity model for a database called Utilities, which will be the “glue” that holds
my Unified Admin tool together. It’s sort of a catch all database that currently contains
tables for some SQL based monitoring I have setup, as well as users (who can access
the UAT), and servers (what servers does the UAT work with). I created a new Ado.Net
Entity data model and had it auto generated the model from the database schema. This
was pretty easy and straight forward. I prefix all my table names in my schema with
various prefixes for grouping and identification, such as “mon_t” which means the
table is used for the monitoring functionality, and it’s a table. I don’t want these
prefixes in my code, so I am going to rename the entities in the model. To start with
I’m only renaming a couple until I see how the EM is updated and used throughout the
code. 
</p>
        <p>
Next I created a new Ado.Net data service in the web project. This created a new .svc
file with a code behind file that inherits from DataService&lt;T&gt;. I updated T
to reference my entity model (Entities.UtilityEntities) and also configured the security
to allow read access for entities. You do this by using the config.SetEntitySetAccessRule
method in InitializeService.  
</p>
        <pre class="csharpcode">
          <span class="kwrd">public</span>
          <span class="kwrd">class</span> TsiUtility
: DataService&lt;Entities.UtilityEntities&gt; { <span class="rem">// This method is
called only once to initialize service-wide policies.</span><span class="kwrd">public</span><span class="kwrd">static</span><span class="kwrd">void</span> InitializeService(IDataServiceConfiguration
config) { config.SetEntitySetAccessRule(<span class="str">"*"</span>, EntitySetRights.AllRead);
} }</pre>
        <style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
        <p>
Even thought the auto-generated comments for InitializeService make it sound like
it’s only called once in the life-cycle of an AppDomain, I wasn’t sure. This <a href="http://blogs.msdn.com/marcelolr/archive/2008/06/16/so-special-initializeservice-in-ado-net-data-services.aspx" target="_blank">post</a> talks
a little bit about the InitializeService method, and does in fact point out that the
InitalizeService method is only called once.
</p>
        <p>
I attempted to browse to my newly created service and was greeted with an un-informative
error, “The server encountered an error processing the request. See server logs for
more details.”. Since I’m running the development server that’s included with Visual
Studio, there are not much in the way of server logs (that I could find anyway). Jumping
into debug mode showed that the error was caused by an incorrectly configured connection
string. The connection string used my the Entity Framework is not your standard connection
string, so you need to make sure that you copy the connection string created for you
in your Entities project to your web.config in your web project (assuming your entity
model is in a separate project). I was trying to use the Server, Database, Trusted_Connection
syntax, and apparently that’s not OK.  Example connection string: 
</p>
        <blockquote>
          <p>
&lt;add name="TsiUtilityEntities" connectionString="metadata=res://*/TsiUtility.csdl|res://*/TsiUtility.ssdl|res://*/TsiUtility.msl;provider=System.Data.SqlClient;provider
connection string=&amp;quot;Data Source=Server;Initial Catalog=Utility;Integrated
Security=True;MultipleActiveResultSets=True&amp;quot;" providerName="System.Data.EntityClient"
/&gt; 
</p>
        </blockquote>
        <p>
Once I had the correct connection string, I was able to navigate my entity model using
just my browser. Of course I haven’t done any type of authentication, and I don’t
want to have just anybody browse to the URL for the UAT and start browsing, so it’s
time to add some security. Ado.Net data services makes use of existing security provides
as long as they set the HttpContext principle, so you can use HttpContext.Current.User.Identity.Name
and then compare that against records returned by the EM. Something that I didn’t
fully grasp at first, was that by the time Ado.Net Data Services “takes over” the
user should have been authenticated, so there really is no “login” event in Ado.Net
data services where you can set additional information. 
</p>
        <p>
For simplicity, I decided to use Integrated Authentication, and store additional information
after the user is authenticated. Since this is a regular asp.net application, you
can add a Global.asax, and add code to the <a href="http://msdn.microsoft.com/en-us/library/system.web.httpapplication.authenticaterequest.aspx" target="_blank">AuthenticateRequest</a> event
handler to perform additional security related code. When AuthenticateRequest is called,
whatever mechanism that is configured to handle authentication has finished, and there
should be a value in HttpContext.Current.User. What I did was user the Name property
to query my users table that was part of my entity model and cache the results in
a hash table, which itself is stored in the application context. If the user does
not exist in the database, I set the Current.User to null, and cache a null value
with the key of the user name that was authenticated. 
</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>
        </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>
        </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>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <pre class="csharpcode">
          <span class="kwrd">protected</span>
          <span class="kwrd">void</span> Application_AuthenticateRequest(<span class="kwrd">object</span> sender,
EventArgs e) { <span class="kwrd">string</span> userName = HttpContext.Current.User.Identity.Name; <span class="rem">//Get
a collection of cached users. If it doesn't exist create and cache it.</span> System.Collections.Generic.Dictionary&lt;<span class="kwrd">string</span>,
Entities.User&gt; users = (Dictionary&lt;<span class="kwrd">string</span>, Entities.User&gt;)HttpContext.Current.Cache[<span class="str">"Tsi_Users"</span>]; <span class="kwrd">if</span> (users
== <span class="kwrd">null</span>) { users = <span class="kwrd">new</span> Dictionary&lt;<span class="kwrd">string</span>,
Entities.User&gt;(); HttpContext.Current.Cache.Add(<span class="str">"Tsi_Users"</span>,
users, <span class="kwrd">null</span>, DateTime.Now.AddHours(1), System.Web.Caching.Cache.NoSlidingExpiration,
System.Web.Caching.CacheItemPriority.Normal, <span class="kwrd">null</span>); } Entities.User
user = <span class="kwrd">null</span>; <span class="rem">//Check to see if we have
a cached user for this username. Use ContainsKey as we will store</span><span class="rem">//a
null value to indicate a user is not authorized.</span><span class="kwrd">if</span> (users.ContainsKey(userName))
user = users[userName]; <span class="kwrd">else</span> { Entities.TsiUtilityEntities
entities = <span class="kwrd">new</span> Entities.TsiUtilityEntities(); user = entities.UserSet.FirstOrDefault(u
=&gt; u.WindowsUserName == userName &amp;&amp; u.IsEnabled == <span class="kwrd">true</span>);
user.ua_tx_UserServers.Load(); <span class="rem">//load servers this user has access
to.</span> } <span class="rem">//User doesn't exist in the database either, so un-authenticate
them</span><span class="rem">//allow to continue thru so we add a null object with
the username to cache</span><span class="kwrd">if</span> (user == <span class="kwrd">null</span> ||
HttpContext.Current.User.Identity.IsAuthenticated == <span class="kwrd">false</span>)
{ <span class="rem">//When this is set to null, this method should finish, but no
data will display. </span><span class="rem">//Seems like aspx pages will still display
though. However if you check the CurrentUser</span><span class="rem">//it will be
unathenticated.</span> user = <span class="kwrd">null</span>; HttpContext.Current.User
= <span class="kwrd">null</span>; } <span class="rem">//save to users collection.
Double check to make sure it wasn't added somewhere else.</span><span class="kwrd">if</span>(users.ContainsKey(userName)
== <span class="kwrd">false</span>) users.Add(userName, user); }</pre>
        <style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
        <p>
        </p>
        <p>
What I have not decided upon, nor have I done the research into, is if I should be
caching the DataContext in the application or session cache for the user.
</p>
        <p>
So where does this leave me? Well, I certainly didn’t get even close to what I wanted
to accomplish in one weekend, as I haven’t even touched SilverLight yet. I do have
some basic authentication, but that’s more using traditional asp.net then doing anything
special with Ado.Net data services. From the looks of it, I will have to add QueryInterceptors
to every entity I wish to do security on, which seems like a pain and allot of extra
un-necessary work. Next time I hope to accomplish the following:
</p>
        <ol>
          <li>
Research to find out if you should cache the data context</li>
          <li>
Write out security requirements and research the best way to implement in Ado.Net
Data Services</li>
          <li>
Figure how I am going to have one set of services that can connect to multiple databases
(assuming the database schemas are kept in sync). 
</li>
        </ol>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=18b84c58-4b38-4310-afe1-ac74f66d1937" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>BizTalk Web Admin &amp;ndash; Part II &amp;ndash; Now Unified Admin Tool</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,18b84c58-4b38-4310-afe1-ac74f66d1937.aspx</guid>
      <link>http://blog.salvoz.com/2008/12/08/BizTalkWebAdminNdashPartIINdashNowUnifiedAdminTool.aspx</link>
      <pubDate>Mon, 08 Dec 2008 03:09:26 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
In &lt;a href="http://blog.salvoz.com/2008/12/05/BizTalkWebAdminNdashPart1.aspx"&gt;part
I&lt;/a&gt;, I talked about how I had a need for a way to managed suspended messages in
BizTalk using something other then the BizTalk Administration tool. Using a combination
of BizTalk dll’s I was able to query, read and suspend BizTalk messages. The need
for a “web” based tool is one of accessibility to our BizTalk server from remote machines
that are not directly connected to the DMZ zone that they reside in. I’ve also been
wanting to create a tech support tool for myself to manage other aspects of our hosted
solution, and this would fit in nicely with it.
&lt;/p&gt;
&lt;p&gt;
Being a glutton for punishment, I decided to sacrifice my weekend and go for the more
complex, but really cool sounding idea of a set of web services that interface with
SilverLight 2. I choose SilverLight as I’ve been wanting to get my hands dirty with
it for some time, and another member of the team was talking about doing the same,
and what’s a little friendly competition? While I had a grand vision of what my tool
would look like, which I will refer to as the Unified Administration Tool (UAT), I
knew I wouldn’t be able to code everything in one weekend. I had to set some realistic
goals and try to add only what was needed, while still allowing for future functionality
to be “plugged-in”. The good thing was, since this was pretty much just for me, I
didn’t have to worry about other peoples requirements ;) 
&lt;/p&gt;
&lt;p&gt;
The UAT is an n-tier application which will provide administrative functionality over
our hosted solution that is distributed among several servers in different DMZ zones
(as mentioned in Part I of the BizTalk Web Admin). In addition to dealing with the
distributed nature of our servers, the tool must also account for the various environments,
with one environment consisting of an instance of our solution deployed across one
or more servers. Perhaps to put this more simply is that I wanted to be able to perform
the same functions on our development, staging, demonstration and production environments.
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
I started out by created a new project folder to which all my various Visual Studio
projects will be added. I moved my BizTalkUtilities projects into the Components folder
as shown below, and then started adding the other components and UI projects as needed.
Below is an overview of how I have my solution folder setup, which will probably change
over time. The idea is that Components are reusable across all the UI and Services,
and will probably have some more domain specific wrappers. Controllers under UI will
be re-usable across each of the UI projects and provide an interface between the components
and the UI.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
UnifiedAdmin 
&lt;ul&gt;
&lt;li&gt;
_Solutions 
&lt;li&gt;
Components 
&lt;ul&gt;
&lt;li&gt;
BizTalkUtilities 
&lt;li&gt;
BizTalkUtilitiesTest&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Documentation 
&lt;li&gt;
Scracth (Prototypes and other throw away code used for quick tests) 
&lt;ul&gt;
&lt;li&gt;
BizTalkMessageBrowser (Test win forms app for BizTalk Utilities)&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Services 
&lt;li&gt;
UI 
&lt;ul&gt;
&lt;li&gt;
Controllers 
&lt;li&gt;
Silverlight 
&lt;li&gt;
SilverlightMobile (Future project) 
&lt;li&gt;
WPF (Future Project)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I decided that I will use the Entity Framework as my “ORM”, combined with Ado.Net
Data Services as my primary web services mechanism. Combined with Silverlight, I’ll
get to tackle three new technologies at once, and either learn allot, or give up,
ultimately frustrated, wishing I would have chosen a few older tried and true technologies.
Before we even get to the UI, I needed to start setting up my services and entity
model. I have a feeling I’ll be re-arranging some of these projects, but for now I
have a class library called Entities under Components, and a web project called UnifiedAdminService
under Services. 
&lt;/p&gt;
&lt;p&gt;
I really don’t know what the best practice way for organizing my entity models are,
and it seems like one entity model per project seems a bit of an over kill, however,
putting all the entities I will be working with in the same project doesn’t seem to
smell good either, as there defiantly a clear break between them. I started out with
an entity model for a database called Utilities, which will be the “glue” that holds
my Unified Admin tool together. It’s sort of a catch all database that currently contains
tables for some SQL based monitoring I have setup, as well as users (who can access
the UAT), and servers (what servers does the UAT work with). I created a new Ado.Net
Entity data model and had it auto generated the model from the database schema. This
was pretty easy and straight forward. I prefix all my table names in my schema with
various prefixes for grouping and identification, such as “mon_t” which means the
table is used for the monitoring functionality, and it’s a table. I don’t want these
prefixes in my code, so I am going to rename the entities in the model. To start with
I’m only renaming a couple until I see how the EM is updated and used throughout the
code. 
&lt;/p&gt;
&lt;p&gt;
Next I created a new Ado.Net data service in the web project. This created a new .svc
file with a code behind file that inherits from DataService&amp;lt;T&amp;gt;. I updated T
to reference my entity model (Entities.UtilityEntities) and also configured the security
to allow read access for entities. You do this by using the config.SetEntitySetAccessRule
method in InitializeService.&amp;nbsp; 
&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; TsiUtility
: DataService&amp;lt;Entities.UtilityEntities&amp;gt; { &lt;span class="rem"&gt;// This method is
called only once to initialize service-wide policies.&lt;/span&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; InitializeService(IDataServiceConfiguration
config) { config.SetEntitySetAccessRule(&lt;span class="str"&gt;"*"&lt;/span&gt;, EntitySetRights.AllRead);
} }&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;p&gt;
Even thought the auto-generated comments for InitializeService make it sound like
it’s only called once in the life-cycle of an AppDomain, I wasn’t sure. This &lt;a href="http://blogs.msdn.com/marcelolr/archive/2008/06/16/so-special-initializeservice-in-ado-net-data-services.aspx" target="_blank"&gt;post&lt;/a&gt; talks
a little bit about the InitializeService method, and does in fact point out that the
InitalizeService method is only called once.
&lt;/p&gt;
&lt;p&gt;
I attempted to browse to my newly created service and was greeted with an un-informative
error, “The server encountered an error processing the request. See server logs for
more details.”. Since I’m running the development server that’s included with Visual
Studio, there are not much in the way of server logs (that I could find anyway). Jumping
into debug mode showed that the error was caused by an incorrectly configured connection
string. The connection string used my the Entity Framework is not your standard connection
string, so you need to make sure that you copy the connection string created for you
in your Entities project to your web.config in your web project (assuming your entity
model is in a separate project). I was trying to use the Server, Database, Trusted_Connection
syntax, and apparently that’s not OK.&amp;nbsp; Example connection string: 
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&amp;lt;add name="TsiUtilityEntities" connectionString="metadata=res://*/TsiUtility.csdl|res://*/TsiUtility.ssdl|res://*/TsiUtility.msl;provider=System.Data.SqlClient;provider
connection string=&amp;amp;quot;Data Source=Server;Initial Catalog=Utility;Integrated
Security=True;MultipleActiveResultSets=True&amp;amp;quot;" providerName="System.Data.EntityClient"
/&amp;gt; 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Once I had the correct connection string, I was able to navigate my entity model using
just my browser. Of course I haven’t done any type of authentication, and I don’t
want to have just anybody browse to the URL for the UAT and start browsing, so it’s
time to add some security. Ado.Net data services makes use of existing security provides
as long as they set the HttpContext principle, so you can use HttpContext.Current.User.Identity.Name
and then compare that against records returned by the EM. Something that I didn’t
fully grasp at first, was that by the time Ado.Net Data Services “takes over” the
user should have been authenticated, so there really is no “login” event in Ado.Net
data services where you can set additional information. 
&lt;/p&gt;
&lt;p&gt;
For simplicity, I decided to use Integrated Authentication, and store additional information
after the user is authenticated. Since this is a regular asp.net application, you
can add a Global.asax, and add code to the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.httpapplication.authenticaterequest.aspx" target="_blank"&gt;AuthenticateRequest&lt;/a&gt; event
handler to perform additional security related code. When AuthenticateRequest is called,
whatever mechanism that is configured to handle authentication has finished, and there
should be a value in HttpContext.Current.User. What I did was user the Name property
to query my users table that was part of my entity model and cache the results in
a hash table, which itself is stored in the application context. If the user does
not exist in the database, I set the Current.User to null, and cache a null value
with the key of the user name that was authenticated. 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Application_AuthenticateRequest(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender,
EventArgs e) { &lt;span class="kwrd"&gt;string&lt;/span&gt; userName = HttpContext.Current.User.Identity.Name; &lt;span class="rem"&gt;//Get
a collection of cached users. If it doesn't exist create and cache it.&lt;/span&gt; System.Collections.Generic.Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;,
Entities.User&amp;gt; users = (Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, Entities.User&amp;gt;)HttpContext.Current.Cache[&lt;span class="str"&gt;"Tsi_Users"&lt;/span&gt;]; &lt;span class="kwrd"&gt;if&lt;/span&gt; (users
== &lt;span class="kwrd"&gt;null&lt;/span&gt;) { users = &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;,
Entities.User&amp;gt;(); HttpContext.Current.Cache.Add(&lt;span class="str"&gt;"Tsi_Users"&lt;/span&gt;,
users, &lt;span class="kwrd"&gt;null&lt;/span&gt;, DateTime.Now.AddHours(1), System.Web.Caching.Cache.NoSlidingExpiration,
System.Web.Caching.CacheItemPriority.Normal, &lt;span class="kwrd"&gt;null&lt;/span&gt;); } Entities.User
user = &lt;span class="kwrd"&gt;null&lt;/span&gt;; &lt;span class="rem"&gt;//Check to see if we have
a cached user for this username. Use ContainsKey as we will store&lt;/span&gt; &lt;span class="rem"&gt;//a
null value to indicate a user is not authorized.&lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (users.ContainsKey(userName))
user = users[userName]; &lt;span class="kwrd"&gt;else&lt;/span&gt; { Entities.TsiUtilityEntities
entities = &lt;span class="kwrd"&gt;new&lt;/span&gt; Entities.TsiUtilityEntities(); user = entities.UserSet.FirstOrDefault(u
=&amp;gt; u.WindowsUserName == userName &amp;amp;&amp;amp; u.IsEnabled == &lt;span class="kwrd"&gt;true&lt;/span&gt;);
user.ua_tx_UserServers.Load(); &lt;span class="rem"&gt;//load servers this user has access
to.&lt;/span&gt; } &lt;span class="rem"&gt;//User doesn't exist in the database either, so un-authenticate
them&lt;/span&gt; &lt;span class="rem"&gt;//allow to continue thru so we add a null object with
the username to cache&lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (user == &lt;span class="kwrd"&gt;null&lt;/span&gt; ||
HttpContext.Current.User.Identity.IsAuthenticated == &lt;span class="kwrd"&gt;false&lt;/span&gt;)
{ &lt;span class="rem"&gt;//When this is set to null, this method should finish, but no
data will display. &lt;/span&gt; &lt;span class="rem"&gt;//Seems like aspx pages will still display
though. However if you check the CurrentUser&lt;/span&gt; &lt;span class="rem"&gt;//it will be
unathenticated.&lt;/span&gt; user = &lt;span class="kwrd"&gt;null&lt;/span&gt;; HttpContext.Current.User
= &lt;span class="kwrd"&gt;null&lt;/span&gt;; } &lt;span class="rem"&gt;//save to users collection.
Double check to make sure it wasn't added somewhere else.&lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt;(users.ContainsKey(userName)
== &lt;span class="kwrd"&gt;false&lt;/span&gt;) users.Add(userName, user); }&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
What I have not decided upon, nor have I done the research into, is if I should be
caching the DataContext in the application or session cache for the user.
&lt;/p&gt;
&lt;p&gt;
So where does this leave me? Well, I certainly didn’t get even close to what I wanted
to accomplish in one weekend, as I haven’t even touched SilverLight yet. I do have
some basic authentication, but that’s more using traditional asp.net then doing anything
special with Ado.Net data services. From the looks of it, I will have to add QueryInterceptors
to every entity I wish to do security on, which seems like a pain and allot of extra
un-necessary work. Next time I hope to accomplish the following:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Research to find out if you should cache the data context&lt;/li&gt;
&lt;li&gt;
Write out security requirements and research the best way to implement in Ado.Net
Data Services&lt;/li&gt;
&lt;li&gt;
Figure how I am going to have one set of services that can connect to multiple databases
(assuming the database schemas are kept in sync). 
&lt;/li&gt;
&lt;/ol&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=18b84c58-4b38-4310-afe1-ac74f66d1937" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,18b84c58-4b38-4310-afe1-ac74f66d1937.aspx</comments>
      <category>Technology/BizTalk</category>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=13f48d97-cdec-4bb7-bbc1-188ef38f66a8</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,13f48d97-cdec-4bb7-bbc1-188ef38f66a8.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,13f48d97-cdec-4bb7-bbc1-188ef38f66a8.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=13f48d97-cdec-4bb7-bbc1-188ef38f66a8</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Scott just <a href="http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx">blogged
about T4</a>, the Text Template Transformation Toolkit. It’s a full blown template
driven code generation tool that uses the same syntax as Asp.Net. It’s lacking things
such as syntax highlighting and intellisense, but it’s free, and part of Visual Studio. 
</p>
        <p>
I feel with the recent press this tool is getting, it will become even more popular,
and some of the missing features added by the community. Scott has a whole list of
links on his post that provide good samples, as well as a link to a company that provides
a free and pay version of a plug-in to add some of the “missing” functionality. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=13f48d97-cdec-4bb7-bbc1-188ef38f66a8" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Code Generation in Visual Studio</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,13f48d97-cdec-4bb7-bbc1-188ef38f66a8.aspx</guid>
      <link>http://blog.salvoz.com/2008/10/14/CodeGenerationInVisualStudio.aspx</link>
      <pubDate>Tue, 14 Oct 2008 20:33:04 GMT</pubDate>
      <description>&lt;p&gt;
Scott just &lt;a href="http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx"&gt;blogged
about T4&lt;/a&gt;, the Text Template Transformation Toolkit. It’s a full blown template
driven code generation tool that uses the same syntax as Asp.Net. It’s lacking things
such as syntax highlighting and intellisense, but it’s free, and part of Visual Studio. 
&lt;/p&gt;
&lt;p&gt;
I feel with the recent press this tool is getting, it will become even more popular,
and some of the missing features added by the community. Scott has a whole list of
links on his post that provide good samples, as well as a link to a company that provides
a free and pay version of a plug-in to add some of the “missing” functionality. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=13f48d97-cdec-4bb7-bbc1-188ef38f66a8" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,13f48d97-cdec-4bb7-bbc1-188ef38f66a8.aspx</comments>
      <category>Technology/Programming</category>
      <category>Technology/Review For Future Projects</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=d00a2e5c-9b9e-498a-96ce-0ad86246d6e5</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,d00a2e5c-9b9e-498a-96ce-0ad86246d6e5.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,d00a2e5c-9b9e-498a-96ce-0ad86246d6e5.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d00a2e5c-9b9e-498a-96ce-0ad86246d6e5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
Rob Conery, creator of SubSonic, and the ASP.Net MVC Store Front video series has
released an early prototype of a Visual Studio 2008 add-in called the SubSonic MVC
Scaffold Addin. Let me point out right away that there is no dependency on SubSonic
itself, rather this add-in uses Linq2Sql, although Rob says a SubSonic plug-in is
on the drawing board.
</p>
        <p>
Not to rehash his <a href="http://blog.wekeroad.com/blog/subsonic-mvc-scaffold-addin/">announcement</a>,
but basically this add-in takes a Linq2Sql class, and generates some views (view,
edit, list), and a controller based on the class. This is meant as a quick start kind
of thing, not a full fledged commercial web site generator. 
</p>
        <p>
        </p>
        <p>
I encourage you to visit his blog post and watch the video he has prepared, it does
an excellent job of showing you what the Scaffold does. Here are some of my take-away's:
</p>
        <ul>
          <li>
Uses pre-existing Linq2Sql generated classes 
</li>
          <li>
Creates wrapper objects around Linq2Sql classes</li>
          <li>
Creates MVC views (you can create your own template to use in this process)</li>
          <li>
Creates MVC controller</li>
          <li>
If you re-run the scaffold on a class you previously generated, no files are updated
(overwritten). You can delete individual files, and scaffold will generate them again. 
</li>
          <li>
Not everything works perfectly, you will/may need to go in and change some code. This
is to get you started with something quickly. 
</li>
          <li>
RESTful style URL 
</li>
        </ul>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=d00a2e5c-9b9e-498a-96ce-0ad86246d6e5" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>SubSonic MVC Scaffold Addin</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,d00a2e5c-9b9e-498a-96ce-0ad86246d6e5.aspx</guid>
      <link>http://blog.salvoz.com/2008/10/07/SubSonicMVCScaffoldAddin.aspx</link>
      <pubDate>Tue, 07 Oct 2008 21:37:11 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Rob Conery, creator of SubSonic, and the ASP.Net MVC Store Front video series has
released an early prototype of a Visual Studio 2008 add-in called the SubSonic MVC
Scaffold Addin. Let me point out right away that there is no dependency on SubSonic
itself, rather this add-in uses Linq2Sql, although Rob says a SubSonic plug-in is
on the drawing board.
&lt;/p&gt;
&lt;p&gt;
Not to rehash his &lt;a href="http://blog.wekeroad.com/blog/subsonic-mvc-scaffold-addin/"&gt;announcement&lt;/a&gt;,
but basically this add-in takes a Linq2Sql class, and generates some views (view,
edit, list), and a controller based on the class. This is meant as a quick start kind
of thing, not a full fledged commercial web site generator. 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
I encourage you to visit his blog post and watch the video he has prepared, it does
an excellent job of showing you what the Scaffold does. Here are some of my take-away's:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Uses pre-existing Linq2Sql generated classes 
&lt;/li&gt;
&lt;li&gt;
Creates wrapper objects around Linq2Sql classes&lt;/li&gt;
&lt;li&gt;
Creates MVC views (you can create your own template to use in this process)&lt;/li&gt;
&lt;li&gt;
Creates MVC controller&lt;/li&gt;
&lt;li&gt;
If you re-run the scaffold on a class you previously generated, no files are updated
(overwritten). You can delete individual files, and scaffold will generate them again. 
&lt;/li&gt;
&lt;li&gt;
Not everything works perfectly, you will/may need to go in and change some code. This
is to get you started with something quickly. 
&lt;/li&gt;
&lt;li&gt;
RESTful style URL 
&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=d00a2e5c-9b9e-498a-96ce-0ad86246d6e5" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,d00a2e5c-9b9e-498a-96ce-0ad86246d6e5.aspx</comments>
      <category>Technology/Programming</category>
      <category>Technology/Review For Future Projects</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=94b0ef79-8b69-414e-a82e-70a25a9fcb1e</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,94b0ef79-8b69-414e-a82e-70a25a9fcb1e.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,94b0ef79-8b69-414e-a82e-70a25a9fcb1e.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=94b0ef79-8b69-414e-a82e-70a25a9fcb1e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’ve been looking at a couple of the new technologies that were released with .Net
3.5 SP1, mainly the Entity Framework (EF), and ADO.Net Data Services ADNS). I happen
to look at ADO.Net Data Services first, and it seemed to look pretty good on paper.
There was a reference to the Entity Framework in that Data Services uses the Entity
Model (EM) from EF to provide the data access layer.
</p>
        <p>
Last night I started searching for more information on the Entity Framework, and instead
of finding examples, best practices, etc, I found a battle waging between the Creators/Supports
of the Entity Framework and people practicing what I have come to know as Alt.Net. 
</p>
        <p>
I am using the term Alt.Net to refer to ideas and concepts such as Domain Driven Design
(DDD), Test Driven Development (TDD), Agile, Plain Old CLR Objects (POCO), Persistence
Ignorance (PI), and nHibernate (as there is allot of comparison made to the EF). I
should also note that the ideas and concepts listed are not entirely specific to .Net,
nor is this a complete list. Furthermore, you could be a practitioner of Alt.Net and
completely support EF.
</p>
        <p>
To get an idea of where the Alt.Net crowd is coming from you should start off by reading
the <a href="http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/">Vote
of No Confidence</a> on WuFoo. Then simply Google for Entity Framework and you will
see all sorts of competing opinions. F<a href="http://weblogs.asp.net/fbouma/">rans
Bouma</a>, creator of LLBLGen Pro, has a couple of posts (<a href="http://weblogs.asp.net/fbouma/archive/2008/08/20/quot-the-entity-data-model-is-much-bigger-than-just-an-orm-quot-stephen-forte.aspx">here</a>,
and <a href="http://weblogs.asp.net/fbouma/archive/2008/05/19/why-use-the-entity-framework-yeah-why-exactly.aspx">here</a>)
that I think show he is against the EF, but for slightly difference reasons then the
Alt.Net crowd. Here are some of the top Pros and Cons I’ve found.
</p>
        <p>
Pros:
</p>
        <ol>
          <li>
It’s support by Microsoft, and as such, will gather much momentum and community support</li>
          <li>
It’s good enough for X% (usually stated as greater then 50%) of software projects
out there.</li>
          <li>
GUI editor/mapper makes it easier to use then other ORM tools like nHibernate</li>
          <li>
EF is part of a larger push by Microsoft to provide technologies that focus on an
Entity Model (See Ado.Net Data Services)</li>
        </ol>
        <p>
Cons:
</p>
        <ol>
          <li>
No support for POCO’s and Persistent Ignorance</li>
          <li>
Hard (or impossible) to develop using a Domain Driven Design, or Test Driven Design
methodology</li>
          <li>
Single model/mapping file introduces merge conflicts in a source control environment</li>
          <li>
No additional functionality of products like nHibernate</li>
        </ol>
        <p>
I kind of see Pro #1 being the cornerstone to the argument. I feel that the Alt.Net
crowd knows that EF has a good chance to become the defacto standard, and that they
will be forced by their clients and employers to use it. As such, they are trying
to point out some of it’s short comings to Microsoft in hopes that if it does become
the defacto standard, that it won’t suck (to them) as much.
</p>
        <p>
The EF team has been very open with the community, and reading posts leading up to
the release of the EF, you can already see that the team was listening to the community.
They introduced something called IPOCO, which removed the requirement that Entity
classes implement a base class, and instead implement interfaces. This pleased some,
while it annoyed others, since it still breaks true Persistent Ignorance.  I
feel it’s a step in the right direction.
</p>
        <p>
There are other indications that V2 of the EF will introduce true Persistant Ignorance,
although the EF team usually talks about a performance hit (and it sounds like it
could be a big performance hit) if you want to go the POCO route. The reason for this
is the lack of the EntityKey field in a POCO object, which is used in subsequent operations
after an entity is retrieved from the framework.
</p>
        <p>
Overall, I find myself smack dab in the middle of the two camps. I’ve been trying
to explore and learn more about Alt.Net, while at the same time keeping up on the
latest from Microsoft. I’ve come up with the following guidelines for myself.
</p>
        <ol>
          <li>
Since EF is not support in Compact Framework, and I need to write business entities
for the Compact Framework, or one’s that can be used in both the Full and Compact
Frameworks, EF is out (so is nHibernate for that matter). 
</li>
          <li>
If I need to work on a new back end application that is going to be using SQL server
exclusively (there is support for other data stores in EF), then EF might not be a
bad way to go. 
</li>
          <li>
If I need to work on an existing back end application, I don’t think it’s worth the
time to switch to EF yet, as it’s still a V1 product. 
</li>
        </ol>
        <p>
In the near term, I see my self doing some CF programming, as well as some one-off
programming against our backend, which gives me a nice blend I guess. I’ll get to
play around with EF some, and keep exploring the ideas of Alt.Net.
</p>
        <p>
One final item I’d like to point out is the <a href="http://www.codeplex.com/efcontrib">Entity
Framework Contrib Project</a> on CodePlex. While it hasn’t had a release since before
RTM of the EF, it does provide some very interesting additions to the EF. The one
that interests me the most, might just in fact be the bridge between the EF and POCO
that everyone is looking for. Using <a href="http://www.postsharp.org">PostSharp</a>,
the IPOCO interfaces are implemented at compile time, thus keeping your entities persistent
Ignorant. The trade off is that you have to add some attributes to your code, but
at least you could add these conditionally, which would help with the CF/FF issues
I have. 
</p>
        <p>
Unfortunately the main contributor has taken a job and Microsoft on the SilverLight
team, and in response to the EF’s team to add POCO support, has lost some of his interest
in the project. I really like the post compile time option that the contrib project
uses, as it seems to address the performance hit that the EF team says their POCO
solution will have.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=94b0ef79-8b69-414e-a82e-70a25a9fcb1e" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Holy War - .Net Entity Framework</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,94b0ef79-8b69-414e-a82e-70a25a9fcb1e.aspx</guid>
      <link>http://blog.salvoz.com/2008/08/23/HolyWarNetEntityFramework.aspx</link>
      <pubDate>Sat, 23 Aug 2008 19:51:13 GMT</pubDate>
      <description>&lt;p&gt;
I’ve been looking at a couple of the new technologies that were released with .Net
3.5 SP1, mainly the Entity Framework (EF), and ADO.Net Data Services ADNS). I happen
to look at ADO.Net Data Services first, and it seemed to look pretty good on paper.
There was a reference to the Entity Framework in that Data Services uses the Entity
Model (EM) from EF to provide the data access layer.
&lt;/p&gt;
&lt;p&gt;
Last night I started searching for more information on the Entity Framework, and instead
of finding examples, best practices, etc, I found a battle waging between the Creators/Supports
of the Entity Framework and people practicing what I have come to know as Alt.Net. 
&lt;/p&gt;
&lt;p&gt;
I am using the term Alt.Net to refer to ideas and concepts such as Domain Driven Design
(DDD), Test Driven Development (TDD), Agile, Plain Old CLR Objects (POCO), Persistence
Ignorance (PI), and nHibernate (as there is allot of comparison made to the EF). I
should also note that the ideas and concepts listed are not entirely specific to .Net,
nor is this a complete list. Furthermore, you could be a practitioner of Alt.Net and
completely support EF.
&lt;/p&gt;
&lt;p&gt;
To get an idea of where the Alt.Net crowd is coming from you should start off by reading
the &lt;a href="http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/"&gt;Vote
of No Confidence&lt;/a&gt; on WuFoo. Then simply Google for Entity Framework and you will
see all sorts of competing opinions. F&lt;a href="http://weblogs.asp.net/fbouma/"&gt;rans
Bouma&lt;/a&gt;, creator of LLBLGen Pro, has a couple of posts (&lt;a href="http://weblogs.asp.net/fbouma/archive/2008/08/20/quot-the-entity-data-model-is-much-bigger-than-just-an-orm-quot-stephen-forte.aspx"&gt;here&lt;/a&gt;,
and &lt;a href="http://weblogs.asp.net/fbouma/archive/2008/05/19/why-use-the-entity-framework-yeah-why-exactly.aspx"&gt;here&lt;/a&gt;)
that I think show he is against the EF, but for slightly difference reasons then the
Alt.Net crowd. Here are some of the top Pros and Cons I’ve found.
&lt;/p&gt;
&lt;p&gt;
Pros:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
It’s support by Microsoft, and as such, will gather much momentum and community support&lt;/li&gt;
&lt;li&gt;
It’s good enough for X% (usually stated as greater then 50%) of software projects
out there.&lt;/li&gt;
&lt;li&gt;
GUI editor/mapper makes it easier to use then other ORM tools like nHibernate&lt;/li&gt;
&lt;li&gt;
EF is part of a larger push by Microsoft to provide technologies that focus on an
Entity Model (See Ado.Net Data Services)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Cons:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
No support for POCO’s and Persistent Ignorance&lt;/li&gt;
&lt;li&gt;
Hard (or impossible) to develop using a Domain Driven Design, or Test Driven Design
methodology&lt;/li&gt;
&lt;li&gt;
Single model/mapping file introduces merge conflicts in a source control environment&lt;/li&gt;
&lt;li&gt;
No additional functionality of products like nHibernate&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
I kind of see Pro #1 being the cornerstone to the argument. I feel that the Alt.Net
crowd knows that EF has a good chance to become the defacto standard, and that they
will be forced by their clients and employers to use it. As such, they are trying
to point out some of it’s short comings to Microsoft in hopes that if it does become
the defacto standard, that it won’t suck (to them) as much.
&lt;/p&gt;
&lt;p&gt;
The EF team has been very open with the community, and reading posts leading up to
the release of the EF, you can already see that the team was listening to the community.
They introduced something called IPOCO, which removed the requirement that Entity
classes implement a base class, and instead implement interfaces. This pleased some,
while it annoyed others, since it still breaks true Persistent Ignorance.&amp;nbsp; I
feel it’s a step in the right direction.
&lt;/p&gt;
&lt;p&gt;
There are other indications that V2 of the EF will introduce true Persistant Ignorance,
although the EF team usually talks about a performance hit (and it sounds like it
could be a big performance hit) if you want to go the POCO route. The reason for this
is the lack of the EntityKey field in a POCO object, which is used in subsequent operations
after an entity is retrieved from the framework.
&lt;/p&gt;
&lt;p&gt;
Overall, I find myself smack dab in the middle of the two camps. I’ve been trying
to explore and learn more about Alt.Net, while at the same time keeping up on the
latest from Microsoft. I’ve come up with the following guidelines for myself.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Since EF is not support in Compact Framework, and I need to write business entities
for the Compact Framework, or one’s that can be used in both the Full and Compact
Frameworks, EF is out (so is nHibernate for that matter). 
&lt;/li&gt;
&lt;li&gt;
If I need to work on a new back end application that is going to be using SQL server
exclusively (there is support for other data stores in EF), then EF might not be a
bad way to go. 
&lt;/li&gt;
&lt;li&gt;
If I need to work on an existing back end application, I don’t think it’s worth the
time to switch to EF yet, as it’s still a V1 product. 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
In the near term, I see my self doing some CF programming, as well as some one-off
programming against our backend, which gives me a nice blend I guess. I’ll get to
play around with EF some, and keep exploring the ideas of Alt.Net.
&lt;/p&gt;
&lt;p&gt;
One final item I’d like to point out is the &lt;a href="http://www.codeplex.com/efcontrib"&gt;Entity
Framework Contrib Project&lt;/a&gt; on CodePlex. While it hasn’t had a release since before
RTM of the EF, it does provide some very interesting additions to the EF. The one
that interests me the most, might just in fact be the bridge between the EF and POCO
that everyone is looking for. Using &lt;a href="http://www.postsharp.org"&gt;PostSharp&lt;/a&gt;,
the IPOCO interfaces are implemented at compile time, thus keeping your entities persistent
Ignorant. The trade off is that you have to add some attributes to your code, but
at least you could add these conditionally, which would help with the CF/FF issues
I have. 
&lt;/p&gt;
&lt;p&gt;
Unfortunately the main contributor has taken a job and Microsoft on the SilverLight
team, and in response to the EF’s team to add POCO support, has lost some of his interest
in the project. I really like the post compile time option that the contrib project
uses, as it seems to address the performance hit that the EF team says their POCO
solution will have.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=94b0ef79-8b69-414e-a82e-70a25a9fcb1e" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,94b0ef79-8b69-414e-a82e-70a25a9fcb1e.aspx</comments>
      <category>Technology/Programming</category>
      <category>Technology/Review For Future Projects</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=89e7ce6c-e260-417b-8c7f-1406725b6702</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,89e7ce6c-e260-417b-8c7f-1406725b6702.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,89e7ce6c-e260-417b-8c7f-1406725b6702.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=89e7ce6c-e260-417b-8c7f-1406725b6702</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
With the release of all Visual Studio 2008, TFS 2008, and SQL 2008, I set about upgrading
I set about upgrading my main development laptop. Currently I have VS 2008, Team Explorer
2008 and SQL 2005 client tools installed. I opted to download the full installer for
the SP1 updates as opposed to the bootstrapper options.
</p>
        <ul>
          <li>
            <a title=".NET Framework 3.5 Service Pack 1 (Full Package)" href="http://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe">.NET
Framework 3.5 Service Pack 1 (Full Package)</a>
          </li>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?familyid=27673C47-B3B5-4C67-BD99-84E525B5CE61&amp;displaylang=en">Visual
Studio 2008 SP1 (Full Package ISO)</a> - <a href="http://support.microsoft.com/kb/945140">Change
List</a>  
</li>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=9e40a5b6-da41-43a2-a06d-3cee196bfe3d&amp;DisplayLang=en">TFS
2008 SP1 (Full Installer)</a>
          </li>
        </ul>
        <p>
I knew I needed to install VS 2008 SP1 prior to TFS 2008 SP1, but for some reason
decided to go with the SQL upgrade first. As I mentioned before, I currently only
have the client tools installed, as I like to keep my SQL servers on virtualized development
servers. 
</p>
        <p>
The SQL 2008 installer starts off by checking for .Net 3.5 SP1, and if it does not
exist, it will install it on your machine, along with a hotfix for windows installer.
After this is complete, you are required to reboot your machine. I opted for the upgrade
option, hoping that everything just works. I’m not sure if you can do a side by side
install with SQL 2005 client tools and 2008. 
</p>
        <p>
After selecting my options, an upgrade check is preformed, and it failed because I
have not installed VS 2008 SP1 yet. OK, I wanted to install that anyway, so I canceled
out and launched the VS 2008 SP1 installer. As with most service packs for Visual
Studio it takes awhile to apply, but my experience was more positive then the service
packs for VS 2005. No reboot was required, so I moved onto the TFS 2008 SP1 install.
</p>
        <p>
So I must have mis-understood or did not read something with the TFS 2008 SP1 installer.
It looks like it’s for the server components only, and VS 2008 SP1 handles upgrades
to Team Explorer as well. This <a href="http://www.woodwardweb.com/tfs/000444.html">blog
post</a> makes reference to this, and even says that if you are installing Team Explorer
on your TFS server, to install VS 2008 SP1. Looking at Help/About Microsoft Visual
Studio, I see the version number for VS 2008 is now 9.0.30729.1 SP, and looking at
the details for Team Explorer shows the same version number.
</p>
        <p>
Jumping back to the SQL 2008 installer, I proceeding with my update. However it wasn’t
really an update as much as it was a side by side install. Remember, I was just doing
the client tools, had I had the database components installed, I assume that those
would have been upgraded. I have a couple of SQL 2005 instances I can try an upgrade
on to see what happens. The install went very smoothly and there were no issues.
</p>
        <p>
First impressions of the new SQL Management studio are extremely positive. I saw the
intelli-sense demo at the launch event, but can’t really test it as I already have
SQL Prompt installed. My job as a Pseudo-DBA just got easier.Here are some new features
I found. 
</p>
        <ul>
          <li>
When running queries, you can view the results in traditional grid view, but also
as text (with options to choose your column delimiters), or export to a text (.rpt)
file. 
</li>
          <li>
The new activity monitor actually provides useful information (well alot more information
then the old one ever did). It reminds me of the task manager in Windows Server 2008.
The new activity monitor does not work with SQL 2000, but I will be eliminating all
SQL 2000 boxes by the end of September. As 4 line graphs across the top you get %
Processor time, Waiting Tasks, Database I/O and Batch Requests/Sec. On the bottom
you get 4 collapsible lists: Processes, Resource Waits, Data File I/O and Recent Expensive
Queries. 
</li>
          <li>
The database publishing wizard from Visual Studio is now included. Actually there
are a lot more options to control how your scripts are generated. 
</li>
          <li>
There are some very nice default reports built in now as well. The reports were an
add-on for SQL 2005, but they are now included (and you can of course write your own).
Stuff like Disk Usage, Index Usage, etc. I hope I can find a way to schedule these
to be emailed. 
</li>
          <li>
New option to generate Create and Drop Script (along with the original separate options
of generate create and generate drop). There is also an option to generate as SQL
Agent job.</li>
        </ul>
        <p>
Finally I went ahead and upgraded our TFS server to SP1. First thing I did was install
this month’s Windows Updates, as I was going to have to reboot anyway. Next up was
Visual Studio 2008 SP1, as I have VS and Team Explorer installed. Unfortunately I
was out of room on my system drive so I had to take the extra step of expanding my
virtual hard disk first. 
</p>
        <p>
I rebooted the server, and then proceeded to install TFS 2008 SP1. It looked like
everything was going good, but it failed at some point. Turns out the SQL server did
not survive the reboot, VS 2008 SP1, or the system drive expansion. Somehow my mssqlsystemresource.ldf
file got messed up at some point. The event log error stated “One or more files do
not match the primary file of the database.”. I got better information out of the
SQL error log which pointed me right to the System Resource ldf. I copied the ldf
file from another SQL 2005 server and was back in business. The TFS update proceeded
without incident after that. In case you are wondering, you can determine your TFS
version by looking at the version of Microsoft.TeamFoundation.Server.dll in %Program
Files%\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Services\bin.
For SP1, the version number matches that which is displayed in Visual Studio 2008,
or 9.0.30729.1.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=89e7ce6c-e260-417b-8c7f-1406725b6702" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Installing Visual Studio 2008 SP1, TFS 2008 SP1 and SQL 2008 RTM</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,89e7ce6c-e260-417b-8c7f-1406725b6702.aspx</guid>
      <link>http://blog.salvoz.com/2008/08/17/InstallingVisualStudio2008SP1TFS2008SP1AndSQL2008RTM.aspx</link>
      <pubDate>Sun, 17 Aug 2008 00:00:32 GMT</pubDate>
      <description>&lt;p&gt;
With the release of all Visual Studio 2008, TFS 2008, and SQL 2008, I set about upgrading
I set about upgrading my main development laptop. Currently I have VS 2008, Team Explorer
2008 and SQL 2005 client tools installed. I opted to download the full installer for
the SP1 updates as opposed to the bootstrapper options.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a title=".NET Framework 3.5 Service Pack 1 (Full Package)" href="http://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe"&gt;.NET
Framework 3.5 Service Pack 1 (Full Package)&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=27673C47-B3B5-4C67-BD99-84E525B5CE61&amp;amp;displaylang=en"&gt;Visual
Studio 2008 SP1 (Full Package ISO)&lt;/a&gt; - &lt;a href="http://support.microsoft.com/kb/945140"&gt;Change
List&lt;/a&gt;&amp;nbsp; 
&lt;li&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=9e40a5b6-da41-43a2-a06d-3cee196bfe3d&amp;amp;DisplayLang=en"&gt;TFS
2008 SP1 (Full Installer)&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I knew I needed to install VS 2008 SP1 prior to TFS 2008 SP1, but for some reason
decided to go with the SQL upgrade first. As I mentioned before, I currently only
have the client tools installed, as I like to keep my SQL servers on virtualized development
servers. 
&lt;/p&gt;
&lt;p&gt;
The SQL 2008 installer starts off by checking for .Net 3.5 SP1, and if it does not
exist, it will install it on your machine, along with a hotfix for windows installer.
After this is complete, you are required to reboot your machine. I opted for the upgrade
option, hoping that everything just works. I’m not sure if you can do a side by side
install with SQL 2005 client tools and 2008. 
&lt;/p&gt;
&lt;p&gt;
After selecting my options, an upgrade check is preformed, and it failed because I
have not installed VS 2008 SP1 yet. OK, I wanted to install that anyway, so I canceled
out and launched the VS 2008 SP1 installer. As with most service packs for Visual
Studio it takes awhile to apply, but my experience was more positive then the service
packs for VS 2005. No reboot was required, so I moved onto the TFS 2008 SP1 install.
&lt;/p&gt;
&lt;p&gt;
So I must have mis-understood or did not read something with the TFS 2008 SP1 installer.
It looks like it’s for the server components only, and VS 2008 SP1 handles upgrades
to Team Explorer as well. This &lt;a href="http://www.woodwardweb.com/tfs/000444.html"&gt;blog
post&lt;/a&gt; makes reference to this, and even says that if you are installing Team Explorer
on your TFS server, to install VS 2008 SP1. Looking at Help/About Microsoft Visual
Studio, I see the version number for VS 2008 is now 9.0.30729.1 SP, and looking at
the details for Team Explorer shows the same version number.
&lt;/p&gt;
&lt;p&gt;
Jumping back to the SQL 2008 installer, I proceeding with my update. However it wasn’t
really an update as much as it was a side by side install. Remember, I was just doing
the client tools, had I had the database components installed, I assume that those
would have been upgraded. I have a couple of SQL 2005 instances I can try an upgrade
on to see what happens. The install went very smoothly and there were no issues.
&lt;/p&gt;
&lt;p&gt;
First impressions of the new SQL Management studio are extremely positive. I saw the
intelli-sense demo at the launch event, but can’t really test it as I already have
SQL Prompt installed. My job as a Pseudo-DBA just got easier.Here are some new features
I found. 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
When running queries, you can view the results in traditional grid view, but also
as text (with options to choose your column delimiters), or export to a text (.rpt)
file. 
&lt;li&gt;
The new activity monitor actually provides useful information (well alot more information
then the old one ever did). It reminds me of the task manager in Windows Server 2008.
The new activity monitor does not work with SQL 2000, but I will be eliminating all
SQL 2000 boxes by the end of September. As 4 line graphs across the top you get %
Processor time, Waiting Tasks, Database I/O and Batch Requests/Sec. On the bottom
you get 4 collapsible lists: Processes, Resource Waits, Data File I/O and Recent Expensive
Queries. 
&lt;li&gt;
The database publishing wizard from Visual Studio is now included. Actually there
are a lot more options to control how your scripts are generated. 
&lt;li&gt;
There are some very nice default reports built in now as well. The reports were an
add-on for SQL 2005, but they are now included (and you can of course write your own).
Stuff like Disk Usage, Index Usage, etc. I hope I can find a way to schedule these
to be emailed. 
&lt;li&gt;
New option to generate Create and Drop Script (along with the original separate options
of generate create and generate drop). There is also an option to generate as SQL
Agent job.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Finally I went ahead and upgraded our TFS server to SP1. First thing I did was install
this month’s Windows Updates, as I was going to have to reboot anyway. Next up was
Visual Studio 2008 SP1, as I have VS and Team Explorer installed. Unfortunately I
was out of room on my system drive so I had to take the extra step of expanding my
virtual hard disk first. 
&lt;/p&gt;
&lt;p&gt;
I rebooted the server, and then proceeded to install TFS 2008 SP1. It looked like
everything was going good, but it failed at some point. Turns out the SQL server did
not survive the reboot, VS 2008 SP1, or the system drive expansion. Somehow my mssqlsystemresource.ldf
file got messed up at some point. The event log error stated “One or more files do
not match the primary file of the database.”. I got better information out of the
SQL error log which pointed me right to the System Resource ldf. I copied the ldf
file from another SQL 2005 server and was back in business. The TFS update proceeded
without incident after that. In case you are wondering, you can determine your TFS
version by looking at the version of Microsoft.TeamFoundation.Server.dll in %Program
Files%\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Services\bin.
For SP1, the version number matches that which is displayed in Visual Studio 2008,
or 9.0.30729.1.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=89e7ce6c-e260-417b-8c7f-1406725b6702" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,89e7ce6c-e260-417b-8c7f-1406725b6702.aspx</comments>
      <category>Technology</category>
      <category>Technology/Programming</category>
      <category>Technology/Sql</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=4092eb38-b984-4ca6-b443-7de71d51dd84</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,4092eb38-b984-4ca6-b443-7de71d51dd84.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,4092eb38-b984-4ca6-b443-7de71d51dd84.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=4092eb38-b984-4ca6-b443-7de71d51dd84</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
My weekly <a href="http://www.codeproject.com">Code Project</a> newsletter had a link
to a submission which talked about, and rated various Aspect Orientated Programming
(AOP) frameworks for .Net. While I’ve heard about AOP in the past, I haven’t looked
into much. What got me off the side lines, was that one of the .Net AOP frameworks, <a href="http://www.postsharp.org/">Post
Sharp</a>, lists support for the Compact Framework and Silverlight. In my experience,
it is rare to see stuff that actually supports the compact framework, so this is a
welcome change, however I have not tested it out yet. 
</p>
        <p>
Before I dive into Post Sharp anymore then I have, I wanted to read up a bit on AOP. <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming ">WikiPedia</a> has
a good article explaining the AOP using AspectJ as the example language. PostSharp
itself has a an <a href="http://www.postsharp.org/aop.net/">article</a> that focuses
on the .Net Framework as well. 
</p>
        <p>
          <strong>What is Aspect Orientated Programming (AOP)?</strong>
        </p>
        <ul>
          <li>
AOP increases modularity by allowing the separation of cross-cutting concerns 
</li>
          <li>
A concern is a cohesive area of functionality (think encapsulation). 
</li>
          <li>
Cross-Cutting concerns are those concerns which are used in multiple concerns 
</li>
          <li>
Logging is the most typical example of a cross-cutting concern. It itself is a concern
(encapsulated functionality), that is used everywhere in your program.</li>
        </ul>
        <p>
          <strong>Examples of Cross-Cutting Concerns</strong>
        </p>
        <ul>
          <li>
Logging 
</li>
          <li>
Exception Handling 
</li>
          <li>
Tracking is dirty on fields 
</li>
          <li>
Auditing 
</li>
          <li>
Security 
</li>
          <li>
Transactions</li>
        </ul>
        <p>
          <strong>How does it work (based on Post Sharp)</strong>
        </p>
        <ul>
          <li>
Implement cross-cutting concerns as classes creating attributes (implementing various
interfaces in Post Sharp) 
</li>
          <li>
Decorate your code using your attributes. Attributes can be added at the method, field,
class and assembly level. At the class and assembly level you can specify a filter
specify which methods or classes to work on. 
</li>
          <li>
When you compile, Post Sharp performs post build processing injecting code into your
compile MSIL, producing modified MSIL as the final output.</li>
        </ul>
        <p>
        </p>
        <p>
        </p>
        <p>
          <strong>AOP Frameworks</strong>
        </p>
        <ul>
          <li>
See the <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming#Implementations">Implementations</a> section
of the Wikipedia article.</li>
        </ul>
        <p>
          <strong>Performance</strong>
        </p>
        <p>
I was originally under the impression that by injecting code at compile time, there
would be <em>no</em> performance hit at run time. This is not true, at least in PostSharp
using the simple performance test from the <a href="http://code.google.com/p/postsharp-user-samples/">user
provided samples</a>.
</p>
        <p>
The simple performance test sample shows that AOP using Post Sharp incurs a variable
performance hit. Running the sample application multiple times shows the first time
the post sharp code is hit (view the complied .exe in reflector) it takes 73ms, and
then this drops down to 14 ms, compared to 4 ms for the non PostSharp code. On subsequent
runs, the first access of the post sharp code takes ~21ms and then drops down to 14ms,
while the non PostSharp code remains at 4ms. 
</p>
        <p>
The sample in question uses the works on a field in a class. The aspect (attribute
code) is required to cast an object passed in by the event args to a string. Perhaps
generics could help with performance by eliminating the cast?
</p>
        <p>
          <strong>Final Thoughts</strong>
        </p>
        <p>
AOP and PostSharp look like very powerful tools that I would like to take advantage
of. Learning from my past mistakes, I need to make sure that I take the time to understand
these tools and use them where appropriate and not go overboard with their use. I
think a good first step would be to find, or write some examples that implement some
basic AOP functionality covering all of the cross-cutting concerns identified above. 
</p>
        <p>
The only complaint I have so far is that you have to either install PostSharp on your
computer, or manually edit <em>every</em> project file that needs post processing.
This seems a little heavy handed, but I’m willing to consider it a fair tradeoff.
It just makes it hard to do a strictly x-copy deployment of a project/solution.
</p>
        <p>
I’ve also been reading up on software architecture, including topics on Separation
of Concerns and Loose Coupling. I think it is obvious that AOP can help with the separation
of concerns (it’s pretty much stated in the definition). I also get the feeling that
it could help with loose coupling, but I haven't seen a good example on that yet.
All the examples I have seen would require tight coupling of your aspects (attributes)
to something like log4net (in the logging example).
</p>
        <p>
Finally, I will need to continue to evaluate performance to determine if it’s a fair
tradeoff with increased maintainability of code. I am most concerned on the compact
framework side of things, as the processing power that those apps run on is not as
great as their desktop counterparts. This is not a knock on PostSharp, but just something
to be aware of.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=4092eb38-b984-4ca6-b443-7de71d51dd84" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Intro Aspect Orientated Programming</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,4092eb38-b984-4ca6-b443-7de71d51dd84.aspx</guid>
      <link>http://blog.salvoz.com/2008/08/13/IntroAspectOrientatedProgramming.aspx</link>
      <pubDate>Wed, 13 Aug 2008 15:36:47 GMT</pubDate>
      <description>&lt;p&gt;
My weekly &lt;a href="http://www.codeproject.com"&gt;Code Project&lt;/a&gt; newsletter had a link
to a submission which talked about, and rated various Aspect Orientated Programming
(AOP) frameworks for .Net. While I’ve heard about AOP in the past, I haven’t looked
into much. What got me off the side lines, was that one of the .Net AOP frameworks, &lt;a href="http://www.postsharp.org/"&gt;Post
Sharp&lt;/a&gt;, lists support for the Compact Framework and Silverlight. In my experience,
it is rare to see stuff that actually supports the compact framework, so this is a
welcome change, however I have not tested it out yet. 
&lt;/p&gt;
&lt;p&gt;
Before I dive into Post Sharp anymore then I have, I wanted to read up a bit on AOP. &lt;a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming "&gt;WikiPedia&lt;/a&gt; has
a good article explaining the AOP using AspectJ as the example language. PostSharp
itself has a an &lt;a href="http://www.postsharp.org/aop.net/"&gt;article&lt;/a&gt; that focuses
on the .Net Framework as well. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;What is Aspect Orientated Programming (AOP)?&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
AOP increases modularity by allowing the separation of cross-cutting concerns 
&lt;li&gt;
A concern is a cohesive area of functionality (think encapsulation). 
&lt;li&gt;
Cross-Cutting concerns are those concerns which are used in multiple concerns 
&lt;li&gt;
Logging is the most typical example of a cross-cutting concern. It itself is a concern
(encapsulated functionality), that is used everywhere in your program.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Examples of Cross-Cutting Concerns&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Logging 
&lt;li&gt;
Exception Handling 
&lt;li&gt;
Tracking is dirty on fields 
&lt;li&gt;
Auditing 
&lt;li&gt;
Security 
&lt;li&gt;
Transactions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;How does it work (based on Post Sharp)&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Implement cross-cutting concerns as classes creating attributes (implementing various
interfaces in Post Sharp) 
&lt;li&gt;
Decorate your code using your attributes. Attributes can be added at the method, field,
class and assembly level. At the class and assembly level you can specify a filter
specify which methods or classes to work on. 
&lt;li&gt;
When you compile, Post Sharp performs post build processing injecting code into your
compile MSIL, producing modified MSIL as the final output.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;AOP Frameworks&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
See the &lt;a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming#Implementations"&gt;Implementations&lt;/a&gt; section
of the Wikipedia article.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Performance&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I was originally under the impression that by injecting code at compile time, there
would be &lt;em&gt;no&lt;/em&gt; performance hit at run time. This is not true, at least in PostSharp
using the simple performance test from the &lt;a href="http://code.google.com/p/postsharp-user-samples/"&gt;user
provided samples&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The simple performance test sample shows that AOP using Post Sharp incurs a variable
performance hit. Running the sample application multiple times shows the first time
the post sharp code is hit (view the complied .exe in reflector) it takes 73ms, and
then this drops down to 14 ms, compared to 4 ms for the non PostSharp code. On subsequent
runs, the first access of the post sharp code takes ~21ms and then drops down to 14ms,
while the non PostSharp code remains at 4ms. 
&lt;/p&gt;
&lt;p&gt;
The sample in question uses the works on a field in a class. The aspect (attribute
code) is required to cast an object passed in by the event args to a string. Perhaps
generics could help with performance by eliminating the cast?
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Final Thoughts&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
AOP and PostSharp look like very powerful tools that I would like to take advantage
of. Learning from my past mistakes, I need to make sure that I take the time to understand
these tools and use them where appropriate and not go overboard with their use. I
think a good first step would be to find, or write some examples that implement some
basic AOP functionality covering all of the cross-cutting concerns identified above. 
&lt;/p&gt;
&lt;p&gt;
The only complaint I have so far is that you have to either install PostSharp on your
computer, or manually edit &lt;em&gt;every&lt;/em&gt; project file that needs post processing.
This seems a little heavy handed, but I’m willing to consider it a fair tradeoff.
It just makes it hard to do a strictly x-copy deployment of a project/solution.
&lt;/p&gt;
&lt;p&gt;
I’ve also been reading up on software architecture, including topics on Separation
of Concerns and Loose Coupling. I think it is obvious that AOP can help with the separation
of concerns (it’s pretty much stated in the definition). I also get the feeling that
it could help with loose coupling, but I haven't seen a good example on that yet.
All the examples I have seen would require tight coupling of your aspects (attributes)
to something like log4net (in the logging example).
&lt;/p&gt;
&lt;p&gt;
Finally, I will need to continue to evaluate performance to determine if it’s a fair
tradeoff with increased maintainability of code. I am most concerned on the compact
framework side of things, as the processing power that those apps run on is not as
great as their desktop counterparts. This is not a knock on PostSharp, but just something
to be aware of.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=4092eb38-b984-4ca6-b443-7de71d51dd84" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,4092eb38-b984-4ca6-b443-7de71d51dd84.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=ce5bab49-15f4-4ccb-8053-b44272019501</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,ce5bab49-15f4-4ccb-8053-b44272019501.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,ce5bab49-15f4-4ccb-8053-b44272019501.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ce5bab49-15f4-4ccb-8053-b44272019501</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
We have some WSE 2.0 secured Web Services that we are migrating to a new data center.
As part of this migration effort I needed to write some automated tests to make sure
everything was working. In addition to working with the WSE 2.0 clients our customers
have, I also wanted to see what was needed to make the services consumable by WCF
clients. After finding this article on <a href="http://wcf.netfx3.com/content/WindowsCommunicationFoundationWCFInteroperabilityandMigrationwithWSE20.aspx">WSE
2.0 Interoperability</a> on <a href="http://wcf.netfx3.com">http://wcf.netfx3.com</a>,
it was pretty easy.
</p>
        <p>
The main problem I was having was issues with the username token. In WCF some basic
concepts were changed, such the removal of password encryption (instead recurring
the transport, https for example to handle encryption), and replay detection.   
</p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
Here is the config section from the WSE 2.0 server piece (the diagnostic piece is
optional)
</p>
        <pre class="csharpcode">
          <span class="kwrd">&lt;</span>
          <span class="html">microsoft.web.services2</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">security</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">securityTokenManager</span>
          <span class="attr">xmlns:wsse</span>
          <span class="kwrd">="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"</span>
          <span class="attr">qname</span>
          <span class="kwrd">="wsse:UsernameToken"</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">replayDetection</span>
          <span class="attr">enabled</span>
          <span class="kwrd">="false"</span>
          <span class="kwrd">/&gt;</span>
          <span class="kwrd">&lt;/</span>
          <span class="html">securityTokenManager</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;/</span>
          <span class="html">security</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">diagnostics</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">trace</span>
          <span class="attr">enabled</span>
          <span class="kwrd">="true"</span>
          <span class="attr">input</span>
          <span class="kwrd">="logs\InputTrace.webinfo"</span>
          <span class="attr">output</span>
          <span class="kwrd">="logs\OutputTrace.webinfo"</span>
          <span class="kwrd">/&gt;</span>
          <span class="kwrd">&lt;/</span>
          <span class="html">diagnostics</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;/</span>
          <span class="html">microsoft.web.services2</span>
          <span class="kwrd">&gt;</span>
        </pre>
        <style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
        <p>
Here is a sample configuration section for the WCF Client:
</p>
        <pre class="csharpcode">
          <span class="kwrd">&lt;</span>
          <span class="html">system.serviceModel</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">bindings</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">basicHttpBinding</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">binding</span>
          <span class="attr">name</span>
          <span class="kwrd">="InventorySoap"</span>
          <span class="attr">closeTimeout</span>
          <span class="kwrd">="00:01:00"</span>
          <span class="attr">openTimeout</span>
          <span class="kwrd">="00:01:00"</span>
          <span class="attr">receiveTimeout</span>
          <span class="kwrd">="00:10:00"</span>
          <span class="attr">sendTimeout</span>
          <span class="kwrd">="00:01:00"</span>
          <span class="attr">allowCookies</span>
          <span class="kwrd">="false"</span>
          <span class="attr">bypassProxyOnLocal</span>
          <span class="kwrd">="false"</span>
          <span class="attr">hostNameComparisonMode</span>
          <span class="kwrd">="StrongWildcard"</span>
          <span class="attr">maxBufferSize</span>
          <span class="kwrd">="65536"</span>
          <span class="attr">maxBufferPoolSize</span>
          <span class="kwrd">="524288"</span>
          <span class="attr">maxReceivedMessageSize</span>
          <span class="kwrd">="65536"</span>
          <span class="attr">messageEncoding</span>
          <span class="kwrd">="Text"</span>
          <span class="attr">textEncoding</span>
          <span class="kwrd">="utf-8"</span>
          <span class="attr">transferMode</span>
          <span class="kwrd">="Buffered"</span>
          <span class="attr">useDefaultWebProxy</span>
          <span class="kwrd">="true"</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">readerQuotas</span>
          <span class="attr">maxDepth</span>
          <span class="kwrd">="32"</span>
          <span class="attr">maxStringContentLength</span>
          <span class="kwrd">="8192"</span>
          <span class="attr">maxArrayLength</span>
          <span class="kwrd">="16384"</span>
          <span class="attr">maxBytesPerRead</span>
          <span class="kwrd">="4096"</span>
          <span class="attr">maxNameTableCharCount</span>
          <span class="kwrd">="16384"</span>
          <span class="kwrd">/&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">security</span>
          <span class="attr">mode</span>
          <span class="kwrd">="TransportWithMessageCredential"</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">message</span>
          <span class="attr">clientCredentialType</span>
          <span class="kwrd">="UserName"</span>
          <span class="attr">algorithmSuite</span>
          <span class="kwrd">="Default"</span>
          <span class="kwrd">/&gt;</span>
          <span class="kwrd">&lt;/</span>
          <span class="html">security</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;/</span>
          <span class="html">binding</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;/</span>
          <span class="html">basicHttpBinding</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;/</span>
          <span class="html">bindings</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">client</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">endpoint</span>
          <span class="attr">address</span>
          <span class="kwrd">="https://Server/Directory/Service.asmx"</span>
          <span class="attr">binding</span>
          <span class="kwrd">="basicHttpBinding"</span>
          <span class="attr">bindingConfiguration</span>
          <span class="kwrd">="InventorySoap"</span>
          <span class="attr">contract</span>
          <span class="kwrd">="MonitoringServices.Inventory.Wcf.InventorySoap"</span>
          <span class="attr">name</span>
          <span class="kwrd">="InventorySoap"</span>
          <span class="kwrd">/&gt;</span>
          <span class="kwrd">&lt;/</span>
          <span class="html">client</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;/</span>
          <span class="html">system.serviceModel</span>
          <span class="kwrd">&gt;</span>
        </pre>
        <style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
        <p>
Most of the client configuration was created for me when I added a service reference
to my project. The key part is the mode=TransportWithMessageCredential and clientCredntialType
= “UserName”.
</p>
        <p>
We have another project underway were we want to rewrite the WSE 2.0 services with
WCF while maintaining full compatibility with deployed WSE 2.0 clients. The netfx3
article covers this scenario as well, and it seems like we will be able to accomplish
our task. Look for a future post on that endeavor.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=ce5bab49-15f4-4ccb-8053-b44272019501" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>WSE2 and WCF Interoperability</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,ce5bab49-15f4-4ccb-8053-b44272019501.aspx</guid>
      <link>http://blog.salvoz.com/2008/07/09/WSE2AndWCFInteroperability.aspx</link>
      <pubDate>Wed, 09 Jul 2008 16:30:23 GMT</pubDate>
      <description>&lt;p&gt;
We have some WSE 2.0 secured Web Services that we are migrating to a new data center.
As part of this migration effort I needed to write some automated tests to make sure
everything was working. In addition to working with the WSE 2.0 clients our customers
have, I also wanted to see what was needed to make the services consumable by WCF
clients. After finding this article on &lt;a href="http://wcf.netfx3.com/content/WindowsCommunicationFoundationWCFInteroperabilityandMigrationwithWSE20.aspx"&gt;WSE
2.0 Interoperability&lt;/a&gt; on &lt;a href="http://wcf.netfx3.com"&gt;http://wcf.netfx3.com&lt;/a&gt;,
it was pretty easy.
&lt;/p&gt;
&lt;p&gt;
The main problem I was having was issues with the username token. In WCF some basic
concepts were changed, such the removal of password encryption (instead recurring
the transport, https for example to handle encryption), and replay detection.&amp;nbsp;&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Here is the config section from the WSE 2.0 server piece (the diagnostic piece is
optional)
&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;microsoft.web.services2&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;security&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;securityTokenManager&lt;/span&gt; &lt;span class="attr"&gt;xmlns:wsse&lt;/span&gt;&lt;span class="kwrd"&gt;="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&lt;/span&gt; &lt;span class="attr"&gt;qname&lt;/span&gt;&lt;span class="kwrd"&gt;="wsse:UsernameToken"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;replayDetection&lt;/span&gt; &lt;span class="attr"&gt;enabled&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;securityTokenManager&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;security&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;diagnostics&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;trace&lt;/span&gt; &lt;span class="attr"&gt;enabled&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="attr"&gt;input&lt;/span&gt;&lt;span class="kwrd"&gt;="logs\InputTrace.webinfo"&lt;/span&gt; &lt;span class="attr"&gt;output&lt;/span&gt;&lt;span class="kwrd"&gt;="logs\OutputTrace.webinfo"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;diagnostics&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;microsoft.web.services2&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;p&gt;
Here is a sample configuration section for the WCF Client:
&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.serviceModel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;bindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;basicHttpBinding&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;binding&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="InventorySoap"&lt;/span&gt; &lt;span class="attr"&gt;closeTimeout&lt;/span&gt;&lt;span class="kwrd"&gt;="00:01:00"&lt;/span&gt; &lt;span class="attr"&gt;openTimeout&lt;/span&gt;&lt;span class="kwrd"&gt;="00:01:00"&lt;/span&gt; &lt;span class="attr"&gt;receiveTimeout&lt;/span&gt;&lt;span class="kwrd"&gt;="00:10:00"&lt;/span&gt; &lt;span class="attr"&gt;sendTimeout&lt;/span&gt;&lt;span class="kwrd"&gt;="00:01:00"&lt;/span&gt; &lt;span class="attr"&gt;allowCookies&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;span class="attr"&gt;bypassProxyOnLocal&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;span class="attr"&gt;hostNameComparisonMode&lt;/span&gt;&lt;span class="kwrd"&gt;="StrongWildcard"&lt;/span&gt; &lt;span class="attr"&gt;maxBufferSize&lt;/span&gt;&lt;span class="kwrd"&gt;="65536"&lt;/span&gt; &lt;span class="attr"&gt;maxBufferPoolSize&lt;/span&gt;&lt;span class="kwrd"&gt;="524288"&lt;/span&gt; &lt;span class="attr"&gt;maxReceivedMessageSize&lt;/span&gt;&lt;span class="kwrd"&gt;="65536"&lt;/span&gt; &lt;span class="attr"&gt;messageEncoding&lt;/span&gt;&lt;span class="kwrd"&gt;="Text"&lt;/span&gt; &lt;span class="attr"&gt;textEncoding&lt;/span&gt;&lt;span class="kwrd"&gt;="utf-8"&lt;/span&gt; &lt;span class="attr"&gt;transferMode&lt;/span&gt;&lt;span class="kwrd"&gt;="Buffered"&lt;/span&gt; &lt;span class="attr"&gt;useDefaultWebProxy&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;readerQuotas&lt;/span&gt; &lt;span class="attr"&gt;maxDepth&lt;/span&gt;&lt;span class="kwrd"&gt;="32"&lt;/span&gt; &lt;span class="attr"&gt;maxStringContentLength&lt;/span&gt;&lt;span class="kwrd"&gt;="8192"&lt;/span&gt; &lt;span class="attr"&gt;maxArrayLength&lt;/span&gt;&lt;span class="kwrd"&gt;="16384"&lt;/span&gt; &lt;span class="attr"&gt;maxBytesPerRead&lt;/span&gt;&lt;span class="kwrd"&gt;="4096"&lt;/span&gt; &lt;span class="attr"&gt;maxNameTableCharCount&lt;/span&gt;&lt;span class="kwrd"&gt;="16384"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;security&lt;/span&gt; &lt;span class="attr"&gt;mode&lt;/span&gt;&lt;span class="kwrd"&gt;="TransportWithMessageCredential"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;message&lt;/span&gt; &lt;span class="attr"&gt;clientCredentialType&lt;/span&gt;&lt;span class="kwrd"&gt;="UserName"&lt;/span&gt; &lt;span class="attr"&gt;algorithmSuite&lt;/span&gt;&lt;span class="kwrd"&gt;="Default"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;security&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;binding&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;basicHttpBinding&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;bindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;client&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpoint&lt;/span&gt; &lt;span class="attr"&gt;address&lt;/span&gt;&lt;span class="kwrd"&gt;="https://Server/Directory/Service.asmx"&lt;/span&gt; &lt;span class="attr"&gt;binding&lt;/span&gt;&lt;span class="kwrd"&gt;="basicHttpBinding"&lt;/span&gt; &lt;span class="attr"&gt;bindingConfiguration&lt;/span&gt;&lt;span class="kwrd"&gt;="InventorySoap"&lt;/span&gt; &lt;span class="attr"&gt;contract&lt;/span&gt;&lt;span class="kwrd"&gt;="MonitoringServices.Inventory.Wcf.InventorySoap"&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="InventorySoap"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;client&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;system.serviceModel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;p&gt;
Most of the client configuration was created for me when I added a service reference
to my project. The key part is the mode=TransportWithMessageCredential and clientCredntialType
= “UserName”.
&lt;/p&gt;
&lt;p&gt;
We have another project underway were we want to rewrite the WSE 2.0 services with
WCF while maintaining full compatibility with deployed WSE 2.0 clients. The netfx3
article covers this scenario as well, and it seems like we will be able to accomplish
our task. Look for a future post on that endeavor.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=ce5bab49-15f4-4ccb-8053-b44272019501" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,ce5bab49-15f4-4ccb-8053-b44272019501.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=7c8b7172-c685-477a-944e-db0fb66c2f44</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,7c8b7172-c685-477a-944e-db0fb66c2f44.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,7c8b7172-c685-477a-944e-db0fb66c2f44.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=7c8b7172-c685-477a-944e-db0fb66c2f44</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today I tried to use the web recorder in Visual Studio to create some new web tests,
but the recorder tool bar would not show in IE. A quick search found <a href="http://blogs.msdn.com/mtaute/archive/2007/11/09/diagnosing-and-fixing-web-test-recorder-bar-issues.aspx">Diagnosing
and fixing Web Test recorder bar issues</a>, by <a href="http://blogs.msdn.com/mtaute/default.aspx">Michael
Taute</a> which had several troubleshooting tips. 
</p>
        <p>
I ended up changing my home page which is about:blank (and loads when web recorder
is launched) to belong to the local intranet zone, as this is where my test site is.
That didn’t fix the problem initially, so I deleted the following two registry keys
using the 32 bit registry editor (C:\Windows\SysWOW64\regedit.exe):
</p>
        <ul>
          <li>
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component
Categories\{00021493-0000-0000-C000-000000000046}</li>
          <li>
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component
Categories\{00021494-0000-0000-C000-000000000046}</li>
        </ul>
        <p>
You need to make sure all instances of IE are closed before deleting the registry
keys. Once I did this, my web recorder was up and running. I’ve left about:blank in
the local intranet zone for now.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=7c8b7172-c685-477a-944e-db0fb66c2f44" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Visual Studio Web Recorder under Vista/Server 2008 64bit</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,7c8b7172-c685-477a-944e-db0fb66c2f44.aspx</guid>
      <link>http://blog.salvoz.com/2008/07/07/VisualStudioWebRecorderUnderVistaServer200864bit.aspx</link>
      <pubDate>Mon, 07 Jul 2008 20:24:10 GMT</pubDate>
      <description>&lt;p&gt;
Today I tried to use the web recorder in Visual Studio to create some new web tests,
but the recorder tool bar would not show in IE. A quick search found &lt;a href="http://blogs.msdn.com/mtaute/archive/2007/11/09/diagnosing-and-fixing-web-test-recorder-bar-issues.aspx"&gt;Diagnosing
and fixing Web Test recorder bar issues&lt;/a&gt;, by &lt;a href="http://blogs.msdn.com/mtaute/default.aspx"&gt;Michael
Taute&lt;/a&gt; which had several troubleshooting tips. 
&lt;/p&gt;
&lt;p&gt;
I ended up changing my home page which is about:blank (and loads when web recorder
is launched) to belong to the local intranet zone, as this is where my test site is.
That didn’t fix the problem initially, so I deleted the following two registry keys
using the 32 bit registry editor (C:\Windows\SysWOW64\regedit.exe):
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component
Categories\{00021493-0000-0000-C000-000000000046}&lt;/li&gt;
&lt;li&gt;
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component
Categories\{00021494-0000-0000-C000-000000000046}&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
You need to make sure all instances of IE are closed before deleting the registry
keys. Once I did this, my web recorder was up and running. I’ve left about:blank in
the local intranet zone for now.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=7c8b7172-c685-477a-944e-db0fb66c2f44" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,7c8b7172-c685-477a-944e-db0fb66c2f44.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=2ed56d3d-f5a6-429b-9444-d7645d879eff</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,2ed56d3d-f5a6-429b-9444-d7645d879eff.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,2ed56d3d-f5a6-429b-9444-d7645d879eff.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=2ed56d3d-f5a6-429b-9444-d7645d879eff</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Once again I need to generate some self signed certs for local development. Installing
certificate services in Windows is a bit of an overkill for what I need, however,
it would be nice to have a root CA to work with. 
</p>
        <p>
After some Googling, I found a site, <a title="http://ssl4net.com/" href="http://ssl4net.com/">http://ssl4net.com/</a> which
allows you to create a self signed root CA, and then additional certs signed by the
CA you created. It is extremely easy to use and once I got the certs I was able to
install them without issue. 
</p>
        <p>
My only concern is that the certs do not appear to be encrypted on their server, nor
do they use SSL (seems ironic). However, since I will only be using this for internal
use, I have no problems with this. I would be a little cautious if I was going to
use to verify my identity to other people.
</p>
        <p>
It looks like they might be using open-ssl as the cert creation mechanism, so maybe
it’s worth the effort to setting up a VM running linux to generate my own certs in
house, but that’s for another day. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=2ed56d3d-f5a6-429b-9444-d7645d879eff" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Generating Self Signed Certs The Easy Way</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,2ed56d3d-f5a6-429b-9444-d7645d879eff.aspx</guid>
      <link>http://blog.salvoz.com/2008/07/04/GeneratingSelfSignedCertsTheEasyWay.aspx</link>
      <pubDate>Fri, 04 Jul 2008 04:25:36 GMT</pubDate>
      <description>&lt;p&gt;
Once again I need to generate some self signed certs for local development. Installing
certificate services in Windows is a bit of an overkill for what I need, however,
it would be nice to have a root CA to work with. 
&lt;/p&gt;
&lt;p&gt;
After some Googling, I found a site, &lt;a title="http://ssl4net.com/" href="http://ssl4net.com/"&gt;http://ssl4net.com/&lt;/a&gt; which
allows you to create a self signed root CA, and then additional certs signed by the
CA you created. It is extremely easy to use and once I got the certs I was able to
install them without issue. 
&lt;/p&gt;
&lt;p&gt;
My only concern is that the certs do not appear to be encrypted on their server, nor
do they use SSL (seems ironic). However, since I will only be using this for internal
use, I have no problems with this. I would be a little cautious if I was going to
use to verify my identity to other people.
&lt;/p&gt;
&lt;p&gt;
It looks like they might be using open-ssl as the cert creation mechanism, so maybe
it’s worth the effort to setting up a VM running linux to generate my own certs in
house, but that’s for another day. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=2ed56d3d-f5a6-429b-9444-d7645d879eff" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,2ed56d3d-f5a6-429b-9444-d7645d879eff.aspx</comments>
      <category>Technology/Programming</category>
      <category>Technology/Tools</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=6dd9a30d-c679-4d6f-8377-4a5610167b60</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,6dd9a30d-c679-4d6f-8377-4a5610167b60.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,6dd9a30d-c679-4d6f-8377-4a5610167b60.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=6dd9a30d-c679-4d6f-8377-4a5610167b60</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This one took me a little longer then I figured. Maybe I’m just trying to do stuff
the wrong way, but I don’t know, I feel like my use case is correct.
</p>
        <p>
What am I talking about anyway? I am talking about creating a set of web tests in
Visual Studio Test Edition (well Team Suite) that I can actually use in a real world
situation (i.e. Have tests that work on a dev, staging and production server). The
problem is/was, hard coded URLs for my dev server, which ultimately would have to
be changed to point at staging and production. 
</p>
        <p>
Before proceeding, let me spell out what I’m trying to do (use case):
</p>
        <ul>
          <li>
Use the VS GUI to create and most likely run my tests</li>
          <li>
Single place to store the web server, and other settings that I can use for all my
tests</li>
        </ul>
        <p>
At first, I thought this was going to be a very easy change, as there is a “Parameterize
Web Servers” option when you right click on the root node of your web test. This creates
a context variable, which I thought was cool, until I realized it was on a test by
test basis, not project. I guess I was looking for a project wide context parameters
file, but couldn’t find one. 
</p>
        <p>
I did some searching and supposedly you can set an environmental (yes, from a command
prompt) variable named Test.&lt;ContextParameter&gt;, however I was unable to get
this to work. I think this might only work when invoking mstest from the command line
which makes some sense, but kind of throws a wrench in the works. While this would
be perfectly acceptable for a un-attended build server, what if I needed to point
to a new dev server in the GUI?
</p>
        <p>
I then moved to a XML data source with a single “line” of data":
</p>
        <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 45.86%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 141px; background-color: #f4f4f4">
          <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; 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 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: #606060"> 1:</span>
              <span style="color: #0000ff">&lt;?</span>
              <span style="color: #800000">xml</span>
              <span style="color: #ff0000">version</span>
              <span style="color: #0000ff">="1.0"</span>
              <span style="color: #ff0000">encoding</span>
              <span style="color: #0000ff">="utf-8"</span> ?<span style="color: #0000ff">&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: #606060"> 2:</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">Config</span>
              <span style="color: #0000ff">&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: #606060"> 3:</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">UrlRoot</span>
              <span style="color: #0000ff">&gt;</span>http://dapltp101.dmz.pri<span style="color: #0000ff">&lt;/</span><span style="color: #800000">UrlRoot</span><span style="color: #0000ff">&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: #606060"> 4:</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">LoginUserName</span>
              <span style="color: #0000ff">&gt;</span>asalvo<span style="color: #0000ff">&lt;/</span><span style="color: #800000">LoginUserName</span><span style="color: #0000ff">&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: #606060"> 5:</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">LoginPassword</span>
              <span style="color: #0000ff">&gt;</span>123456<span style="color: #0000ff">&lt;/</span><span style="color: #800000">LoginPassword</span><span style="color: #0000ff">&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: #606060"> 6:</span>
              <span style="color: #0000ff">&lt;/</span>
              <span style="color: #800000">Config</span>
              <span style="color: #0000ff">&gt;</span>
            </pre>
          </div>
        </div>
        <p>
 
</p>
        <p>
This worked pretty good, except that when selecting UrlRoot from the drop down list
of available options, it replaced the entire URL, and not just the URLRoot. I do like
how they made the property grid “strong typed” in that it gives you the fields you
defined for your data source, but I didn’t want to replace my whole URL. Also, I could
not edit the value after selecting my XML data source value.
</p>
        <p>
Looking at the format of ContextProperties in values, as well as how the data source
was referenced, I decided to try typing what I wanted in myself. I went to the URL
value and replaced the URL root with the name my XML data element, and this worked.
</p>
        <p>
For example, given:
</p>
        <ul>
          <li>
URL: <a href="http://dapltp101.dmz.pri/Location1">http://dapltp101.dmz.pri/Location1</a></li>
          <li>
Xml data source name: XmlConfig</li>
          <li>
Xml root node: Config</li>
          <li>
Xml Element Name: UrlRoot</li>
        </ul>
        <p>
Type this in the value field for your URL in the Request object on the test: {{ConfigXml.Config.UrlRoot}}/Location1
</p>
        <p>
Like I said, that took me a little while longer then I would have thought. I should
have went with my gut and tried that format soon after getting the regular XML data
source to work. 
</p>
        <p>
I do have one last issue (well the fist of many I am sure), and that is, I have two
URL’s when I really should only have one. When I hit the root of my website, I am
redirected to a https:// URL, and that is treated differently. I’d like to capture
the redirected URL and use that so I don’t have to maintain two values in my configuration
file, but I’m just gonna roll with it for now. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=6dd9a30d-c679-4d6f-8377-4a5610167b60" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Changing URL in a Visual Studio Web Test</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,6dd9a30d-c679-4d6f-8377-4a5610167b60.aspx</guid>
      <link>http://blog.salvoz.com/2008/06/23/ChangingURLInAVisualStudioWebTest.aspx</link>
      <pubDate>Mon, 23 Jun 2008 21:14:44 GMT</pubDate>
      <description>&lt;p&gt;
This one took me a little longer then I figured. Maybe I’m just trying to do stuff
the wrong way, but I don’t know, I feel like my use case is correct.
&lt;/p&gt;
&lt;p&gt;
What am I talking about anyway? I am talking about creating a set of web tests in
Visual Studio Test Edition (well Team Suite) that I can actually use in a real world
situation (i.e. Have tests that work on a dev, staging and production server). The
problem is/was, hard coded URLs for my dev server, which ultimately would have to
be changed to point at staging and production. 
&lt;/p&gt;
&lt;p&gt;
Before proceeding, let me spell out what I’m trying to do (use case):
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Use the VS GUI to create and most likely run my tests&lt;/li&gt;
&lt;li&gt;
Single place to store the web server, and other settings that I can use for all my
tests&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
At first, I thought this was going to be a very easy change, as there is a “Parameterize
Web Servers” option when you right click on the root node of your web test. This creates
a context variable, which I thought was cool, until I realized it was on a test by
test basis, not project. I guess I was looking for a project wide context parameters
file, but couldn’t find one. 
&lt;/p&gt;
&lt;p&gt;
I did some searching and supposedly you can set an environmental (yes, from a command
prompt) variable named Test.&amp;lt;ContextParameter&amp;gt;, however I was unable to get
this to work. I think this might only work when invoking mstest from the command line
which makes some sense, but kind of throws a wrench in the works. While this would
be perfectly acceptable for a un-attended build server, what if I needed to point
to a new dev server in the GUI?
&lt;/p&gt;
&lt;p&gt;
I then moved to a XML data source with a single “line” of data":
&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 45.86%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 141px; background-color: #f4f4f4"&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; 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"&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #800000"&gt;xml&lt;/span&gt; &lt;span style="color: #ff0000"&gt;version&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="1.0"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;encoding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="utf-8"&lt;/span&gt; ?&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Config&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;UrlRoot&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;http://dapltp101.dmz.pri&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;UrlRoot&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;LoginUserName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;asalvo&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;LoginUserName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;LoginPassword&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;123456&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;LoginPassword&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Config&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
This worked pretty good, except that when selecting UrlRoot from the drop down list
of available options, it replaced the entire URL, and not just the URLRoot. I do like
how they made the property grid “strong typed” in that it gives you the fields you
defined for your data source, but I didn’t want to replace my whole URL. Also, I could
not edit the value after selecting my XML data source value.
&lt;/p&gt;
&lt;p&gt;
Looking at the format of ContextProperties in values, as well as how the data source
was referenced, I decided to try typing what I wanted in myself. I went to the URL
value and replaced the URL root with the name my XML data element, and this worked.
&lt;/p&gt;
&lt;p&gt;
For example, given:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
URL: &lt;a href="http://dapltp101.dmz.pri/Location1"&gt;http://dapltp101.dmz.pri/Location1&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
Xml data source name: XmlConfig&lt;/li&gt;
&lt;li&gt;
Xml root node: Config&lt;/li&gt;
&lt;li&gt;
Xml Element Name: UrlRoot&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Type this in the value field for your URL in the Request object on the test: {{ConfigXml.Config.UrlRoot}}/Location1
&lt;/p&gt;
&lt;p&gt;
Like I said, that took me a little while longer then I would have thought. I should
have went with my gut and tried that format soon after getting the regular XML data
source to work. 
&lt;/p&gt;
&lt;p&gt;
I do have one last issue (well the fist of many I am sure), and that is, I have two
URL’s when I really should only have one. When I hit the root of my website, I am
redirected to a https:// URL, and that is treated differently. I’d like to capture
the redirected URL and use that so I don’t have to maintain two values in my configuration
file, but I’m just gonna roll with it for now. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=6dd9a30d-c679-4d6f-8377-4a5610167b60" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,6dd9a30d-c679-4d6f-8377-4a5610167b60.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=d2347534-bbda-4ad5-b6d3-c44446a80179</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,d2347534-bbda-4ad5-b6d3-c44446a80179.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,d2347534-bbda-4ad5-b6d3-c44446a80179.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d2347534-bbda-4ad5-b6d3-c44446a80179</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today I was working on installing a WCF application on Windows Server 2008, hosted
by IIS 7. This was my first attempt at running WCF on IIS 7/Server 2008, and the first
time WCF was used on this particular box. Needless to say, things didn’t work as expected.
</p>
        <p>
Since this is a test box, I didn’t have a public cert for use with SSL, but IIS 7
adds a very nice Self Signing Cert feature, which is accessible in the IIS Manager
under the root server node (look for server certificates under IIS). Unfortunately,
the self signed cert uses the computers fully qualified host name, and you are not
given an option to fix this. Looking around, it looks like the self signing cert tool
that shipped with the IIS 6 resource kit allowed you to specify the domain name. Anyway,
this is a minor inconvenience, and easily fixed by using the windows hosts file to
redirect. You need to remember to export the cert from the IIS management tool, and
import it to your trusted root certs on any client computer to avoid getting warnings
in IE, and errors in your WCF client applications.
</p>
        <p>
However, certs were not the reason for this post, the following error was:
</p>
        <blockquote>
          <p>
Error the client and server are no longer in sync for their wcf service settings.
System.ServiceModel.ProtocolException: The remote server returned an unexpected response:
(405) Method Not Allowed. ---&gt; System.Net.WebException: The remote server returned
an error: (405) Method Not Allowed. at System.Net.HttpWebRequest.GetResponse() at
System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
timeout) --- End of inner exception stack trace --- Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest
request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan
timeout) at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message
message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message
message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String
action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,
TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp;
msgData, Int32 type) at …
</p>
        </blockquote>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
Looking back at this error, I think I may have missed a key clue. The phrase “The
remote server returned an unexpected response” should have clued me in that something
wasn’t setup right. I usually see this type of error when IIS tries to display an
error message in HTML, thinking that it’s a browser request. The WCF client application
isn’t expecting HTML, so it throws an error.
</p>
        <p>
It’s been awhile since I worked with WCF, and I forgot basic trouble shooting 101
for a couple of minutes, and finally remembered to just type in the URL to the .svc
file on the server. I was greeted with an IIS 7 error page that listed some pretty
good trouble shooting steps. The first one said to check the server handler mappings,
which I did, and noticed there were not mappings for .svc. I found a <a href="http://blogs.msdn.com/nikola/archive/2008/03/06/configuring-iis-7-to-work-with-wcf-web-services-for-silverlight-2-beta-1-scenario.aspx">blog
post on wcf and silverlight</a>, which explained how to enable WCF on IIS 7. 
</p>
        <p>
Now I had installed WCF (.net 3.0) via the features section of server manger in Server
2008, but I guess that doesn’t actually enable it to work with IIS 7. Maybe I didn’t
install something in the correct order. Fair enough, and the fix is simple. From a
command prompt (I ran mine with admin privileges under UAC), execute ServiceModelreg
-i in c:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation. Once
this was done, I went back to my handler mappings and saw entries for .svc.  
</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>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
I’d like to note that the error messages returned by IIS 7 in the browser window (when
browsing from the web server itself), gives allot better error and diagnostics information
for trouble shooting. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=d2347534-bbda-4ad5-b6d3-c44446a80179" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>WCF on IIS 7 and Windows Server 2008</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,d2347534-bbda-4ad5-b6d3-c44446a80179.aspx</guid>
      <link>http://blog.salvoz.com/2008/06/19/WCFOnIIS7AndWindowsServer2008.aspx</link>
      <pubDate>Thu, 19 Jun 2008 21:16:52 GMT</pubDate>
      <description>&lt;p&gt;
Today I was working on installing a WCF application on Windows Server 2008, hosted
by IIS 7. This was my first attempt at running WCF on IIS 7/Server 2008, and the first
time WCF was used on this particular box. Needless to say, things didn’t work as expected.
&lt;/p&gt;
&lt;p&gt;
Since this is a test box, I didn’t have a public cert for use with SSL, but IIS 7
adds a very nice Self Signing Cert feature, which is accessible in the IIS Manager
under the root server node (look for server certificates under IIS). Unfortunately,
the self signed cert uses the computers fully qualified host name, and you are not
given an option to fix this. Looking around, it looks like the self signing cert tool
that shipped with the IIS 6 resource kit allowed you to specify the domain name. Anyway,
this is a minor inconvenience, and easily fixed by using the windows hosts file to
redirect. You need to remember to export the cert from the IIS management tool, and
import it to your trusted root certs on any client computer to avoid getting warnings
in IE, and errors in your WCF client applications.
&lt;/p&gt;
&lt;p&gt;
However, certs were not the reason for this post, the following error was:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Error the client and server are no longer in sync for their wcf service settings.
System.ServiceModel.ProtocolException: The remote server returned an unexpected response:
(405) Method Not Allowed. ---&amp;gt; System.Net.WebException: The remote server returned
an error: (405) Method Not Allowed. at System.Net.HttpWebRequest.GetResponse() at
System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
timeout) --- End of inner exception stack trace --- Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest
request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan
timeout) at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message
message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message
message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String
action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,
TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp;amp;
msgData, Int32 type) at …
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Looking back at this error, I think I may have missed a key clue. The phrase “The
remote server returned an unexpected response” should have clued me in that something
wasn’t setup right. I usually see this type of error when IIS tries to display an
error message in HTML, thinking that it’s a browser request. The WCF client application
isn’t expecting HTML, so it throws an error.
&lt;/p&gt;
&lt;p&gt;
It’s been awhile since I worked with WCF, and I forgot basic trouble shooting 101
for a couple of minutes, and finally remembered to just type in the URL to the .svc
file on the server. I was greeted with an IIS 7 error page that listed some pretty
good trouble shooting steps. The first one said to check the server handler mappings,
which I did, and noticed there were not mappings for .svc. I found a &lt;a href="http://blogs.msdn.com/nikola/archive/2008/03/06/configuring-iis-7-to-work-with-wcf-web-services-for-silverlight-2-beta-1-scenario.aspx"&gt;blog
post on wcf and silverlight&lt;/a&gt;, which explained how to enable WCF on IIS 7. 
&lt;/p&gt;
&lt;p&gt;
Now I had installed WCF (.net 3.0) via the features section of server manger in Server
2008, but I guess that doesn’t actually enable it to work with IIS 7. Maybe I didn’t
install something in the correct order. Fair enough, and the fix is simple. From a
command prompt (I ran mine with admin privileges under UAC), execute ServiceModelreg
-i in c:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation. Once
this was done, I went back to my handler mappings and saw entries for .svc.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
I’d like to note that the error messages returned by IIS 7 in the browser window (when
browsing from the web server itself), gives allot better error and diagnostics information
for trouble shooting. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=d2347534-bbda-4ad5-b6d3-c44446a80179" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,d2347534-bbda-4ad5-b6d3-c44446a80179.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=7f5987a2-d8cb-4294-9ffc-58bae5c48b11</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,7f5987a2-d8cb-4294-9ffc-58bae5c48b11.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,7f5987a2-d8cb-4294-9ffc-58bae5c48b11.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=7f5987a2-d8cb-4294-9ffc-58bae5c48b11</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
So I find my self downloading disc 1 and disc 2 of VB 6 enterprise edition from MSDN
subscriptions. I also downloaded the VB6 runtime files and SP6 for VB6.
</p>
        <p>
You may be wondering why I am doing this. I wrote, and sold a copy of an application
in a former life (or so it seems looking back to the year 2000), and I need to help
my “client” get the app up and running on a new PC. However, I have to make a few
tweaks in the VB6 code. I hope I still have all of the dependencies still.
</p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
This might actually motivate me to rewrite the app in .Net, something I have been
wanting to do since .Net came out, now almost 7 years ago I think.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=7f5987a2-d8cb-4294-9ffc-58bae5c48b11" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Going old school</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,7f5987a2-d8cb-4294-9ffc-58bae5c48b11.aspx</guid>
      <link>http://blog.salvoz.com/2008/06/19/GoingOldSchool.aspx</link>
      <pubDate>Thu, 19 Jun 2008 03:21:57 GMT</pubDate>
      <description>&lt;p&gt;
So I find my self downloading disc 1 and disc 2 of VB 6 enterprise edition from MSDN
subscriptions. I also downloaded the VB6 runtime files and SP6 for VB6.
&lt;/p&gt;
&lt;p&gt;
You may be wondering why I am doing this. I wrote, and sold a copy of an application
in a former life (or so it seems looking back to the year 2000), and I need to help
my “client” get the app up and running on a new PC. However, I have to make a few
tweaks in the VB6 code. I hope I still have all of the dependencies still.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
This might actually motivate me to rewrite the app in .Net, something I have been
wanting to do since .Net came out, now almost 7 years ago I think.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=7f5987a2-d8cb-4294-9ffc-58bae5c48b11" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,7f5987a2-d8cb-4294-9ffc-58bae5c48b11.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=e5ed49c7-d8ac-4867-88a9-8bcd1175d3f5</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,e5ed49c7-d8ac-4867-88a9-8bcd1175d3f5.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,e5ed49c7-d8ac-4867-88a9-8bcd1175d3f5.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e5ed49c7-d8ac-4867-88a9-8bcd1175d3f5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.lhotka.net/cslanet/Default.aspx">CLSA</a> 3.5 is getting closer
to release, with a beta <a href="http://www.lhotka.net/weblog/CSLANET35Beta2NowAvailable.aspx">announced</a> this
past weekend. CSLA 3.5 will be for .Net 3.5 and Visual Studio 2008 only. There is
a 3.04 maintenance release which still targets .Net 2.0 that is coming out soon.
</p>
        <p>
Announced earlier today, is a new way to write properties in CSLA, which Rocky refers
to as <a href="http://www.lhotka.net/weblog/CSLANET35PropertyCodeReduction.aspx">property
code reduction</a>. Having worked with CSLA since version 1.0, I see this mainly as
a welcome relief. My hesitation is in the fact that Rocky identifies a performance
hit when using the fully reduced property declaration code. Adding an additional line
which declares the backing variable (member variable, field, etc) alleviates this
somewhat. Another way in which code is reduced is in the addition of child property
management by CSLA. In the past you needed to override IsValid and IsDirty, and now
CSLA handles this for you.
</p>
        <p>
I love less code, truly I do, but I have attempted to implement stuff in the past
with the good intention of less code, only to create something that didn't work out
so well. Usually this involved an over use of reflection, where code generation would
have worked just as well. I'm certainly not trying to compare my code writing skill
to Rocky's, but I wonder if this is a case of programmers getting lazy? Well, I use
code generation, so I guess that could be considered lazy as well. I guess the best
thing to take away from this is, make sure you evaluate and inform your users (which
Rocky has) of changes that save you, the programmer time. In the end the customer
doesn't care if it took you 5 lines or 10 lines to implement a property, they just
want their application to work.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=e5ed49c7-d8ac-4867-88a9-8bcd1175d3f5" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>CSLA 3.5 getting closer</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,e5ed49c7-d8ac-4867-88a9-8bcd1175d3f5.aspx</guid>
      <link>http://blog.salvoz.com/2008/02/29/CSLA35GettingCloser.aspx</link>
      <pubDate>Fri, 29 Feb 2008 04:58:21 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://www.lhotka.net/cslanet/Default.aspx"&gt;CLSA&lt;/a&gt; 3.5 is getting closer
to release, with a beta &lt;a href="http://www.lhotka.net/weblog/CSLANET35Beta2NowAvailable.aspx"&gt;announced&lt;/a&gt; this
past weekend. CSLA 3.5 will be for .Net 3.5 and Visual Studio 2008 only. There is
a 3.04 maintenance release which still targets .Net 2.0 that is coming out soon.
&lt;/p&gt;
&lt;p&gt;
Announced earlier today, is a new way to write properties in CSLA, which Rocky refers
to as &lt;a href="http://www.lhotka.net/weblog/CSLANET35PropertyCodeReduction.aspx"&gt;property
code reduction&lt;/a&gt;. Having worked with CSLA since version 1.0, I see this mainly as
a welcome relief. My hesitation is in the fact that Rocky identifies a performance
hit when using the fully reduced property declaration code. Adding an additional line
which declares the backing variable (member variable, field, etc) alleviates this
somewhat. Another way in which code is reduced is in the addition of child property
management by CSLA. In the past you needed to override IsValid and IsDirty, and now
CSLA handles this for you.
&lt;/p&gt;
&lt;p&gt;
I love less code, truly I do, but I have attempted to implement stuff in the past
with the good intention of less code, only to create something that didn't work out
so well. Usually this involved an over use of reflection, where code generation would
have worked just as well. I'm certainly not trying to compare my code writing skill
to Rocky's, but I wonder if this is a case of programmers getting lazy? Well, I use
code generation, so I guess that could be considered lazy as well. I guess the best
thing to take away from this is, make sure you evaluate and inform your users (which
Rocky has) of changes that save you, the programmer time. In the end the customer
doesn't care if it took you 5 lines or 10 lines to implement a property, they just
want their application to work.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=e5ed49c7-d8ac-4867-88a9-8bcd1175d3f5" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,e5ed49c7-d8ac-4867-88a9-8bcd1175d3f5.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=6b041c2d-d0a7-43b3-9d88-6fe943da117d</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,6b041c2d-d0a7-43b3-9d88-6fe943da117d.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,6b041c2d-d0a7-43b3-9d88-6fe943da117d.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=6b041c2d-d0a7-43b3-9d88-6fe943da117d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
ScottGu posted over the weekend about <a href="http://weblogs.asp.net/scottgu/archive/2008/02/22/first-look-at-silverlight-2.aspx">Silverlight
2</a>, and even though I will be away from the web scene for awhile while working
on my current project, I am still excited. There are links to 8 Silverlight 2 tutorials. 
Key features include:
</p>
        <ul>
          <li>
            <strong>WPF UI Framework:</strong> This is a compatible subset of the WinForms WPF
framework. You should be able to re-use controls written in Silverlight 2.0 in your
WPF projects. Some WPF controls may not be compatible, and hopefully control creators
will try to target both frameworks.</li>
          <li>
            <strong>Rich Controls:</strong> TextBox, CheckBox, RadioButton, StackPanel, Grid,
Panel, Slider, ScrollViewer, Calendar, DatePicker, DataGrid, ListBox were listed in
Scott's post. 
</li>
          <li>
            <strong>Rich Networking Support: </strong>Out of the box support for REST, WS*/SOAP,
PX, RSS and HTTP. You can access resources on the web, and there is also built in
support for sockets.</li>
          <li>
            <strong>Rich Base Class Library: </strong>A compatible subset of the base class library
including collections, IO, generics, threading, globalization, XML as well as LINQ
and LINQ to XML. 
</li>
        </ul>
        <p>
Now the question is, what ever happened with Silverlight on the Compact Framework?
If you remember from Mix 07, during the MLB demo, the presenter showed off a "Silverlight"
application running on a Smart Phone (see this <a href="http://blogs.msdn.com/robunoki/archive/2007/05/01/silverlight-and-the-compact-framework.aspx">blog
post</a> for some details). Is it any coincidence that this Silverlight 2 announcement
happens only weeks before Mix 08 and painfully leaves out any compact framework details?
Scott uses the phrase compatible subset in two places when describing the features
of Silverlight 2.0. Compatible Subset is an interesting choice of words, as you could
describe the Compact Framework in that way as well. Should I really be getting this
excited in thinking that Silverlight 2 will be released for the Compact Framework
when we having even seen a 1.x build that runs on it? 
</p>
        <p>
Yes. Maybe I'll be disappointed, but I will be keeping a very, very close eye on the
Mix 08 conference. Larry has a great post up entitled <a href="http://larryclarkin.com/2008/02/21/5ThingsToDoIfYouAreNotGoingToMIX.aspx">5
things to do if you are not going to MIX</a>. If you are stuck in the middle of a
frozen wasteland like Larry and I (well maybe not wasteland, but compared to Vegas,
the upper Midwest leaves something to be desired right now), or can't attend MIX for
any reason, I suggest you read up on how to make the most of MIX as a "virtual" attendee.
So set your outlook calendar to out of office for Mach 5-7th. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=6b041c2d-d0a7-43b3-9d88-6fe943da117d" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Silverlight 2.0</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,6b041c2d-d0a7-43b3-9d88-6fe943da117d.aspx</guid>
      <link>http://blog.salvoz.com/2008/02/25/Silverlight20.aspx</link>
      <pubDate>Mon, 25 Feb 2008 01:25:22 GMT</pubDate>
      <description>&lt;p&gt;
ScottGu posted over the weekend about &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/02/22/first-look-at-silverlight-2.aspx"&gt;Silverlight
2&lt;/a&gt;, and even though I will be away from the web scene for awhile while working
on my current project, I am still excited. There are links to 8 Silverlight 2 tutorials.&amp;nbsp;
Key features include:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;WPF UI Framework:&lt;/strong&gt; This is a compatible subset of the WinForms WPF
framework. You should be able to re-use controls written in Silverlight 2.0 in your
WPF projects. Some WPF controls may not be compatible, and hopefully control creators
will try to target both frameworks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rich Controls:&lt;/strong&gt; TextBox, CheckBox, RadioButton, StackPanel, Grid,
Panel, Slider, ScrollViewer, Calendar, DatePicker, DataGrid, ListBox were listed in
Scott's post. 
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rich Networking Support: &lt;/strong&gt;Out of the box support for REST, WS*/SOAP,
PX, RSS and HTTP. You can access resources on the web, and there is also built in
support for sockets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rich Base Class Library: &lt;/strong&gt;A compatible subset of the base class library
including collections, IO, generics, threading, globalization, XML as well as LINQ
and LINQ to XML. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Now the question is, what ever happened with Silverlight on the Compact Framework?
If you remember from Mix 07, during the MLB demo, the presenter showed off a "Silverlight"
application running on a Smart Phone (see this &lt;a href="http://blogs.msdn.com/robunoki/archive/2007/05/01/silverlight-and-the-compact-framework.aspx"&gt;blog
post&lt;/a&gt; for some details). Is it any coincidence that this Silverlight 2 announcement
happens only weeks before Mix 08 and painfully leaves out any compact framework details?
Scott uses the phrase compatible subset in two places when describing the features
of Silverlight 2.0. Compatible Subset is an interesting choice of words, as you could
describe the Compact Framework in that way as well. Should I really be getting this
excited in thinking that Silverlight 2 will be released for the Compact Framework
when we having even seen a 1.x build that runs on it? 
&lt;/p&gt;
&lt;p&gt;
Yes. Maybe I'll be disappointed, but I will be keeping a very, very close eye on the
Mix 08 conference. Larry has a great post up entitled &lt;a href="http://larryclarkin.com/2008/02/21/5ThingsToDoIfYouAreNotGoingToMIX.aspx"&gt;5
things to do if you are not going to MIX&lt;/a&gt;. If you are stuck in the middle of a
frozen wasteland like Larry and I (well maybe not wasteland, but compared to Vegas,
the upper Midwest leaves something to be desired right now), or can't attend MIX for
any reason, I suggest you read up on how to make the most of MIX as a "virtual" attendee.
So set your outlook calendar to out of office for Mach 5-7th. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=6b041c2d-d0a7-43b3-9d88-6fe943da117d" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,6b041c2d-d0a7-43b3-9d88-6fe943da117d.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=065f279c-f3c9-4c44-bdab-5e36ec1182b3</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,065f279c-f3c9-4c44-bdab-5e36ec1182b3.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,065f279c-f3c9-4c44-bdab-5e36ec1182b3.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=065f279c-f3c9-4c44-bdab-5e36ec1182b3</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Three items were the focus of my attention today. Well, rather 2, and the 3rd I just
saw over on daily tech and it got me very excited.
</p>
        <p>
          <strong>MSF for CMMI</strong>
        </p>
        <p>
I have been reviewing the process guidance for MSF for CMMI version 4.2 which ships
with TFS 2008. I plan on using this process as the foundation on my next software
development project. While out of the box it is a bit of an overkill for my team,
project and company, I prefer to start with more (process) and remove what I don't
need. I also feel that CMMI is a great compromise between management, who is used
too, and wants a more traditional software development approach, and the developers,
such as my self who are advocating a more agile process.
</p>
        <p>
The great thing about MSF for CMMI is that it is written around agile concepts, yet
still has processes in place for oversight. The process guidance, is written in HTML,
making it very easy to edit and customize it after the project is created to meet
your needs. There is a way to edit the template so that it generates the new project
to meet your needs, but I figure this way is easier for the first go around. 
</p>
        <p>
My plan is to make changes to the HTML as needed, and then create a new template.
In addition to tracking my changes, you can use a tool like <a href="http://winmerge.org/">WinMerge</a> to
compare your modified document library with a default one. You can access a document
library via <a href="http://www.endusersharepoint.com/?p=56">windows explorer</a> by
going to the document library and choosing open in explorer from the actions menu.
This creates a UNC path in the form of <a href="file://\\SharepointServer\Sites\SiteName\">\\SharepointServer\Sites\SiteName\</a>Process
Guidance, which you can supply to WinMerge.
</p>
        <p>
I have spent some time going over the default tasks that are created with a new CMMI
based project to see what workstreams and activities they relate to, and I think I
have a pretty good handle on the first two tracks. I plan on documenting this in a
future post.
</p>
        <p>
          <strong>Requirements</strong>
        </p>
        <p>
Oil and Water, Superman and Kryponite, Me and Requirements. I am having some difficulties
in creating a formal software requirements specification, using this <a href="http://www.amazon.com/Software-Requirements-Karl-E-Wiegers/dp/0735606315">book</a> as
a guide. It's not the books fault (although I wish it hand an end to end case study
of a project), but rather a differing of opinion on some of the definitions (which
that end to end case study might help with). 
</p>
        <ul>
          <li>
Where is the line between Use Cases and Functional Requirements? Use cases look a
lot like test plans to some people, and have a tendency to add test plan like information
to them, which I feel is incorrect. 
</li>
          <li>
Where is the line between systems and users in the use cases? 
</li>
          <li>
How much detail is the right amount of detail?</li>
        </ul>
        <p>
Similar to my quest to gain a better understanding in the use of TFS and the MSF for
CMMI, I'm going to have to put some time into researching (primarily looking for examples)
software requirements. In addition to the book, which we now have 6 copies of at work,
I found this <a href="http://www.stcsig.org/mgt/reference.htm">website</a> with some
additional templates, as well as fairly detailed <a href="http://www.techwr-l.com/techwhirl/magazine/writing/softwarerequirementspecs.html">article</a> on
writing requirements from the perspective of a technical writer. There appear to be
some good articles over at wikipedia as well, such as <a href="http://en.wikipedia.org/wiki/Requirements_analysis">Requirements
Analysis</a> and <a href="http://en.wikipedia.org/wiki/Use_case">Use Cases</a>, and <a href="http://en.wikipedia.org/wiki/Use_case_diagram">Use
Case Diagrams</a>. Someone today asked the question about how do all the use cases
get related, and I believe the answer is the use case diagram (at least one use for
a use case diagram), as illustrated in the example on Wikipedia. 
</p>
        <p>
I hope to be able to report back with some answers to my questions sometime in the
future.
</p>
        <p>
          <strong>NVidia Application Processor</strong>
        </p>
        <p>
Daily Tech had an <a href="http://www.dailytech.com/article.aspx?newsid=10650">article</a> on
the NVidia <a href="http://www.nvidia.com/object/io_1202741043286.html">APX 2500 application
processor</a> which is designed to add hi-def capabilities to mobile devices. The
article states that NVidia has been working with Microsoft, so once can assume (as
does the author of the article), that this is destined for a Windows Mobile application. 
</p>
        <p>
I've really been giving my HTC Mogul a <a href="http://blog.salvoz.com/2008/02/03/CookedROMsOnTheHTCMogulTitan6800Etc.aspx">work
out</a> and have always wanted a all in one device (video, mp3, phone, PDA, etc),
so I am very excited about this. Since I have a bias against Apple, I am not a fan
of the iPhone, although I can appreciate and respect what it is. This gives me some
hope that my next Windows Mobile phone will be a force to be rekon with. 
</p>
        <p>
In addition to smart phones, I can also see this making it's way to other embedded
systems, especially something like a mall kiosk. This brings me to the second reason
that I am excited, and that is, my current software project is all about embedded
systems running Windows CE. I have some future customer requirements that could take
advantage of the functionality provided by this chip.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=065f279c-f3c9-4c44-bdab-5e36ec1182b3" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>MSF for CMMI, Requirements, and NVidia Application Processor</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,065f279c-f3c9-4c44-bdab-5e36ec1182b3.aspx</guid>
      <link>http://blog.salvoz.com/2008/02/13/MSFForCMMIRequirementsAndNVidiaApplicationProcessor.aspx</link>
      <pubDate>Wed, 13 Feb 2008 05:14:14 GMT</pubDate>
      <description>&lt;p&gt;
Three items were the focus of my attention today. Well, rather 2, and the 3rd I just
saw over on daily tech and it got me very excited.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;MSF for CMMI&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I have been reviewing the process guidance for MSF for CMMI version 4.2 which ships
with TFS 2008. I plan on using this process as the foundation on my next software
development project. While out of the box it is a bit of an overkill for my team,
project and company, I prefer to start with more (process) and remove what I don't
need. I also feel that CMMI is a great compromise between management, who is used
too, and wants a more traditional software development approach, and the developers,
such as my self who are advocating a more agile process.
&lt;/p&gt;
&lt;p&gt;
The great thing about MSF for CMMI is that it is written around agile concepts, yet
still has processes in place for oversight. The process guidance, is written in HTML,
making it very easy to edit and customize it after the project is created to meet
your needs. There is a way to edit the template so that it generates the new project
to meet your needs, but I figure this way is easier for the first go around. 
&lt;/p&gt;
&lt;p&gt;
My plan is to make changes to the HTML as needed, and then create a new template.
In addition to tracking my changes, you can use a tool like &lt;a href="http://winmerge.org/"&gt;WinMerge&lt;/a&gt; to
compare your modified document library with a default one. You can access a document
library via &lt;a href="http://www.endusersharepoint.com/?p=56"&gt;windows explorer&lt;/a&gt; by
going to the document library and choosing open in explorer from the actions menu.
This creates a UNC path in the form of &lt;a href="file://\\SharepointServer\Sites\SiteName\"&gt;\\SharepointServer\Sites\SiteName\&lt;/a&gt;Process
Guidance, which you can supply to WinMerge.
&lt;/p&gt;
&lt;p&gt;
I have spent some time going over the default tasks that are created with a new CMMI
based project to see what workstreams and activities they relate to, and I think I
have a pretty good handle on the first two tracks. I plan on documenting this in a
future post.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Requirements&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Oil and Water, Superman and Kryponite, Me and Requirements. I am having some difficulties
in creating a formal software requirements specification, using this &lt;a href="http://www.amazon.com/Software-Requirements-Karl-E-Wiegers/dp/0735606315"&gt;book&lt;/a&gt; as
a guide. It's not the books fault (although I wish it hand an end to end case study
of a project), but rather a differing of opinion on some of the definitions (which
that end to end case study might help with). 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Where is the line between Use Cases and Functional Requirements? Use cases look a
lot like test plans to some people, and have a tendency to add test plan like information
to them, which I feel is incorrect. 
&lt;/li&gt;
&lt;li&gt;
Where is the line between systems and users in the use cases? 
&lt;/li&gt;
&lt;li&gt;
How much detail is the right amount of detail?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Similar to my quest to gain a better understanding in the use of TFS and the MSF for
CMMI, I'm going to have to put some time into researching (primarily looking for examples)
software requirements. In addition to the book, which we now have 6 copies of at work,
I found this &lt;a href="http://www.stcsig.org/mgt/reference.htm"&gt;website&lt;/a&gt; with some
additional templates, as well as fairly detailed &lt;a href="http://www.techwr-l.com/techwhirl/magazine/writing/softwarerequirementspecs.html"&gt;article&lt;/a&gt; on
writing requirements from the perspective of a technical writer. There appear to be
some good articles over at wikipedia as well, such as &lt;a href="http://en.wikipedia.org/wiki/Requirements_analysis"&gt;Requirements
Analysis&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Use_case"&gt;Use Cases&lt;/a&gt;, and &lt;a href="http://en.wikipedia.org/wiki/Use_case_diagram"&gt;Use
Case Diagrams&lt;/a&gt;. Someone today asked the question about how do all the use cases
get related, and I believe the answer is the use case diagram (at least one use for
a use case diagram), as illustrated in the example on Wikipedia. 
&lt;/p&gt;
&lt;p&gt;
I hope to be able to report back with some answers to my questions sometime in the
future.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;NVidia Application Processor&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Daily Tech had an &lt;a href="http://www.dailytech.com/article.aspx?newsid=10650"&gt;article&lt;/a&gt; on
the NVidia &lt;a href="http://www.nvidia.com/object/io_1202741043286.html"&gt;APX 2500 application
processor&lt;/a&gt; which is designed to add hi-def capabilities to mobile devices. The
article states that NVidia has been working with Microsoft, so once can assume (as
does the author of the article), that this is destined for a Windows Mobile application. 
&lt;/p&gt;
&lt;p&gt;
I've really been giving my HTC Mogul a &lt;a href="http://blog.salvoz.com/2008/02/03/CookedROMsOnTheHTCMogulTitan6800Etc.aspx"&gt;work
out&lt;/a&gt; and have always wanted a all in one device (video, mp3, phone, PDA, etc),
so I am very excited about this. Since I have a bias against Apple, I am not a fan
of the iPhone, although I can appreciate and respect what it is. This gives me some
hope that my next Windows Mobile phone will be a force to be rekon with. 
&lt;/p&gt;
&lt;p&gt;
In addition to smart phones, I can also see this making it's way to other embedded
systems, especially something like a mall kiosk. This brings me to the second reason
that I am excited, and that is, my current software project is all about embedded
systems running Windows CE. I have some future customer requirements that could take
advantage of the functionality provided by this chip.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=065f279c-f3c9-4c44-bdab-5e36ec1182b3" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,065f279c-f3c9-4c44-bdab-5e36ec1182b3.aspx</comments>
      <category>Technology/Programming</category>
      <category>Technology/Review For Future Projects</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=c776610b-c9fc-4e26-8be1-1e6b29dba15f</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,c776610b-c9fc-4e26-8be1-1e6b29dba15f.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,c776610b-c9fc-4e26-8be1-1e6b29dba15f.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c776610b-c9fc-4e26-8be1-1e6b29dba15f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I am adding my name to the list of developers who have not heard about the <a href="http://devlicio.us/blogs/derik_whittaker/archive/2007/04/09/internalsvisibleto-testing-internal-methods-in-net-2-0.aspx">InternalVisibleTo</a> attribute.
I came across this while checking out <a href="http://devlicio.us/blogs/derik_whittaker/">Derik
Whittaker's</a> blog in response to the email I got saying that Derik will be presenting
at this month's <a href="http://www.wi-ineta.org/DesktopDefault.aspx?tabid=1">Milwaukee
area .Net Users Group</a>.
</p>
        <p>
The InternalVisibleToAttribute was added in .Net 2.0 and most people seem to be using
it in order expose internal methods to external unit test classes. However, there
is nothing to prevent you from using it in non-testing situations., although I have
not seen a good reason other then unit testing to use it. 
</p>
        <p>
The MSDN <a href="http://msdn2.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx">documentation</a> talks
about the special case of applying the attribute to a strong named friend assembly.
This is also a C# only attribute.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=c776610b-c9fc-4e26-8be1-1e6b29dba15f" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>C# InternalVisibleTo Attribute</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,c776610b-c9fc-4e26-8be1-1e6b29dba15f.aspx</guid>
      <link>http://blog.salvoz.com/2008/02/09/CInternalVisibleToAttribute.aspx</link>
      <pubDate>Sat, 09 Feb 2008 19:33:18 GMT</pubDate>
      <description>&lt;p&gt;
I am adding my name to the list of developers who have not heard about the &lt;a href="http://devlicio.us/blogs/derik_whittaker/archive/2007/04/09/internalsvisibleto-testing-internal-methods-in-net-2-0.aspx"&gt;InternalVisibleTo&lt;/a&gt; attribute.
I came across this while checking out &lt;a href="http://devlicio.us/blogs/derik_whittaker/"&gt;Derik
Whittaker's&lt;/a&gt; blog in response to the email I got saying that Derik will be presenting
at this month's &lt;a href="http://www.wi-ineta.org/DesktopDefault.aspx?tabid=1"&gt;Milwaukee
area .Net Users Group&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The InternalVisibleToAttribute was added in .Net 2.0 and most people seem to be using
it in order expose internal methods to external unit test classes. However, there
is nothing to prevent you from using it in non-testing situations., although I have
not seen a good reason other then unit testing to use it. 
&lt;/p&gt;
&lt;p&gt;
The MSDN &lt;a href="http://msdn2.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx"&gt;documentation&lt;/a&gt; talks
about the special case of applying the attribute to a strong named friend assembly.
This is also a C# only attribute.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=c776610b-c9fc-4e26-8be1-1e6b29dba15f" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,c776610b-c9fc-4e26-8be1-1e6b29dba15f.aspx</comments>
      <category>Technology/Programming</category>
      <category>Technology/Tools</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=61d45a69-647e-4321-b6e9-d7590c5d10eb</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,61d45a69-647e-4321-b6e9-d7590c5d10eb.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,61d45a69-647e-4321-b6e9-d7590c5d10eb.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=61d45a69-647e-4321-b6e9-d7590c5d10eb</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.hanselman.com/blog/">Scott Hanselman</a> today <a href="http://www.hanselman.com/blog/ASPNETWikiBeta.aspx">announced</a> the
Asp.Net <a href="http://wiki.asp.net/">Wiki</a> (Beta).
</p>
        <blockquote>
          <p>
"The idea is that folks spend a lot of time trolling the blogs, <strike>googling</strike> live-searching
for answers to common "How To" questions. There's piles of fantastic community-created
and MSFT-created content out there, but if it's not found by a search engine and the
right combination of keywords, it's often lost."
</p>
        </blockquote>
        <p>
I think it's a great idea and I hope to see other product groups at Microsoft follow
suit. Since it's linked off <a href="http://www.asp.net">http://www.asp.net</a>, and
a Microsoft entity, I see it quickly becoming the one stop shop for Asp.Net information.
</p>
        <p>
If you jump on and contribute to the wiki right now, you could be a top contributor,
at least for a couple of days. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=61d45a69-647e-4321-b6e9-d7590c5d10eb" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Asp.Net Wiki</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,61d45a69-647e-4321-b6e9-d7590c5d10eb.aspx</guid>
      <link>http://blog.salvoz.com/2008/02/08/AspNetWiki.aspx</link>
      <pubDate>Fri, 08 Feb 2008 23:34:45 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://www.hanselman.com/blog/"&gt;Scott Hanselman&lt;/a&gt; today &lt;a href="http://www.hanselman.com/blog/ASPNETWikiBeta.aspx"&gt;announced&lt;/a&gt; the
Asp.Net &lt;a href="http://wiki.asp.net/"&gt;Wiki&lt;/a&gt; (Beta).
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
"The idea is that folks spend a lot of time trolling the blogs, &lt;strike&gt;googling&lt;/strike&gt; live-searching
for answers to common "How To" questions. There's piles of fantastic community-created
and MSFT-created content out there, but if it's not found by a search engine and the
right combination of keywords, it's often lost."
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
I think it's a great idea and I hope to see other product groups at Microsoft follow
suit. Since it's linked off &lt;a href="http://www.asp.net"&gt;http://www.asp.net&lt;/a&gt;, and
a Microsoft entity, I see it quickly becoming the one stop shop for Asp.Net information.
&lt;/p&gt;
&lt;p&gt;
If you jump on and contribute to the wiki right now, you could be a top contributor,
at least for a couple of days. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=61d45a69-647e-4321-b6e9-d7590c5d10eb" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,61d45a69-647e-4321-b6e9-d7590c5d10eb.aspx</comments>
      <category>Technology</category>
      <category>Technology/Programming</category>
      <category>Technology/Review For Future Projects</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=4092e306-c7ec-42a3-aef5-12ddc8cf66ca</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,4092e306-c7ec-42a3-aef5-12ddc8cf66ca.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,4092e306-c7ec-42a3-aef5-12ddc8cf66ca.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=4092e306-c7ec-42a3-aef5-12ddc8cf66ca</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
ScottGu's latest blog <a href="http://weblogs.asp.net/scottgu/archive/2008/01/28/vs-2008-web-deployment-project-support-released.aspx">post</a> talks
about the VS 2008 web deployment project and the <a href="http://blogs.iis.net/msdeploy/archive/2008/01/22/welcome-to-the-web-deployment-team-blog.aspx">MS
Web Deployment Team blog</a>, which deals with a web deployment tool (not to be confused
with the VS 2008 project).
</p>
        <p>
I had to do a little digging, but found <a href="http://msdn2.microsoft.com/en-us/library/aa479568.aspx">this
white paper</a> on MSDN which explains the web deployment project for 2005. From the
abstract:
</p>
        <blockquote>
          <p>
Visual Studio 2005 provides deployment support through its Copy Web Site and Publish
Web Site features. While these are ideal for many scenarios, there are other, more
advanced scenarios where developers need the following capabilities: 
</p>
          <ul>
            <li>
More control over assembly naming and output. 
</li>
            <li>
Custom pre-processing and post-processing for the build. 
</li>
            <li>
The ability to exclude, add, and transform files and directories during builds. 
</li>
            <li>
The ability to modify the Web.config file to change database connection strings, application
settings, or the URLs for Web references, depending on the build configuration. (For
example, it might be necessary to use different values for development, test, staging,
and release settings). 
</li>
          </ul>
        </blockquote>
        <blockquote>
          <p>
            <a href="http://msdn2.microsoft.com/en-us/library/aa479568.aspx">this white paper</a> describes
a solution to these advanced scenarios and introduces a new feature called Web Deployment
Projects for Visual Studio 2005. 
</p>
        </blockquote>
        <p>
The web deployment tool on the other hand, is a stand alone tool (currently just a
command line utility called msdeply.exe), "that provides support for deploying, synchronizing
and migrating IIS 6.0 and 7.0."
</p>
        <blockquote>
          <p>
It supports moving configuration, content, SSL certificates and other types of data
associated with a web server. You can choose to sync a single site or the entire web
server. Because we know that one tool can never ‘automagically’ guess what your application
relies on, we’ve tried to be pretty flexible and powerful – you can customize exactly
what you want to sync using a manifest file. You can also skip sites or other objects,
or you can perform regular expression replacements during a sync (like changing the
home directory on the destination machine). 
</p>
          <p>
 
</p>
        </blockquote>
        <p>
These two new tools will help make deployment a lot easier and enable a more agile
environment. Unfortunately my project assignment at work has changed, so I won't be
getting direct exposure to these.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=4092e306-c7ec-42a3-aef5-12ddc8cf66ca" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>New Web Deployment Tools</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,4092e306-c7ec-42a3-aef5-12ddc8cf66ca.aspx</guid>
      <link>http://blog.salvoz.com/2008/01/29/NewWebDeploymentTools.aspx</link>
      <pubDate>Tue, 29 Jan 2008 22:57:29 GMT</pubDate>
      <description>&lt;p&gt;
ScottGu's latest blog &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/01/28/vs-2008-web-deployment-project-support-released.aspx"&gt;post&lt;/a&gt; talks
about the VS 2008 web deployment project and the &lt;a href="http://blogs.iis.net/msdeploy/archive/2008/01/22/welcome-to-the-web-deployment-team-blog.aspx"&gt;MS
Web Deployment Team blog&lt;/a&gt;, which deals with a web deployment tool (not to be confused
with the VS 2008 project).
&lt;/p&gt;
&lt;p&gt;
I had to do a little digging, but found &lt;a href="http://msdn2.microsoft.com/en-us/library/aa479568.aspx"&gt;this
white paper&lt;/a&gt; on MSDN which explains the web deployment project for 2005. From the
abstract:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Visual Studio 2005 provides deployment support through its Copy Web Site and Publish
Web Site features. While these are ideal for many scenarios, there are other, more
advanced scenarios where developers need the following capabilities: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
More control over assembly naming and output. 
&lt;li&gt;
Custom pre-processing and post-processing for the build. 
&lt;li&gt;
The ability to exclude, add, and transform files and directories during builds. 
&lt;li&gt;
The ability to modify the Web.config file to change database connection strings, application
settings, or the URLs for Web references, depending on the build configuration. (For
example, it might be necessary to use different values for development, test, staging,
and release settings). 
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/aa479568.aspx"&gt;this white paper&lt;/a&gt; describes
a solution to these advanced scenarios and introduces a new feature called Web Deployment
Projects for Visual Studio 2005. 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
The web deployment tool on the other hand, is a stand alone tool (currently just a
command line utility called msdeply.exe), "that provides support for deploying, synchronizing
and migrating IIS 6.0 and 7.0."
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
It supports moving configuration, content, SSL certificates and other types of data
associated with a web server. You can choose to sync a single site or the entire web
server. Because we know that one tool can never ‘automagically’ guess what your application
relies on, we’ve tried to be pretty flexible and powerful – you can customize exactly
what you want to sync using a manifest file. You can also skip sites or other objects,
or you can perform regular expression replacements during a sync (like changing the
home directory on the destination machine). 
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
These two new tools will help make deployment a lot easier and enable a more agile
environment. Unfortunately my project assignment at work has changed, so I won't be
getting direct exposure to these.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=4092e306-c7ec-42a3-aef5-12ddc8cf66ca" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,4092e306-c7ec-42a3-aef5-12ddc8cf66ca.aspx</comments>
      <category>Technology/Programming</category>
      <category>Technology/Tools</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=3c02fee4-4971-4d6d-b73e-9a4fadc372b5</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,3c02fee4-4971-4d6d-b73e-9a4fadc372b5.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,3c02fee4-4971-4d6d-b73e-9a4fadc372b5.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=3c02fee4-4971-4d6d-b73e-9a4fadc372b5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Wouldn't you know, by TFS warehouse is not updating. It seems like I have had this
problem <a href="http://blog.salvoz.com/2007/11/03/TFSWarehouseNotUpdatingAgain.aspx">before</a>,
but today, it was a new error.
</p>
        <p>
Today, I added 2 test projects to TFS, one for the MSF Agile (4.2) and one for MSF
CMMI (4.2) to reference while I read <a href="http://www.amazon.com/Software-Engineering-Microsoft-Visual-Development/dp/0321278720">Software
Engineering with Microsoft Visual Studio Team System</a> (thanks <a href="www.larryclarkin.com">Larry</a>).
I'm not even through chapter one and I am hooked on this book. Chapter 1 was talking
about the Reaming Work report, and I wanted to view it for the 2 test sites. 
</p>
        <p>
I was able to view the report for the MSF Agile site, but not the CMMI site. A quick
look at the reports via the Reporting Services web management UI, and I had a pretty
good guess that the warehouse was not updating because there were no iterations or
areas listed for those report parameters. 
</p>
        <p>
I went checked out the TfsWarehouse.dbo._WarehouseConfig table, and saw that, yes,
the warehouse stopped updating a couple of hours ago. My attempts to manually run
the update using the web services interface via IE didn't seem to work. Remembering
some of my previous troubleshooting, I went to the event log and found several errors,
starting around the time that I created the CMMI project. 
</p>
        <blockquote>
          <p>
Event Type:    Error<br />
Event Source:    TFS Warehouse<br />
Event Category:    None<br />
Event ID:    3000<br />
Date:        1/25/2008<br />
Time:        6:20:57 PM<br />
User:        N/A<br />
Computer:    [TFSServer]<br />
Description:<br />
TF53010: The following error has occurred in a Team Foundation component or extension:<br />
Date (UTC): 1/26/2008 12:20:57 AM<br />
Machine: DATFSP100<br />
Application Domain: /LM/W3SVC/1977639788/Root/Warehouse-4-128456993088380000<br />
Assembly: Microsoft.TeamFoundation.Warehouse, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;
v2.0.50727<br />
Process Details:<br />
  Process Name: w3wp<br />
  Process Id: 8512<br />
  Thread Id: 9920<br />
  Account name: [ServiceAccount] 
</p>
          <p>
Detailed Message: The pending configuration changes were not successfully added to
the cube because of the following error: System.Security.Principal.IdentityNotMappedException:
Some or all identity references could not be translated.<br />
   at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection
sourceAccounts, Type targetType, Boolean forceSuccess)<br />
   at System.Security.Principal.NTAccount.Translate(Type targetType)<br />
   at Microsoft.TeamFoundation.Warehouse.OlapCreator.AddAccountToRole(Role
role, String accountName, Boolean needToUpdate)<br />
   at Microsoft.TeamFoundation.Warehouse.OlapCreator.SetupAnalysisDatabase(Server
server, String analysisDBName, String accessUser, String[] dataReaderAccounts)<br />
   at Microsoft.TeamFoundation.Warehouse.OlapCreator.CreateOlap(WarehouseConfig
whConf, String accessUser, String[] dataReaderAccounts, Boolean dropDB, Boolean processCube)<br />
   at Microsoft.TeamFoundation.Warehouse.AdapterScheduler.EnsureCubeIsUpToDate() 
</p>
          <p>
For more information, see Help and Support Center at <a href="http://go.microsoft.com/fwlink/events.asp">http://go.microsoft.com/fwlink/events.asp</a>.
</p>
        </blockquote>
        <p>
So started my Google Search. I came across a post on the MSDN forums which had some
code to check to see if account translation is working on the network, and it appears
to be (I got a SID value back for both my tfs service and tfs reports account) 
</p>
        <p>
 
</p>
        <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
          <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; 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 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: #606060"> 1:</span>
              <span style="color: #0000ff">using</span> System;</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: #606060"> 2:</span>
              <span style="color: #0000ff">using</span> System.IO;</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: #606060"> 3:</span>
              <span style="color: #0000ff">using</span> System.Text;</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: #606060"> 4:</span>
              <span style="color: #0000ff">using</span> System.Xml;</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: #606060"> 5:</span>
              <span style="color: #0000ff">using</span> System.Xml.Serialization;</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: #606060"> 6:</span>
              <span style="color: #0000ff">using</span> System.Threading;</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: #606060"> 7:</span>
              <span style="color: #0000ff">using</span> System.Security.Principal;</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: #606060"> 8:</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: #606060"> 9:</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: #606060"> 10:</span>
              <span style="color: #0000ff">namespace</span> CheckAccountForTfs</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: #606060"> 11:</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: #606060"> 12:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">class</span> Program</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: #606060"> 13:</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: #606060"> 14:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">static</span>
              <span style="color: #0000ff">void</span> Main(<span style="color: #0000ff">string</span>[]
args)</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: #606060"> 15:</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: #606060"> 16:</span>
              <span style="color: #0000ff">try</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: #606060"> 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: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 18:</span>
              <span style="color: #0000ff">string</span> accountName
= args[0];</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: #606060"> 19:</span> Console.WriteLine(<span style="color: #0000ff">new</span> NTAccount(accountName).Translate(<span style="color: #0000ff">typeof</span>(SecurityIdentifier)).Value);</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: #606060"> 20:</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: #606060"> 21:</span>
              <span style="color: #0000ff">catch</span> (Exception
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: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 22:</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: #606060"> 23:</span> Console.WriteLine(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: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 24:</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: #606060"> 25:</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: #606060"> 26:</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: #606060"> 27:</span> }</pre>
          </div>
        </div>
        <p>
 
</p>
        <p>
Continuing my Google search, I found something embarrassing, I had the same exception
for TFS listed on a previous <a href="http://blog.salvoz.com/2007/10/23/TFS2008TheSagaContinues.aspx">post</a>,
on my very own blog. My solution last time was to run (Make sure you replace Server
with your TFS server name, as well as use FQDN for the service and reports account).
</p>
        <blockquote>
          <p>
setupwarehouse -o -s Server -d TfsWarehouse -c Warehouseschema.xml -a Domain\TfsService
-ra Domain\TfsReports -v -mturl <a href="http://Server:8080">http://Server:8080</a> -rebuild
</p>
        </blockquote>
        <p>
I did not remove the TFSWarehouse from Analysis Server before running this command.
Also, the setupwarehouse command is in %Program Files%\Microsoft Visual Studio 2008
Team Foundation Server\Tools.
</p>
        <p>
Eureka, manually invoking the warehouse job from the web service via IE actually starting
processing, and with no errors in the Event Log. Looks like I might have to create
a batch script to keep on the TFS server in case this happens again. I also need to
search my own blog a little more carefully next time. 
</p>
        <p>
While I was trying to get the Remaining Work report to display initially, I somehow
managed to mess up the parameter definition for Iteration and Area. I fixed this by
saving the report (Go to the report's properties and click edit), along with another
report with the at least those 2 parameters. Once saved as a text file, I copied the
ReportParam element for both parameters from the good report to the bad report, then
uploaded the fixed report back to reporting services. Problem solved.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=3c02fee4-4971-4d6d-b73e-9a4fadc372b5" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>TFS Warehouse Issues</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,3c02fee4-4971-4d6d-b73e-9a4fadc372b5.aspx</guid>
      <link>http://blog.salvoz.com/2008/01/26/TFSWarehouseIssues.aspx</link>
      <pubDate>Sat, 26 Jan 2008 01:24:49 GMT</pubDate>
      <description>&lt;p&gt;
Wouldn't you know, by TFS warehouse is not updating. It seems like I have had this
problem &lt;a href="http://blog.salvoz.com/2007/11/03/TFSWarehouseNotUpdatingAgain.aspx"&gt;before&lt;/a&gt;,
but today, it was a new error.
&lt;/p&gt;
&lt;p&gt;
Today, I added 2 test projects to TFS, one for the MSF Agile (4.2) and one for MSF
CMMI (4.2) to reference while I read &lt;a href="http://www.amazon.com/Software-Engineering-Microsoft-Visual-Development/dp/0321278720"&gt;Software
Engineering with Microsoft Visual Studio Team System&lt;/a&gt; (thanks &lt;a href="www.larryclarkin.com"&gt;Larry&lt;/a&gt;).
I'm not even through chapter one and I am hooked on this book. Chapter 1 was talking
about the Reaming Work report, and I wanted to view it for the 2 test sites. 
&lt;/p&gt;
&lt;p&gt;
I was able to view the report for the MSF Agile site, but not the CMMI site. A quick
look at the reports via the Reporting Services web management UI, and I had a pretty
good guess that the warehouse was not updating because there were no iterations or
areas listed for those report parameters. 
&lt;/p&gt;
&lt;p&gt;
I went checked out the TfsWarehouse.dbo._WarehouseConfig table, and saw that, yes,
the warehouse stopped updating a couple of hours ago. My attempts to manually run
the update using the web services interface via IE didn't seem to work. Remembering
some of my previous troubleshooting, I went to the event log and found several errors,
starting around the time that I created the CMMI project. 
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Event Type:&amp;nbsp;&amp;nbsp;&amp;nbsp; Error&lt;br&gt;
Event Source:&amp;nbsp;&amp;nbsp;&amp;nbsp; TFS Warehouse&lt;br&gt;
Event Category:&amp;nbsp;&amp;nbsp;&amp;nbsp; None&lt;br&gt;
Event ID:&amp;nbsp;&amp;nbsp;&amp;nbsp; 3000&lt;br&gt;
Date:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/25/2008&lt;br&gt;
Time:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6:20:57 PM&lt;br&gt;
User:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; N/A&lt;br&gt;
Computer:&amp;nbsp;&amp;nbsp;&amp;nbsp; [TFSServer]&lt;br&gt;
Description:&lt;br&gt;
TF53010: The following error has occurred in a Team Foundation component or extension:&lt;br&gt;
Date (UTC): 1/26/2008 12:20:57 AM&lt;br&gt;
Machine: DATFSP100&lt;br&gt;
Application Domain: /LM/W3SVC/1977639788/Root/Warehouse-4-128456993088380000&lt;br&gt;
Assembly: Microsoft.TeamFoundation.Warehouse, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;
v2.0.50727&lt;br&gt;
Process Details:&lt;br&gt;
&amp;nbsp; Process Name: w3wp&lt;br&gt;
&amp;nbsp; Process Id: 8512&lt;br&gt;
&amp;nbsp; Thread Id: 9920&lt;br&gt;
&amp;nbsp; Account name: [ServiceAccount] 
&lt;p&gt;
Detailed Message: The pending configuration changes were not successfully added to
the cube because of the following error: System.Security.Principal.IdentityNotMappedException:
Some or all identity references could not be translated.&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection
sourceAccounts, Type targetType, Boolean forceSuccess)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Security.Principal.NTAccount.Translate(Type targetType)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at Microsoft.TeamFoundation.Warehouse.OlapCreator.AddAccountToRole(Role
role, String accountName, Boolean needToUpdate)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at Microsoft.TeamFoundation.Warehouse.OlapCreator.SetupAnalysisDatabase(Server
server, String analysisDBName, String accessUser, String[] dataReaderAccounts)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at Microsoft.TeamFoundation.Warehouse.OlapCreator.CreateOlap(WarehouseConfig
whConf, String accessUser, String[] dataReaderAccounts, Boolean dropDB, Boolean processCube)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at Microsoft.TeamFoundation.Warehouse.AdapterScheduler.EnsureCubeIsUpToDate() 
&lt;p&gt;
For more information, see Help and Support Center at &lt;a href="http://go.microsoft.com/fwlink/events.asp"&gt;http://go.microsoft.com/fwlink/events.asp&lt;/a&gt;.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
So started my Google Search. I came across a post on the MSDN forums which had some
code to check to see if account translation is working on the network, and it appears
to be (I got a SID value back for both my tfs service and tfs reports account) 
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; 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"&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.IO;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Xml;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Xml.Serialization;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Threading;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 7:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Security.Principal;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 8:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 9:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 10:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; CheckAccountForTfs&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 11:&lt;/span&gt; {&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 12:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Program&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 13:&lt;/span&gt; {&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 14:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[]
args)&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 15:&lt;/span&gt; {&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 16:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 17:&lt;/span&gt; {&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 18:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; accountName
= args[0];&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 19:&lt;/span&gt; Console.WriteLine(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; NTAccount(accountName).Translate(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(SecurityIdentifier)).Value);&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 20:&lt;/span&gt; }&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 21:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;catch&lt;/span&gt; (Exception
e)&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 22:&lt;/span&gt; {&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 23:&lt;/span&gt; Console.WriteLine(e);&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 24:&lt;/span&gt; }&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 25:&lt;/span&gt; }&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 26:&lt;/span&gt; }&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 27:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Continuing my Google search, I found something embarrassing, I had the same exception
for TFS listed on a previous &lt;a href="http://blog.salvoz.com/2007/10/23/TFS2008TheSagaContinues.aspx"&gt;post&lt;/a&gt;,
on my very own blog. My solution last time was to run (Make sure you replace Server
with your TFS server name, as well as use FQDN for the service and reports account).
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
setupwarehouse -o -s Server -d TfsWarehouse -c Warehouseschema.xml -a Domain\TfsService
-ra Domain\TfsReports -v -mturl &lt;a href="http://Server:8080"&gt;http://Server:8080&lt;/a&gt; -rebuild
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
I did not remove the TFSWarehouse from Analysis Server before running this command.
Also, the setupwarehouse command is in %Program Files%\Microsoft Visual Studio 2008
Team Foundation Server\Tools.
&lt;/p&gt;
&lt;p&gt;
Eureka, manually invoking the warehouse job from the web service via IE actually starting
processing, and with no errors in the Event Log. Looks like I might have to create
a batch script to keep on the TFS server in case this happens again. I also need to
search my own blog a little more carefully next time. 
&lt;/p&gt;
&lt;p&gt;
While I was trying to get the Remaining Work report to display initially, I somehow
managed to mess up the parameter definition for Iteration and Area. I fixed this by
saving the report (Go to the report's properties and click edit), along with another
report with the at least those 2 parameters. Once saved as a text file, I copied the
ReportParam element for both parameters from the good report to the bad report, then
uploaded the fixed report back to reporting services. Problem solved.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=3c02fee4-4971-4d6d-b73e-9a4fadc372b5" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,3c02fee4-4971-4d6d-b73e-9a4fadc372b5.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=69e35794-d750-4153-9212-520c101da82f</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,69e35794-d750-4153-9212-520c101da82f.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,69e35794-d750-4153-9212-520c101da82f.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=69e35794-d750-4153-9212-520c101da82f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I jumped back into some compact framework development this weekend, and it was the
first time since I had installed VS 2008 RTM. I went to connect to one of my CE devices
via Visual Studio 2005, and was unable to connect. I also tried the remote performance
monitor power toy. 
</p>
        <p>
I finally went to check on what version of the CoreCon files I had installed, and
noticed right away that there date modified was 11/7/2007. I coped these latest versions
over to my CE device, and was able to connect again. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=69e35794-d750-4153-9212-520c101da82f" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>New CoreCon with VS 2008 RTM</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,69e35794-d750-4153-9212-520c101da82f.aspx</guid>
      <link>http://blog.salvoz.com/2008/01/06/NewCoreConWithVS2008RTM.aspx</link>
      <pubDate>Sun, 06 Jan 2008 20:23:01 GMT</pubDate>
      <description>&lt;p&gt;
I jumped back into some compact framework development this weekend, and it was the
first time since I had installed VS 2008 RTM. I went to connect to one of my CE devices
via Visual Studio 2005, and was unable to connect. I also tried the remote performance
monitor power toy. 
&lt;/p&gt;
&lt;p&gt;
I finally went to check on what version of the CoreCon files I had installed, and
noticed right away that there date modified was 11/7/2007. I coped these latest versions
over to my CE device, and was able to connect again. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=69e35794-d750-4153-9212-520c101da82f" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,69e35794-d750-4153-9212-520c101da82f.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=cb26059c-074a-47ca-9fd6-bace1b0d2f12</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,cb26059c-074a-47ca-9fd6-bace1b0d2f12.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,cb26059c-074a-47ca-9fd6-bace1b0d2f12.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=cb26059c-074a-47ca-9fd6-bace1b0d2f12</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today's task, a somewhat detailed code analysis of one of our Windows CE projects.
In addition to reviewing from a lead architect point of view (design and implementation),
I also needed to take a look at general coding practices. For this I turned to the
Code Analysis tool in Visual Studio, and <a href="http://www.ndepend.com/">NDepend</a>.
</p>
        <p>
I had remembered reading about <a href="http://www.ndepend.com/">NDepend</a> on <a href="http://www.hanselman.com/blog/ExitingTheZoneOfPainStaticAnalysisWithNDepend.aspx">Scott's
blog</a>, and went back there to re-read his post. I highly recommend it, as it's
a great quick start and introduction to <a href="http://www.ndepend.com/">NDepend</a>.
Scott also has a pod cast available, and the the NDepend web site has links to several
video tutorials showing how to use it. 
</p>
        <p>
One thing I found lacking, was there were no support forums on the NDepend web site.
I had a couple of issues getting my Compact Framework application to be property recognized
by NDepend. The main issue, was NDepend was trying to use the full framework version
of System.Data instead of the Compact Framework version. I noticed that there was
an option when selecting assemblies to resolved missing ones (well, some it let me,
others it didn't), and figured the resolved location was stored in the project configuration
file. So I opened it up in note pad and sure enough, there were all the directory
paths.
</p>
        <p>
I removed all of the paths that were added by default, and added my own paths to my
project. I also added paths to the SQL CE 3.5 directory, as well as the location of
the compact framework dlls (See update below). Unfortunately I still had issues with
NDpend detecting multiple dlls (System.Data and System.Windows.Forms) with the same
name. I decided to remove the path statements for everything except my project. This
resulted in warning about not being able to resolve dependencies, but the analysis
completed. 
</p>
        <p>
There is allot of information presented, almost to the point of information overload.
I highly recommend printing out and reviewing the NDepend <a href="http://www.hanselman.com/blog/content/binary/NDepend%20metrics%20placemats%201.1.pdf">placemat</a> as
a quick reference. I concentrated primarily on the metrics, which use NDepend's Code
Query Language to identify possible problems. I found myself viewing all of the queries
to figure out what they were looking at. The documentation of the queries is excellent,
and each one includes a link to the NDepend web site which defines the metric is pretty
good detail. 
</p>
        <p>
I am quite impressed with the amount of information that NDepend gave me about my
project. There were/are a few usability issues, but they can be overcome. I hope that
I can continue to find time to make use of this excellent tool. I spent some time
watching the video tutorials, and they were very helpful. I've been trying to get
a side project started at home to try out all the tools, techniques, patterns, etc
that I don't have time for at work, and this will definitely find it's way onto my
to do list. I think it will be very interesting to use this from the beginning and
see how the different metrics change as I build out my project.
</p>
        <p>
          <strong>Update:</strong>
        </p>
        <ul>
          <li>
1/2/2008 - After watching the videos, I discovered that when you are setting up your
project in VisualNDepend, there is a screen that lest you add/remove directories in
the application. This is much easier then editing the project file manually like I
was initially doing. 
</li>
        </ul>
        <p>
          <strong>Other Links:</strong>
        </p>
        <ul>
          <li>
            <a href="http://www.amazon.com/Principles-Patterns-Practices-Robert-Martin/dp/0131857258/">Agile
Principles, Patterns, and Practices in C# by Robert C. Martin</a> - This book was
referenced on the NDepend web site when talking about metrics on assemblies. 
</li>
          <li>
NDepend <a href="http://www.ndepend.com/GettingStarted.aspx">Getting Started</a> page,
which links to video tutorials and additional references at the bottom.</li>
        </ul>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=cb26059c-074a-47ca-9fd6-bace1b0d2f12" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>NDepend</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,cb26059c-074a-47ca-9fd6-bace1b0d2f12.aspx</guid>
      <link>http://blog.salvoz.com/2008/01/01/NDepend.aspx</link>
      <pubDate>Tue, 01 Jan 2008 18:01:14 GMT</pubDate>
      <description>&lt;p&gt;
Today's task, a somewhat detailed code analysis of one of our Windows CE projects.
In addition to reviewing from a lead architect point of view (design and implementation),
I also needed to take a look at general coding practices. For this I turned to the
Code Analysis tool in Visual Studio, and &lt;a href="http://www.ndepend.com/"&gt;NDepend&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
I had remembered reading about &lt;a href="http://www.ndepend.com/"&gt;NDepend&lt;/a&gt; on &lt;a href="http://www.hanselman.com/blog/ExitingTheZoneOfPainStaticAnalysisWithNDepend.aspx"&gt;Scott's
blog&lt;/a&gt;, and went back there to re-read his post. I highly recommend it, as it's
a great quick start and introduction to &lt;a href="http://www.ndepend.com/"&gt;NDepend&lt;/a&gt;.
Scott also has a pod cast available, and the the NDepend web site has links to several
video tutorials showing how to use it. 
&lt;/p&gt;
&lt;p&gt;
One thing I found lacking, was there were no support forums on the NDepend web site.
I had a couple of issues getting my Compact Framework application to be property recognized
by NDepend. The main issue, was NDepend was trying to use the full framework version
of System.Data instead of the Compact Framework version. I noticed that there was
an option when selecting assemblies to resolved missing ones (well, some it let me,
others it didn't), and figured the resolved location was stored in the project configuration
file. So I opened it up in note pad and sure enough, there were all the directory
paths.
&lt;/p&gt;
&lt;p&gt;
I removed all of the paths that were added by default, and added my own paths to my
project. I also added paths to the SQL CE 3.5 directory, as well as the location of
the compact framework dlls (See update below). Unfortunately I still had issues with
NDpend detecting multiple dlls (System.Data and System.Windows.Forms) with the same
name. I decided to remove the path statements for everything except my project. This
resulted in warning about not being able to resolve dependencies, but the analysis
completed. 
&lt;/p&gt;
&lt;p&gt;
There is allot of information presented, almost to the point of information overload.
I highly recommend printing out and reviewing the NDepend &lt;a href="http://www.hanselman.com/blog/content/binary/NDepend%20metrics%20placemats%201.1.pdf"&gt;placemat&lt;/a&gt; as
a quick reference. I concentrated primarily on the metrics, which use NDepend's Code
Query Language to identify possible problems. I found myself viewing all of the queries
to figure out what they were looking at. The documentation of the queries is excellent,
and each one includes a link to the NDepend web site which defines the metric is pretty
good detail. 
&lt;/p&gt;
&lt;p&gt;
I am quite impressed with the amount of information that NDepend gave me about my
project. There were/are a few usability issues, but they can be overcome. I hope that
I can continue to find time to make use of this excellent tool. I spent some time
watching the video tutorials, and they were very helpful. I've been trying to get
a side project started at home to try out all the tools, techniques, patterns, etc
that I don't have time for at work, and this will definitely find it's way onto my
to do list. I think it will be very interesting to use this from the beginning and
see how the different metrics change as I build out my project.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Update:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
1/2/2008 - After watching the videos, I discovered that when you are setting up your
project in VisualNDepend, there is a screen that lest you add/remove directories in
the application. This is much easier then editing the project file manually like I
was initially doing. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Other Links:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.amazon.com/Principles-Patterns-Practices-Robert-Martin/dp/0131857258/"&gt;Agile
Principles, Patterns, and Practices in C# by Robert C. Martin&lt;/a&gt; - This book was
referenced on the NDepend web site when talking about metrics on assemblies. 
&lt;li&gt;
NDepend &lt;a href="http://www.ndepend.com/GettingStarted.aspx"&gt;Getting Started&lt;/a&gt; page,
which links to video tutorials and additional references at the bottom.&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=cb26059c-074a-47ca-9fd6-bace1b0d2f12" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,cb26059c-074a-47ca-9fd6-bace1b0d2f12.aspx</comments>
      <category>Technology/Programming</category>
      <category>Technology/Review For Future Projects</category>
      <category>Technology/Tools</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=f77d6607-c149-411d-b8f8-f68ff075a9ae</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,f77d6607-c149-411d-b8f8-f68ff075a9ae.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,f77d6607-c149-411d-b8f8-f68ff075a9ae.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=f77d6607-c149-411d-b8f8-f68ff075a9ae</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Inversion of Control (IoC) and Dependency Injection (DI) are two practices, patterns,
techniques, that I have been very interested to take a look at in greater detail.
I came across a <a href="http://dotnetslackers.com/articles/designpatterns/InversionOfControlAndDependencyInjectionWithCastleWindsorContainerPart1.aspx">tutorial</a> (the
tutorial) which goes over IoC and DI using the Castle Windsor Container (and Micro
Container), part of the <a href="http://www.castleproject.org/">Castle Project</a>.
Two other similar implementations presented in the tutorial are <a href="http://www.springframework.net/">Spring.NET</a> and <a href="http://structuremap.sourceforge.net/">StructureMap</a>,
as well as Microsoft's <a href="http://www.codeplex.com/ObjectBuilder/Thread/List.aspx">ObjectBuidler</a> DI
framework. The ObjectBuilder framework is used in the Enterprise Library, and Composite
UI Application Block (CAB), which is good enough for me to steer clear of it and try
out the Windsor Container instead.
</p>
        <p>
I have never really been impressed with the Enterprise Library, and the CAB seemed
overly cumbersome. Granted, it has been over a year since I last looked at the CAB
and EntLib in any great detail, so maybe things have gotten better. I know allot of
people live and breath EntLib, but I'm trying to experience some other thoughts outside
the typical Microsoft sphere, such as <a href="http://weblogs.asp.net/rosherove/archive/2007/06/04/alt-net-alternative-tools-and-approaches-to-mainstream-net.aspx">Alt.Net</a>.
Microsoft is starting to catch onto the Alt.Net movement especially with the introduction
of the Asp.Net MVC framework, a topic for a future post. 
</p>
        <p>
          <strong>Part I</strong>
        </p>
        <p>
So what exactly is inversion of control? It helps if you consider how an application
is traditionally written and define what "control" means. "Control" can be thought
of as adding references to various assemblies, declaring instances of specific specific
classes by calling the appropriate constructor and passing in parameters. The tutorial
refers to this as a "canonical programming process". Now if we take the opposite,
or invert the control, then our application does not reference specifically assemblies
and does not instantiate concrete classes. Instead your application makes use of interfaces
or abstract classes and relies on a framework to instantiate the classes as needed.
This is commonly referred to as the <a title="Hollywood Principle" href="http://en.wikipedia.org/wiki/Hollywood_Principle">Hollywood
Principle</a>, and what post on design patterns would be complete without a link to <a href="http://martinfowler.com/bliki/InversionOfControl.html">Martin
Fowler</a>.
</p>
        <p>
The tutorial talks about another design principle, which is the separation of concerns
(<a title="SoC" href="http://en.wikipedia.org/wiki/Separation_of_concerns">SoC</a>).
Separation of Concerns states that a component should do only one task, and do it
very well. In the tutorial's example application, the functionality to download HTML
data should be separated from the logic to parse the HTML itself. By separating the
two pieces and applying IoC, if a new, faster algorithm for parsing was written, it
could be swapped out with the original with no modification to the application. Under
a traditional model, you would have to edit the single class, change the parsing routine,
and then recompile the class and application. Then what happens when management says,
"well the first algorithm was slower, but it was written by the boss's nephew....".
</p>
        <p>
The tutorial defines a component as: "...<i> a small unit of reusable code. It should
implement and expose just one service, and do it well. In practical terms, a component
is a class that implements a service (interface). The interface is the contract of
the service, which creates an abstraction layer so you can replace the service implementation
without effort." </i></p>
        <p>
The power of an Inversion of Control framework does not become apparent until you
have components with dependencies on other components, each with their own dependency.
The Castle project refers to it's IoC as a container which is offered in two versions.
The first exposes the core IoC functionality and is called the MicroKernel. In the
simplest of terms, you add components by specifying a key (ID), type and assembly
to load. You then ask the container for an instance, which it returns, loading all
required dependencies. The 2nd version of the container, Windsor, extends the Micro
Kernel and is used most often. It adds supports for generics to reduce casting and
external configuration (app.config and web.config) options to name a few.
</p>
        <p>
          <strong>Part II:</strong>
        </p>
        <ul>
          <li>
Constructor, Setter, and Component Injection 
<ul><li>
Constructor arguments, and [property] setter arguments can be specified in the configuration
file. 
</li><li>
If more then one component of a service is specified, you can specify which component
to use, using the ${ComponentName} syntax in the configuration file. 
</li><li>
The name of the XML Elements in the configuration file should match a constructor
parameter and property name.</li></ul></li>
          <li>
Collections in the configuration file 
<ul><li>
Arrays, Dictionaries and Lists can be specified in the configuration file. 
</li><li>
This allows you to pass in a collection of components and allow the parent container
to decide which one to use. 
</li><li>
Collections can be specified for constructor parameters and property setters.</li></ul></li>
        </ul>
        <p>
          <strong>Part III</strong>
        </p>
        <ul>
          <li>
Separation of configuration and data 
<ul><li>
The configuration file can get complex pretty fast, especially when you are specifying
a large set of data for a collection. 
</li><li>
Windsor allows you to work around this by moving the data to the top of the configuration
file under a &lt;properties /&gt; section. Child elements can be referenced in the
configuration section by using the #{ChildPropertyName} 
</li><li>
The tutorial points out that the real power of this, lies in the fact that you can
put the properties in a separate file.</li></ul></li>
          <li>
Custom Converters 
<ul><li>
Windsor supports converting from strings (in the configuration file) to other types. 
</li><li>
You need to implement AbstractTypeConvertor, and a new class inheriting from WindsorContainer
to register your TypeConvertor</li></ul></li>
          <li>
Decorator Pattern 
<ul><li>
The decorator pattern basically has you wrapping a component that implements IInterface,
with another component that implements IInterface, taking the original component as
a constructor parameter. 
</li><li>
Once you have the new implementation, you can perform things like benchmarking around
specific method calls. 
</li><li>
Since everything is setup via the configuration file(s), there was no need to re-compile
the main container. 
</li></ul></li>
          <li>
Define and If 
<ul><li>
Windsor supports an IF/Else syntax in the configuration file 
</li><li>
Windsor also supports using DEFINED variables, such as DEBUG. This is not the same
as the compiler flags, you have to add your own DEFINE statements in the configuration
file. this can be in either the main component configuration, or your properties configuration. 
</li></ul></li>
        </ul>
        <p>
          <strong>Party IV</strong>
        </p>
        <ul>
          <li>
Lifestyles 
<ul><li>
Windsor supports 4 object lifecycles 
<ul><li>
Singleton (Default) - Each call to Resolve returns the same instance 
</li><li>
Transient - Each call to Resolve returns a new reference 
</li><li>
Thread - Each thread gets a single instance 
</li><li>
Pooled - Instances are retrieved from a pool. If there are no more available instances
in the pool, a new one is created. All instances are created upon the container being
instantiated.  
</li><li>
Custom</li></ul></li><li>
Specify the lifestyle using attributes (i.e. [Transient]), or via the configuration
file</li></ul></li>
          <li>
Facilities 
<ul><li>
From the official documentation (taken from the tutorial): <i>Facilities augment the
MicroKernel capabilities by integrating it with a different project or technology,
or by implementing new semantics</i>. 
</li><li>
Built in facilities (Covered by the tutorial): 
<ul><li>
Factory - Allows you to use classes which implement an Interface but use the factory
pattern 
</li><li>
Startable - Components are "started" as soon as possible after the application is
started, and stop when it's released. You can implement an IStartable interface, or,
specify start and stop methods in the configuration file. 
</li></ul></li><li>
The logging facility is mentioned as one being worth while to investigate, but it's
not covered.</li></ul></li>
          <li>
Commission and Decommission 
<ul><li>
Implement the ICommission and IDecommission to specify code which should be run when
the component is created and destroyed by the container. Depending on the lifestyle
chosen, the actual time at which the decommission code is called varies, and without
understanding this, you may get unexpected results. 
</li></ul></li>
          <li>
IDisposable 
<ul><li>
If you implement IDispoable, the container will automatically call the dispose method
when the component is no longer needed.  
</li></ul></li>
        </ul>
        <p>
          <strong>Questions:</strong>
        </p>
        <ul>
          <li>
Is there a utility that can analyze an assembly, namespace and/or class and generate
a skeleton configuration file? 
</li>
          <ul>
            <li>
The StructureMap lists some tools that make configuration file management easier.</li>
          </ul>
          <li>
Other ways to store configuration data. It would be great if you could load configuration,
or the properties from a SQL data store. 
</li>
          <ul>
            <li>
StructureMap supports full programmatic configuration.</li>
          </ul>
        </ul>
        <p>
          <strong>Conclusion:</strong>
        </p>
        <p>
I can't wait to try out the Micro Kernel and Windsor Container in a project. The flexibility
is phenomenal, and the decorator pattern makes it extremely easy to extend functionality. 
I only took a quick look at the StructureMap and Spring.Net, and they have some interesting
features which need further investigation.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=f77d6607-c149-411d-b8f8-f68ff075a9ae" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Inversion of Control and Dependency Injection</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,f77d6607-c149-411d-b8f8-f68ff075a9ae.aspx</guid>
      <link>http://blog.salvoz.com/2007/12/27/InversionOfControlAndDependencyInjection.aspx</link>
      <pubDate>Thu, 27 Dec 2007 04:10:24 GMT</pubDate>
      <description>&lt;p&gt;
Inversion of Control (IoC) and Dependency Injection (DI) are two practices, patterns,
techniques, that I have been very interested to take a look at in greater detail.
I came across a &lt;a href="http://dotnetslackers.com/articles/designpatterns/InversionOfControlAndDependencyInjectionWithCastleWindsorContainerPart1.aspx"&gt;tutorial&lt;/a&gt; (the
tutorial) which goes over IoC and DI using the Castle Windsor Container (and Micro
Container), part of the &lt;a href="http://www.castleproject.org/"&gt;Castle Project&lt;/a&gt;.
Two other similar implementations presented in the tutorial are &lt;a href="http://www.springframework.net/"&gt;Spring.NET&lt;/a&gt; and &lt;a href="http://structuremap.sourceforge.net/"&gt;StructureMap&lt;/a&gt;,
as well as Microsoft's &lt;a href="http://www.codeplex.com/ObjectBuilder/Thread/List.aspx"&gt;ObjectBuidler&lt;/a&gt; DI
framework. The ObjectBuilder framework is used in the Enterprise Library, and Composite
UI Application Block (CAB), which is good enough for me to steer clear of it and try
out the Windsor Container instead.
&lt;/p&gt;
&lt;p&gt;
I have never really been impressed with the Enterprise Library, and the CAB seemed
overly cumbersome. Granted, it has been over a year since I last looked at the CAB
and EntLib in any great detail, so maybe things have gotten better. I know allot of
people live and breath EntLib, but I'm trying to experience some other thoughts outside
the typical Microsoft sphere, such as &lt;a href="http://weblogs.asp.net/rosherove/archive/2007/06/04/alt-net-alternative-tools-and-approaches-to-mainstream-net.aspx"&gt;Alt.Net&lt;/a&gt;.
Microsoft is starting to catch onto the Alt.Net movement especially with the introduction
of the Asp.Net MVC framework, a topic for a future post. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Part I&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
So what exactly is inversion of control? It helps if you consider how an application
is traditionally written and define what "control" means. "Control" can be thought
of as adding references to various assemblies, declaring instances of specific specific
classes by calling the appropriate constructor and passing in parameters. The tutorial
refers to this as a "canonical programming process". Now if we take the opposite,
or invert the control, then our application does not reference specifically assemblies
and does not instantiate concrete classes. Instead your application makes use of interfaces
or abstract classes and relies on a framework to instantiate the classes as needed.
This is commonly referred to as the &lt;a title="Hollywood Principle" href="http://en.wikipedia.org/wiki/Hollywood_Principle"&gt;Hollywood
Principle&lt;/a&gt;, and what post on design patterns would be complete without a link to &lt;a href="http://martinfowler.com/bliki/InversionOfControl.html"&gt;Martin
Fowler&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The tutorial talks about another design principle, which is the separation of concerns
(&lt;a title="SoC" href="http://en.wikipedia.org/wiki/Separation_of_concerns"&gt;SoC&lt;/a&gt;).
Separation of Concerns states that a component should do only one task, and do it
very well. In the tutorial's example application, the functionality to download HTML
data should be separated from the logic to parse the HTML itself. By separating the
two pieces and applying IoC, if a new, faster algorithm for parsing was written, it
could be swapped out with the original with no modification to the application. Under
a traditional model, you would have to edit the single class, change the parsing routine,
and then recompile the class and application. Then what happens when management says,
"well the first algorithm was slower, but it was written by the boss's nephew....".
&lt;/p&gt;
&lt;p&gt;
The tutorial defines a component as: "...&lt;i&gt; a small unit of reusable code. It should
implement and expose just one service, and do it well. In practical terms, a component
is a class that implements a service (interface). The interface is the contract of
the service, which creates an abstraction layer so you can replace the service implementation
without effort." &lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
The power of an Inversion of Control framework does not become apparent until you
have components with dependencies on other components, each with their own dependency.
The Castle project refers to it's IoC as a container which is offered in two versions.
The first exposes the core IoC functionality and is called the MicroKernel. In the
simplest of terms, you add components by specifying a key (ID), type and assembly
to load. You then ask the container for an instance, which it returns, loading all
required dependencies. The 2nd version of the container, Windsor, extends the Micro
Kernel and is used most often. It adds supports for generics to reduce casting and
external configuration (app.config and web.config) options to name a few.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Part II:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Constructor, Setter, and Component Injection 
&lt;ul&gt;
&lt;li&gt;
Constructor arguments, and [property] setter arguments can be specified in the configuration
file. 
&lt;li&gt;
If more then one component of a service is specified, you can specify which component
to use, using the ${ComponentName} syntax in the configuration file. 
&lt;li&gt;
The name of the XML Elements in the configuration file should match a constructor
parameter and property name.&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Collections in the configuration file 
&lt;ul&gt;
&lt;li&gt;
Arrays, Dictionaries and Lists can be specified in the configuration file. 
&lt;li&gt;
This allows you to pass in a collection of components and allow the parent container
to decide which one to use. 
&lt;li&gt;
Collections can be specified for constructor parameters and property setters.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Part III&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Separation of configuration and data 
&lt;ul&gt;
&lt;li&gt;
The configuration file can get complex pretty fast, especially when you are specifying
a large set of data for a collection. 
&lt;li&gt;
Windsor allows you to work around this by moving the data to the top of the configuration
file under a &amp;lt;properties /&amp;gt; section. Child elements can be referenced in the
configuration section by using the #{ChildPropertyName} 
&lt;li&gt;
The tutorial points out that the real power of this, lies in the fact that you can
put the properties in a separate file.&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Custom Converters 
&lt;ul&gt;
&lt;li&gt;
Windsor supports converting from strings (in the configuration file) to other types. 
&lt;li&gt;
You need to implement AbstractTypeConvertor, and a new class inheriting from WindsorContainer
to register your TypeConvertor&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Decorator Pattern 
&lt;ul&gt;
&lt;li&gt;
The decorator pattern basically has you wrapping a component that implements IInterface,
with another component that implements IInterface, taking the original component as
a constructor parameter. 
&lt;li&gt;
Once you have the new implementation, you can perform things like benchmarking around
specific method calls. 
&lt;li&gt;
Since everything is setup via the configuration file(s), there was no need to re-compile
the main container. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Define and If 
&lt;ul&gt;
&lt;li&gt;
Windsor supports an IF/Else syntax in the configuration file 
&lt;li&gt;
Windsor also supports using DEFINED variables, such as DEBUG. This is not the same
as the compiler flags, you have to add your own DEFINE statements in the configuration
file. this can be in either the main component configuration, or your properties configuration. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Party IV&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Lifestyles 
&lt;ul&gt;
&lt;li&gt;
Windsor supports 4 object lifecycles 
&lt;ul&gt;
&lt;li&gt;
Singleton (Default) - Each call to Resolve returns the same instance 
&lt;li&gt;
Transient - Each call to Resolve returns a new reference 
&lt;li&gt;
Thread - Each thread gets a single instance 
&lt;li&gt;
Pooled - Instances are retrieved from a pool. If there are no more available instances
in the pool, a new one is created. All instances are created upon the container being
instantiated.&amp;nbsp; 
&lt;li&gt;
Custom&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Specify the lifestyle using attributes (i.e. [Transient]), or via the configuration
file&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Facilities 
&lt;ul&gt;
&lt;li&gt;
From the official documentation (taken from the tutorial): &lt;i&gt;Facilities augment the
MicroKernel capabilities by integrating it with a different project or technology,
or by implementing new semantics&lt;/i&gt;. 
&lt;li&gt;
Built in facilities (Covered by the tutorial): 
&lt;ul&gt;
&lt;li&gt;
Factory - Allows you to use classes which implement an Interface but use the factory
pattern 
&lt;li&gt;
Startable - Components are "started" as soon as possible after the application is
started, and stop when it's released. You can implement an IStartable interface, or,
specify start and stop methods in the configuration file. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
The logging facility is mentioned as one being worth while to investigate, but it's
not covered.&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Commission and Decommission 
&lt;ul&gt;
&lt;li&gt;
Implement the ICommission and IDecommission to specify code which should be run when
the component is created and destroyed by the container. Depending on the lifestyle
chosen, the actual time at which the decommission code is called varies, and without
understanding this, you may get unexpected results. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
IDisposable 
&lt;ul&gt;
&lt;li&gt;
If you implement IDispoable, the container will automatically call the dispose method
when the component is no longer needed.&amp;nbsp; 
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Questions:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Is there a utility that can analyze an assembly, namespace and/or class and generate
a skeleton configuration file? 
&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
The StructureMap lists some tools that make configuration file management easier.&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Other ways to store configuration data. It would be great if you could load configuration,
or the properties from a SQL data store. 
&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
StructureMap supports full programmatic configuration.&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Conclusion:&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I can't wait to try out the Micro Kernel and Windsor Container in a project. The flexibility
is phenomenal, and the decorator pattern makes it extremely easy to extend functionality.&amp;nbsp;
I only took a quick look at the StructureMap and Spring.Net, and they have some interesting
features which need further investigation.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=f77d6607-c149-411d-b8f8-f68ff075a9ae" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,f77d6607-c149-411d-b8f8-f68ff075a9ae.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=91b3aa3a-6adf-4cae-ab9a-6da36babe318</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,91b3aa3a-6adf-4cae-ab9a-6da36babe318.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,91b3aa3a-6adf-4cae-ab9a-6da36babe318.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=91b3aa3a-6adf-4cae-ab9a-6da36babe318</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It seems as if there is someone at Microsoft, who's sole purpose in life is to figure
out how I might want to use something (WCF), and then make sure I can't use it in
the way I want to. Today's issue, programmatically configuring a WCF client application.
</p>
        <p>
          <strong>Background</strong>
        </p>
        <p>
I have created a central repository store in the form of a SQL database, that put
simply, contains key/value pairs that I can query. All of my applications (or each
machine.config) only need to specify a single database connection string to this configuration
database.  All other configuration settings are retrieved from the database (and
cached), making it easy to keep track of configuration, view all current configuration
settings, and deploy the applications on new servers. 
</p>
        <p>
Expanding upon my simple definition, there is a second "key", which corresponds to
what environment (production, staging, development) the application is deployed. So
my single configuration database controls the configuration of all applications in
all environments. For those settings which are the same across all environments, no
deployment key is specified. 
</p>
        <p>
So far this has worked great, and I wanted to add configuration information about
a WCF client service.
</p>
        <p>
          <strong>WCF</strong>
        </p>
        <p>
WCF needs two properties set, a binding, and an endpoint, and each of these 2 properties
have sub properties which may or may not have values that need to be set. Out of the
box, WCF is most easily configured using application or web configuration files. All
of the tools support the configuration files and it's easy to see what's going on
(well sort of). 
</p>
        <p>
I basically wanted to take the XML sections that define the binding and endpoint,
and place it into my configuration database. For some reason, I got it in my head
that this would be really easy to do, but found out that it's not. Searching thru
Google yielded no direct solution. While you can programmatically set the Binding
and Endpoint properties of a proxy class client object, I would either have to have
1 setting per property (and sub property) in my configuration database, or come up
with an XML schema, parse the schema and set the values. This was the path I was pursing,
but instead of making my own schema, I just used the XML configuration schema provided
out of the box, in hopes that one day I could just pass those sections to binding
or endpoint objects and have it parse for me.
</p>
        <p>
After creating classes to parse a single binding (WsHttpBinding), I decided there
must be a better way.  The code to parse the configuration files must exist somewhere
in System.ServiceModel, so I decided to go spelunking using reflector to see what
was going on, and determine if I could hack something together.
</p>
        <p>
          <strong>Implementation</strong>
        </p>
        <blockquote>
          <p>
            <strong>Overview</strong>
          </p>
          <p>
After spending a couple of hours in reflector, I realized the main roadblock was the
use of the System.Configuration namespace to handle the configuration data for System.ServiceModel.
System.Configuration only supports the file system, and provides no extension methods
at this time (something I'd like to see from Microsoft in the future). 
</p>
          <p>
This left me with one option, which was to create temporary XML file with my configuration
data from my database, and then read that configuration file using the proper classes/methods
in System.Configuration. It took me awhile to accept this option, as writing a temporary
file seemed messy, but then I realized, temporary files are a fact of life in .Net,
programming, operating systems, etc.
</p>
          <p>
            <strong>Configuration Store</strong>
          </p>
          <p>
My configuration store was already defined as I mentioned previously. The 2 XML samples
below are stored as separate entries in my configuration database. Below is the XML
I stored for handling the bindings:
</p>
          <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 41.84%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 210px; background-color: #f4f4f4">
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 44.82%; 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; height: 336px; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">bindings</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">wsHttpBinding</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">binding</span>
              <span style="color: #ff0000">name</span>
              <span style="color: #0000ff">="WSHttpBinding_ITwoWayAsyncVoid"</span>
              <span style="color: #ff0000">closeTimeout</span>
              <span style="color: #0000ff">="00:01:00"</span>
              <span style="color: #ff0000">openTimeout</span>
              <span style="color: #0000ff">="00:00:30"</span>
              <span style="color: #ff0000">receiveTimeout</span>
              <span style="color: #0000ff">="00:02:00"</span>
              <span style="color: #ff0000">sendTimeout</span>
              <span style="color: #0000ff">="00:00:15"</span>
              <span style="color: #ff0000">bypassProxyOnLocal</span>
              <span style="color: #0000ff">="false"</span>
              <span style="color: #ff0000">transactionFlow</span>
              <span style="color: #0000ff">="false"</span>
              <span style="color: #ff0000">hostNameComparisonMode</span>
              <span style="color: #0000ff">="StrongWildcard"</span>
              <span style="color: #ff0000">maxBufferPoolSize</span>
              <span style="color: #0000ff">="524288"</span>
              <span style="color: #ff0000">maxReceivedMessageSize</span>
              <span style="color: #0000ff">="65536"</span>
              <span style="color: #ff0000">messageEncoding</span>
              <span style="color: #0000ff">="Text"</span>
              <span style="color: #ff0000">textEncoding</span>
              <span style="color: #0000ff">="utf-8"</span>
              <span style="color: #ff0000">useDefaultWebProxy</span>
              <span style="color: #0000ff">="true"</span>
              <span style="color: #ff0000">allowCookies</span>
              <span style="color: #0000ff">="false"</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">readerQuotas</span>
              <span style="color: #ff0000">maxDepth</span>
              <span style="color: #0000ff">="32"</span>
              <span style="color: #ff0000">maxStringContentLength</span>
              <span style="color: #0000ff">="8192"</span>
              <span style="color: #ff0000">maxArrayLength</span>
              <span style="color: #0000ff">="16384"</span>
              <span style="color: #ff0000">maxBytesPerRead</span>
              <span style="color: #0000ff">="4096"</span>
              <span style="color: #ff0000">maxNameTableCharCount</span>
              <span style="color: #0000ff">="16384"</span>
              <span style="color: #0000ff">/&gt;</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">reliableSession</span>
              <span style="color: #ff0000">ordered</span>
              <span style="color: #0000ff">="true"</span>
              <span style="color: #ff0000">inactivityTimeout</span>
              <span style="color: #0000ff">="00:10:00"</span>
              <span style="color: #ff0000">enabled</span>
              <span style="color: #0000ff">="false"</span>
              <span style="color: #0000ff">/&gt;</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">security</span>
              <span style="color: #ff0000">mode</span>
              <span style="color: #0000ff">="Message"</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">transport</span>
              <span style="color: #ff0000">clientCredentialType</span>
              <span style="color: #0000ff">="Windows"</span>
              <span style="color: #ff0000">proxyCredentialType</span>
              <span style="color: #0000ff">="None"</span>
              <span style="color: #ff0000">realm</span>
              <span style="color: #0000ff">=""</span>
              <span style="color: #0000ff">/&gt;</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">message</span>
              <span style="color: #ff0000">clientCredentialType</span>
              <span style="color: #0000ff">="Windows"</span>
              <span style="color: #ff0000">negotiateServiceCredential</span>
              <span style="color: #0000ff">="true"</span>
              <span style="color: #ff0000">algorithmSuite</span>
              <span style="color: #0000ff">="Default"</span>
              <span style="color: #ff0000">establishSecurityContext</span>
              <span style="color: #0000ff">="true"</span>
              <span style="color: #0000ff">/&gt;</span>
              <span style="color: #0000ff">&lt;/</span>
              <span style="color: #800000">security</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;/</span>
              <span style="color: #800000">binding</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;/</span>
              <span style="color: #800000">wsHttpBinding</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;/</span>
              <span style="color: #800000">bindings</span>
              <span style="color: #0000ff">&gt;</span>
            </pre>
          </div>
        </blockquote>
        <blockquote>
          <p>
I am able to store multiple bindings, and binding configurations in a single entry
in my configuration database (see below). In this example, I only have a single binding
and binding configuration. I was originally planning to have 1 entry for each binding,
but I don't think that will be necessary, if anything I will have a single entry for
all necessary bindings per environment, and even that might be overkill. 
</p>
          <p>
This is the XML I stored for the end point:
</p>
          <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 50.87%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 210px; background-color: #f4f4f4">
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 51.95%; 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; height: 240px; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">bindings</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">wsHttpBinding</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">binding</span>
              <span style="color: #ff0000">name</span>
              <span style="color: #0000ff">="WSHttpBinding_ITwoWayAsyncVoid"</span>
              <span style="color: #0000ff">/&gt;</span>
              <span style="color: #0000ff">&lt;/</span>
              <span style="color: #800000">wsHttpBinding</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;/</span>
              <span style="color: #800000">bindings</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">client</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">endpoint</span>
              <span style="color: #ff0000">address</span>
              <span style="color: #0000ff">="http://tersodemodev1/TsiCbsEsbReciever/WcfService_TersoSolutions_CBS_Fusion_BizTalk_InitialProcess.svc"</span>
              <span style="color: #ff0000">binding</span>
              <span style="color: #0000ff">="wsHttpBinding"</span>
              <span style="color: #ff0000">bindingConfiguration</span>
              <span style="color: #0000ff">="WSHttpBinding_ITwoWayAsyncVoid"</span>
              <span style="color: #ff0000">contract</span>
              <span style="color: #0000ff">="TsiCbsEsbReceiver.WcfService_TersoSolutions_CBS_Fusion_BizTalk_InitialProcess"</span>
              <span style="color: #ff0000">name</span>
              <span style="color: #0000ff">="WSHttpBinding_ITwoWayAsyncVoid"</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">identity</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;</span>
              <span style="color: #800000">userPrincipalName</span>
              <span style="color: #ff0000">value</span>
              <span style="color: #0000ff">="TERSODEMODEV1\BizTalkWebServices"</span>
              <span style="color: #0000ff">/&gt;</span>
              <span style="color: #0000ff">&lt;/</span>
              <span style="color: #800000">identity</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;/</span>
              <span style="color: #800000">endpoint</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #0000ff">&lt;/</span>
              <span style="color: #800000">client</span>
              <span style="color: #0000ff">&gt;</span>
            </pre>
          </div>
        </blockquote>
        <blockquote>
          <div>Notice the repeat of the &lt;bindings&gt; section. This was required if I wanted
to use the the classes in System.ServiceModel for parsing the endpoint, I needed to
define a skeleton for the bindings. 
</div>
        </blockquote>
        <blockquote>
          <div>I separated the endpoints from the bindings, as that is what is going to change
between environments the most for me. The endpoint specifies which server (test, production,
staging), and identity (for single server test scenarios, the account will be local,
for multi server production enviroments, the identity will be a domain account). 
</div>
        </blockquote>
        <blockquote>
          <div>
            <strong>Code</strong>
          </div>
        </blockquote>
        <blockquote>
          <div>I created 2 classes under a namespace called ConfigSystem. The first class, called
ConfigMgr contains code that allows me to go from my configuration database to a System.Configuration.Configuration
object by way of a temporary file. The second class called Wcf, contains code specific
to my Wcf configuration implementation, and contains code inferred from reflector. 
</div>
        </blockquote>
        <blockquote>
          <div>All of the code in ConfigMgr uses public classes and is pretty simple.
</div>
        </blockquote>
        <blockquote>
          <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 40.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 210px; background-color: #f4f4f4">
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 39.65%; 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; height: 882px; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">static</span>
              <span style="color: #0000ff">class</span> ConfigMgr
{ <span style="color: #cc6633">#region</span> MemberVars <span style="color: #0000ff">private</span><span style="color: #0000ff">const</span><span style="color: #0000ff">string</span> configFileHeader
= <span style="color: #006080">"&lt;?xml version=\"1.0\"?&gt;&lt;configuration&gt;"</span>; <span style="color: #0000ff">private</span><span style="color: #0000ff">const</span><span style="color: #0000ff">string</span> configFileFooter
= <span style="color: #006080">"&lt;/configuration&gt;"</span>; <span style="color: #cc6633">#endregion</span><span style="color: #cc6633">#region</span> Methods
- Public <span style="color: #0000ff">public</span><span style="color: #0000ff">static</span> ConfigurationSection
GetSection(<span style="color: #0000ff">string</span> configKey, <span style="color: #0000ff">string</span> xmlConfigFileHeaderExtra, <span style="color: #0000ff">string</span> xmlConfigFileFooterExtra, <span style="color: #0000ff">string</span> sectionName)
{ <span style="color: #008000">//Get an xml document from the configuration database
to store as a tempory file.</span> System.Xml.XmlDocument doc = PrepareXmlDocument(configKey,
xmlConfigFileHeaderExtra, xmlConfigFileFooterExtra); <span style="color: #008000">//Now
write out to the temp file.</span><span style="color: #0000ff">string</span> path
= System.IO.Path.GetTempFileName(); <span style="color: #0000ff">using</span> (System.Xml.XmlWriter
writer = System.Xml.XmlWriter.Create(path)) { doc.WriteTo(writer); writer.Close();
} <span style="color: #008000">//Setup configuration file map so that we can use standard
file based config file</span> ExeConfigurationFileMap map = <span style="color: #0000ff">new</span> ExeConfigurationFileMap();
map.ExeConfigFilename = path; System.Configuration.Configuration config = ConfigurationManager.OpenMappedExeConfiguration(map,
ConfigurationUserLevel.None); <span style="color: #008000">//Now return the specified
section</span><span style="color: #0000ff">return</span> config.GetSection(sectionName);
} <span style="color: #0000ff">private</span><span style="color: #0000ff">static</span> System.Xml.XmlDocument
PrepareXmlDocument(<span style="color: #0000ff">string</span> configKey, <span style="color: #0000ff">string</span> xmlConfigFileHeaderExtra, <span style="color: #0000ff">string</span> xmlConfigFileFooterExtra)
{ System.Text.StringBuilder sb = <span style="color: #0000ff">new</span> System.Text.StringBuilder(); <span style="color: #008000">//Append
header</span> sb.Append(configFileHeader); sb.Append(xmlConfigFileHeaderExtra); sb.Append(ConfigHandler.GetValue(configKey)); <span style="color: #008000">//Append
Footer</span> sb.Append(xmlConfigFileFooterExtra); sb.Append(configFileFooter); System.Xml.XmlDocument
doc = <span style="color: #0000ff">new</span> System.Xml.XmlDocument(); doc.LoadXml(sb.ToString()); <span style="color: #0000ff">return</span> doc;
} <span style="color: #cc6633">#endregion</span> }</pre>
          </div>
        </blockquote>
        <blockquote>
          <div>The code in the Wcf class uses some methods I copied via reflector, and because
I don't know the legal ramifications of that, I am only providing an outline of what
I did.
</div>
        </blockquote>
        <blockquote>
          <div>GetBinding:
</div>
          <ul>
            <li>
Calls ConfigMgr.Get section and returns the &lt;bindings&gt; section. This is cast
to a BindingsSection object.</li>
            <li>
Code taken from System.ServiceModel.Configuration creates a BindingCollectionElement
which is the correct type associated with the binding stored in the XML config. 
</li>
            <li>
A new binding object is created using Activator.CreateInstance(BindingCollectionElement.BindingType)</li>
            <li>
Additional code taken from System.ServiceModel.Configuration loops thru BindingCollectionElement.ConfiguredBindings
and initializes the binding object previously created. A check is made to make sure
multiple bindings of the same type are not created.</li>
            <li>
Finally, the binding object is returned to the caller.</li>
          </ul>
        </blockquote>
        <blockquote>
          <p>
GetChannelEndpointElement: This class uses only public classes and methods so I am
including it. EnpointElement contains the configuration data for an endpoint, including
the URI, identity, binding, and  binding configuration. The binding and binding
configuration data is actually passed to my GetBinding method to return the correct
binding with the correct binding configuration. 
</p>
          <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 40.97%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 210px; background-color: #f4f4f4">
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 45.55%; 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; height: 208px; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">static</span> ChannelEndpointElement
GetChannelEndpointElement(<span style="color: #0000ff">string</span> configKey) {
ClientSection section = (ClientSection)ConfigMgr.GetSection(configKey, system_ServiceModelAsOpenXml,
system_ServiceModelAsCloseXml, clientSection); <span style="color: #0000ff">if</span> (section
== <span style="color: #0000ff">null</span>) <span style="color: #0000ff">throw</span><span style="color: #0000ff">new</span> ArgumentException(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">"Client
section returned from config db for key {0} was null"</span>, configKey)); <span style="color: #0000ff">if</span> (section.Endpoints.Count
!= 1) <span style="color: #0000ff">throw</span><span style="color: #0000ff">new</span> ArgumentException(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">"There
must be exactly 1 endpoint returned from the configuration. {0} endpoints were returned
for key {1}"</span>, section.Endpoints.Count, configKey)); <span style="color: #0000ff">return</span> section.Endpoints[0];
}</pre>
          </div>
        </blockquote>
        <blockquote>
          <div>GetEndpointAddress: Another method I created which almost uses all public methods.
It takes a ChannelEnpointElement and returns a EndpointAddress which can be assigned
to a wcf proxy class. 
<br /></div>
          <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 40.98%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 183px; background-color: #f4f4f4">
            <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 34.01%; 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; height: 160px; background-color: #f4f4f4; border-bottom-style: none">
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">static</span> EndpointAddress
GetEndpointAddress(ChannelEndpointElement element) { <span style="color: #008000">//Create
a new builder, as the endpoint address is an immutable class</span> EndpointAddressBuilder
builder = <span style="color: #0000ff">new</span> EndpointAddressBuilder(); builder.Identity
= LoadIdentity(element.Identity); builder.Uri = element.Address; <span style="color: #0000ff">return</span> builder.ToEndpointAddress();
}</pre>
          </div>
        </blockquote>
        <blockquote>
          <div>LoadIdentity: This final method was taken from System.ServiceModel.Description.Configloader.
This method takes a IdentityElement (a property of ChannelEnpointElement) and returns
a EndpointIdentity which is passed to the EndpointAddressBuilder in my GetEndpointAddress
method. The method basically checks the the existence of certain properties, and if
one exists, it returns the appropriate identity using public factory methods.
</div>
          <ul>
            <li>
EndpointIdentity.CreateUpnIdentity</li>
            <li>
EndpointIdentity.CreateSpnIdentity</li>
            <li>
EndpointIdentity.CreateDnsIdentity</li>
            <li>
EndpointIdentity.CreateRsaIdentity</li>
            <li>
EndpointIdentity.CreateX509CertificateIdentity</li>
          </ul>
        </blockquote>
        <blockquote>
          <p>
There is a identity type of certificate reference which I was unable to add support
for, because it referenced additional internal classes which I didn't want to duplicate
at this time since I had no need for that identity type. 
</p>
        </blockquote>
        <p>
          <strong>Issues</strong>
        </p>
        <p>
Since this is completely unsupported by Microsoft, and uses code that was never meant
for external use, in a future version of the framework, something could break. I'm
also not an legal expert when it comes with what someone can do with MSIL code discovered
thru reflector, so for now, the actual code I wrote is not available publicly. Hopefully
I provided enough information to allow someone to reproduce my steps and implement
something on their own. 
</p>
        <p>
Another somewhat disappointing realization I came to, was that this might make it
hard to support write operations to my configuration database. Currently the configuration
database is managed thru scripts and direct editing. If write support to the config
database became a requirement, I'd probably try to do the reverse and use the built
in file save functionality in System.Configuration to save a temporary xml file, read
it and then store it into my config database. 
</p>
        <p>
          <strong>Conclusion</strong>
        </p>
        <p>
This was my first attempt at doing something like this, digging into framework code
to see how it really works and trying to come up with a solution. I'm going to go
forward using the code I wrote outlined in this post, as I have full read support
for WCF XML configuration. The amount of code I had to write and test is significantly
less then if I would have wanted to get the same amount of functionality (configuration
support for all bindings and endpoint configurations).
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=91b3aa3a-6adf-4cae-ab9a-6da36babe318" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Programmatically setting WCF Configuration</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,91b3aa3a-6adf-4cae-ab9a-6da36babe318.aspx</guid>
      <link>http://blog.salvoz.com/2007/12/09/ProgrammaticallySettingWCFConfiguration.aspx</link>
      <pubDate>Sun, 09 Dec 2007 20:50:53 GMT</pubDate>
      <description>&lt;p&gt;
It seems as if there is someone at Microsoft, who's sole purpose in life is to figure
out how I might want to use something (WCF), and then make sure I can't use it in
the way I want to. Today's issue, programmatically configuring a WCF client application.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Background&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I have created a central repository store in the form of a SQL database, that put
simply, contains key/value pairs that I can query. All of my applications (or each
machine.config) only need to specify a single database connection string to this configuration
database.&amp;nbsp; All other configuration settings are retrieved from the database (and
cached), making it easy to keep track of configuration, view all current configuration
settings, and deploy the applications on new servers. 
&lt;/p&gt;
&lt;p&gt;
Expanding upon my simple definition, there is a second "key", which corresponds to
what environment (production, staging, development) the application is deployed. So
my single configuration database controls the configuration of all applications in
all environments. For those settings which are the same across all environments, no
deployment key is specified. 
&lt;/p&gt;
&lt;p&gt;
So far this has worked great, and I wanted to add configuration information about
a WCF client service.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;WCF&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
WCF needs two properties set, a binding, and an endpoint, and each of these 2 properties
have sub properties which may or may not have values that need to be set. Out of the
box, WCF is most easily configured using application or web configuration files. All
of the tools support the configuration files and it's easy to see what's going on
(well sort of). 
&lt;/p&gt;
&lt;p&gt;
I basically wanted to take the XML sections that define the binding and endpoint,
and place it into my configuration database. For some reason, I got it in my head
that this would be really easy to do, but found out that it's not. Searching thru
Google yielded no direct solution. While you can programmatically set the Binding
and Endpoint properties of a proxy class client object, I would either have to have
1 setting per property (and sub property) in my configuration database, or come up
with an XML schema, parse the schema and set the values. This was the path I was pursing,
but instead of making my own schema, I just used the XML configuration schema provided
out of the box, in hopes that one day I could just pass those sections to binding
or endpoint objects and have it parse for me.
&lt;/p&gt;
&lt;p&gt;
After creating classes to parse a single binding (WsHttpBinding), I decided there
must be a better way.&amp;nbsp; The code to parse the configuration files must exist somewhere
in System.ServiceModel, so I decided to go spelunking using reflector to see what
was going on, and determine if I could hack something together.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Implementation&lt;/strong&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;Overview&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
After spending a couple of hours in reflector, I realized the main roadblock was the
use of the System.Configuration namespace to handle the configuration data for System.ServiceModel.
System.Configuration only supports the file system, and provides no extension methods
at this time (something I'd like to see from Microsoft in the future). 
&lt;/p&gt;
&lt;p&gt;
This left me with one option, which was to create temporary XML file with my configuration
data from my database, and then read that configuration file using the proper classes/methods
in System.Configuration. It took me awhile to accept this option, as writing a temporary
file seemed messy, but then I realized, temporary files are a fact of life in .Net,
programming, operating systems, etc.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Configuration Store&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
My configuration store was already defined as I mentioned previously. The 2 XML samples
below are stored as separate entries in my configuration database. Below is the XML
I stored for handling the bindings:
&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 41.84%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 210px; background-color: #f4f4f4"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 44.82%; 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; height: 336px; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;bindings&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;wsHttpBinding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;binding&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="WSHttpBinding_ITwoWayAsyncVoid"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;closeTimeout&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="00:01:00"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;openTimeout&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="00:00:30"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;receiveTimeout&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="00:02:00"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;sendTimeout&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="00:00:15"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;bypassProxyOnLocal&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="false"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;transactionFlow&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="false"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;hostNameComparisonMode&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="StrongWildcard"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;maxBufferPoolSize&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="524288"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;maxReceivedMessageSize&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="65536"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;messageEncoding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Text"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;textEncoding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="utf-8"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;useDefaultWebProxy&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="true"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;allowCookies&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="false"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;readerQuotas&lt;/span&gt; &lt;span style="color: #ff0000"&gt;maxDepth&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="32"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;maxStringContentLength&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="8192"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;maxArrayLength&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="16384"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;maxBytesPerRead&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="4096"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;maxNameTableCharCount&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="16384"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;reliableSession&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ordered&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="true"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;inactivityTimeout&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="00:10:00"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;enabled&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="false"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;security&lt;/span&gt; &lt;span style="color: #ff0000"&gt;mode&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Message"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;transport&lt;/span&gt; &lt;span style="color: #ff0000"&gt;clientCredentialType&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Windows"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;proxyCredentialType&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="None"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;realm&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=""&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;message&lt;/span&gt; &lt;span style="color: #ff0000"&gt;clientCredentialType&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Windows"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;negotiateServiceCredential&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="true"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;algorithmSuite&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Default"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;establishSecurityContext&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="true"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;security&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;binding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;wsHttpBinding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;bindings&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
I am able to store multiple bindings, and binding configurations in a single entry
in my configuration database (see below). In this example, I only have a single binding
and binding configuration. I was originally planning to have 1 entry for each binding,
but I don't think that will be necessary, if anything I will have a single entry for
all necessary bindings per environment, and even that might be overkill. 
&lt;/p&gt;
&lt;p&gt;
This is the XML I stored for the end point:
&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 50.87%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 210px; background-color: #f4f4f4"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 51.95%; 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; height: 240px; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;bindings&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;wsHttpBinding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;binding&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="WSHttpBinding_ITwoWayAsyncVoid"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;wsHttpBinding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;bindings&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;client&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;endpoint&lt;/span&gt; &lt;span style="color: #ff0000"&gt;address&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="http://tersodemodev1/TsiCbsEsbReciever/WcfService_TersoSolutions_CBS_Fusion_BizTalk_InitialProcess.svc"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;binding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="wsHttpBinding"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;bindingConfiguration&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="WSHttpBinding_ITwoWayAsyncVoid"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;contract&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="TsiCbsEsbReceiver.WcfService_TersoSolutions_CBS_Fusion_BizTalk_InitialProcess"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="WSHttpBinding_ITwoWayAsyncVoid"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;identity&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;userPrincipalName&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="TERSODEMODEV1\BizTalkWebServices"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;identity&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;endpoint&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;client&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;div&gt;Notice the repeat of the &amp;lt;bindings&amp;gt; section. This was required if I wanted
to use the the classes in System.ServiceModel for parsing the endpoint, I needed to
define a skeleton for the bindings. 
&lt;/div&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;div&gt;I separated the endpoints from the bindings, as that is what is going to change
between environments the most for me. The endpoint specifies which server (test, production,
staging), and identity (for single server test scenarios, the account will be local,
for multi server production enviroments, the identity will be a domain account). 
&lt;/div&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;div&gt;&lt;strong&gt;Code&lt;/strong&gt;
&lt;/div&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;div&gt;I created 2 classes under a namespace called ConfigSystem. The first class, called
ConfigMgr contains code that allows me to go from my configuration database to a System.Configuration.Configuration
object by way of a temporary file. The second class called Wcf, contains code specific
to my Wcf configuration implementation, and contains code inferred from reflector. 
&lt;/div&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;div&gt;All of the code in ConfigMgr uses public classes and is pretty simple.
&lt;/div&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 40.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 210px; background-color: #f4f4f4"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 39.65%; 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; height: 882px; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ConfigMgr
{ &lt;span style="color: #cc6633"&gt;#region&lt;/span&gt; MemberVars &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;const&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; configFileHeader
= &lt;span style="color: #006080"&gt;"&amp;lt;?xml version=\"1.0\"?&amp;gt;&amp;lt;configuration&amp;gt;"&lt;/span&gt;; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;const&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; configFileFooter
= &lt;span style="color: #006080"&gt;"&amp;lt;/configuration&amp;gt;"&lt;/span&gt;; &lt;span style="color: #cc6633"&gt;#endregion&lt;/span&gt; &lt;span style="color: #cc6633"&gt;#region&lt;/span&gt; Methods
- Public &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; ConfigurationSection
GetSection(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; configKey, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; xmlConfigFileHeaderExtra, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; xmlConfigFileFooterExtra, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; sectionName)
{ &lt;span style="color: #008000"&gt;//Get an xml document from the configuration database
to store as a tempory file.&lt;/span&gt; System.Xml.XmlDocument doc = PrepareXmlDocument(configKey,
xmlConfigFileHeaderExtra, xmlConfigFileFooterExtra); &lt;span style="color: #008000"&gt;//Now
write out to the temp file.&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; path
= System.IO.Path.GetTempFileName(); &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (System.Xml.XmlWriter
writer = System.Xml.XmlWriter.Create(path)) { doc.WriteTo(writer); writer.Close();
} &lt;span style="color: #008000"&gt;//Setup configuration file map so that we can use standard
file based config file&lt;/span&gt; ExeConfigurationFileMap map = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ExeConfigurationFileMap();
map.ExeConfigFilename = path; System.Configuration.Configuration config = ConfigurationManager.OpenMappedExeConfiguration(map,
ConfigurationUserLevel.None); &lt;span style="color: #008000"&gt;//Now return the specified
section&lt;/span&gt; &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; config.GetSection(sectionName);
} &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; System.Xml.XmlDocument
PrepareXmlDocument(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; configKey, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; xmlConfigFileHeaderExtra, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; xmlConfigFileFooterExtra)
{ System.Text.StringBuilder sb = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; System.Text.StringBuilder(); &lt;span style="color: #008000"&gt;//Append
header&lt;/span&gt; sb.Append(configFileHeader); sb.Append(xmlConfigFileHeaderExtra); sb.Append(ConfigHandler.GetValue(configKey)); &lt;span style="color: #008000"&gt;//Append
Footer&lt;/span&gt; sb.Append(xmlConfigFileFooterExtra); sb.Append(configFileFooter); System.Xml.XmlDocument
doc = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; System.Xml.XmlDocument(); doc.LoadXml(sb.ToString()); &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; doc;
} &lt;span style="color: #cc6633"&gt;#endregion&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;div&gt;The code in the Wcf class uses some methods I copied via reflector, and because
I don't know the legal ramifications of that, I am only providing an outline of what
I did.
&lt;/div&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;div&gt;GetBinding:
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
Calls ConfigMgr.Get section and returns the &amp;lt;bindings&amp;gt; section. This is cast
to a BindingsSection object.&lt;/li&gt;
&lt;li&gt;
Code taken from System.ServiceModel.Configuration creates a BindingCollectionElement
which is the correct type associated with the binding stored in the XML config. 
&lt;/li&gt;
&lt;li&gt;
A new binding object is created using Activator.CreateInstance(BindingCollectionElement.BindingType)&lt;/li&gt;
&lt;li&gt;
Additional code taken from System.ServiceModel.Configuration loops thru BindingCollectionElement.ConfiguredBindings
and initializes the binding object previously created. A check is made to make sure
multiple bindings of the same type are not created.&lt;/li&gt;
&lt;li&gt;
Finally, the binding object is returned to the caller.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
GetChannelEndpointElement: This class uses only public classes and methods so I am
including it. EnpointElement contains the configuration data for an endpoint, including
the URI, identity, binding, and&amp;nbsp; binding configuration. The binding and binding
configuration data is actually passed to my GetBinding method to return the correct
binding with the correct binding configuration. 
&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 40.97%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 210px; background-color: #f4f4f4"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 45.55%; 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; height: 208px; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; ChannelEndpointElement
GetChannelEndpointElement(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; configKey) {
ClientSection section = (ClientSection)ConfigMgr.GetSection(configKey, system_ServiceModelAsOpenXml,
system_ServiceModelAsCloseXml, clientSection); &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (section
== &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;) &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ArgumentException(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #006080"&gt;"Client
section returned from config db for key {0} was null"&lt;/span&gt;, configKey)); &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (section.Endpoints.Count
!= 1) &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ArgumentException(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #006080"&gt;"There
must be exactly 1 endpoint returned from the configuration. {0} endpoints were returned
for key {1}"&lt;/span&gt;, section.Endpoints.Count, configKey)); &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; section.Endpoints[0];
}&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;div&gt;GetEndpointAddress: Another method I created which almost uses all public methods.
It takes a ChannelEnpointElement and returns a EndpointAddress which can be assigned
to a wcf proxy class. 
&lt;br&gt;
&lt;/div&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 40.98%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 183px; background-color: #f4f4f4"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 34.01%; 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; height: 160px; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; EndpointAddress
GetEndpointAddress(ChannelEndpointElement element) { &lt;span style="color: #008000"&gt;//Create
a new builder, as the endpoint address is an immutable class&lt;/span&gt; EndpointAddressBuilder
builder = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EndpointAddressBuilder(); builder.Identity
= LoadIdentity(element.Identity); builder.Uri = element.Address; &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; builder.ToEndpointAddress();
}&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;div&gt;LoadIdentity: This final method was taken from System.ServiceModel.Description.Configloader.
This method takes a IdentityElement (a property of ChannelEnpointElement) and returns
a EndpointIdentity which is passed to the EndpointAddressBuilder in my GetEndpointAddress
method. The method basically checks the the existence of certain properties, and if
one exists, it returns the appropriate identity using public factory methods.
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
EndpointIdentity.CreateUpnIdentity&lt;/li&gt;
&lt;li&gt;
EndpointIdentity.CreateSpnIdentity&lt;/li&gt;
&lt;li&gt;
EndpointIdentity.CreateDnsIdentity&lt;/li&gt;
&lt;li&gt;
EndpointIdentity.CreateRsaIdentity&lt;/li&gt;
&lt;li&gt;
EndpointIdentity.CreateX509CertificateIdentity&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
There is a identity type of certificate reference which I was unable to add support
for, because it referenced additional internal classes which I didn't want to duplicate
at this time since I had no need for that identity type. 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;Issues&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Since this is completely unsupported by Microsoft, and uses code that was never meant
for external use, in a future version of the framework, something could break. I'm
also not an legal expert when it comes with what someone can do with MSIL code discovered
thru reflector, so for now, the actual code I wrote is not available publicly. Hopefully
I provided enough information to allow someone to reproduce my steps and implement
something on their own. 
&lt;/p&gt;
&lt;p&gt;
Another somewhat disappointing realization I came to, was that this might make it
hard to support write operations to my configuration database. Currently the configuration
database is managed thru scripts and direct editing. If write support to the config
database became a requirement, I'd probably try to do the reverse and use the built
in file save functionality in System.Configuration to save a temporary xml file, read
it and then store it into my config database. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
This was my first attempt at doing something like this, digging into framework code
to see how it really works and trying to come up with a solution. I'm going to go
forward using the code I wrote outlined in this post, as I have full read support
for WCF XML configuration. The amount of code I had to write and test is significantly
less then if I would have wanted to get the same amount of functionality (configuration
support for all bindings and endpoint configurations).
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=91b3aa3a-6adf-4cae-ab9a-6da36babe318" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,91b3aa3a-6adf-4cae-ab9a-6da36babe318.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=66636aa8-4039-4f83-bc30-f4e80e15a17e</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,66636aa8-4039-4f83-bc30-f4e80e15a17e.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,66636aa8-4039-4f83-bc30-f4e80e15a17e.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=66636aa8-4039-4f83-bc30-f4e80e15a17e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In a recent email from MSDN Flash, I first learned of the new Parallel Extensions
to the .Net Framework 3.5. This is an out of band release that is currently available
as a <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=e848dc1d-5be3-4941-8705-024bc7f180ba&amp;displaylang=en">CTP
on Microsoft Downloads</a>.
</p>
        <p>
The description in the MSDN Flash newsletter has me pretty excited about what this
offers.
</p>
        <blockquote>
          <p>
[Parallel Extensions] is a managed programming model for data parallelism, task parallelism,
and coordination on parallel hardware unified by a common work scheduler.
</p>
          <p>
...
</p>
          <p>
Parallel Extensions provides library-based support for introducing concurrency into
applications written in with any .NET language, including but not limited to C# and
Visual Basic. 
</p>
        </blockquote>
        <p>
It is specifically designed to take advantage of multi-core processors (among other
things), which is important due to the recent (last 2 years) shift in the industry
from raw clock speed to multi-core.
</p>
        <blockquote>
          <p>
The computational power of multi-core processors, new programming models and platforms,
and advanced research in usability all promise to change the way people interact with
computers.
</p>
        </blockquote>
        <p>
While excited, I do have some reservations. Encapsulating the lower level knowledge
needed to take advantage of multiple cores will speed up development, but it will
reduce the number of programmers who know how that lower level stuff needs to be written.
The concepts used to take advantage of multi-cores, should be very similar to those
required to take advantage of multi-threading, which is more "widely available" on
the compact framework (although I am seeing more and more embedded computers with
Core 2 Duo's). If this framework is only available for the full framework, the pool
of skilled workers available for the compact framework could diminish (even more so). 
</p>
        <p>
I actually have more of a need to take advantage of multi-threading, and parallel
processing in compact framework applications. As far as asp.net applications, I would
like to see if this is something that would be recommended for them. Long running
processes that would take advantage of this new framework, are usually best left outside
the asp.net application. Speaking of long running processes, that is the 3rd area
I work in, and in a traditional environment, would love to take advantage of this.
However, the applications I am writing are all running on VMWare ESX, and IT has it
set so that each VM only has a single CPU, and puts the burden of scheduling the 8
physical cores on ESX itself.
</p>
        <p>
This will probably end up being something I try to work into personal projects. Unfortunately,
I do not have the time to play with the CTP at this moment, but it is something I
defiantly want to look into in the future. 
</p>
        <p>
          <strong>Additional Information:</strong>
        </p>
        <ul>
          <li>
            <a href="http://msdn2.microsoft.com/en-us/concurrency/default.aspx">MSDN Developer
Center</a>
          </li>
        </ul>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=66636aa8-4039-4f83-bc30-f4e80e15a17e" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Parallel Extensions</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,66636aa8-4039-4f83-bc30-f4e80e15a17e.aspx</guid>
      <link>http://blog.salvoz.com/2007/12/04/ParallelExtensions.aspx</link>
      <pubDate>Tue, 04 Dec 2007 16:12:27 GMT</pubDate>
      <description>&lt;p&gt;
In a recent email from MSDN Flash, I first learned of the new Parallel Extensions
to the .Net Framework 3.5. This is an out of band release that is currently available
as a &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=e848dc1d-5be3-4941-8705-024bc7f180ba&amp;amp;displaylang=en"&gt;CTP
on Microsoft Downloads&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The description in the MSDN Flash newsletter has me pretty excited about what this
offers.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
[Parallel Extensions] is a managed programming model for data parallelism, task parallelism,
and coordination on parallel hardware unified by a common work scheduler.
&lt;/p&gt;
&lt;p&gt;
...
&lt;/p&gt;
&lt;p&gt;
Parallel Extensions provides library-based support for introducing concurrency into
applications written in with any .NET language, including but not limited to C# and
Visual Basic. 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
It is specifically designed to take advantage of multi-core processors (among other
things), which is important due to the recent (last 2 years) shift in the industry
from raw clock speed to multi-core.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
The computational power of multi-core processors, new programming models and platforms,
and advanced research in usability all promise to change the way people interact with
computers.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
While excited, I do have some reservations. Encapsulating the lower level knowledge
needed to take advantage of multiple cores will speed up development, but it will
reduce the number of programmers who know how that lower level stuff needs to be written.
The concepts used to take advantage of multi-cores, should be very similar to those
required to take advantage of multi-threading, which is more "widely available" on
the compact framework (although I am seeing more and more embedded computers with
Core 2 Duo's). If this framework is only available for the full framework, the pool
of skilled workers available for the compact framework could diminish (even more so). 
&lt;/p&gt;
&lt;p&gt;
I actually have more of a need to take advantage of multi-threading, and parallel
processing in compact framework applications. As far as asp.net applications, I would
like to see if this is something that would be recommended for them. Long running
processes that would take advantage of this new framework, are usually best left outside
the asp.net application. Speaking of long running processes, that is the 3rd area
I work in, and in a traditional environment, would love to take advantage of this.
However, the applications I am writing are all running on VMWare ESX, and IT has it
set so that each VM only has a single CPU, and puts the burden of scheduling the 8
physical cores on ESX itself.
&lt;/p&gt;
&lt;p&gt;
This will probably end up being something I try to work into personal projects. Unfortunately,
I do not have the time to play with the CTP at this moment, but it is something I
defiantly want to look into in the future. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Additional Information:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/concurrency/default.aspx"&gt;MSDN Developer
Center&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=66636aa8-4039-4f83-bc30-f4e80e15a17e" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,66636aa8-4039-4f83-bc30-f4e80e15a17e.aspx</comments>
      <category>Technology/Programming</category>
      <category>Technology/Review For Future Projects</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=bd0d7a65-97d9-4578-baf4-6803b4eeb941</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,bd0d7a65-97d9-4578-baf4-6803b4eeb941.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,bd0d7a65-97d9-4578-baf4-6803b4eeb941.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=bd0d7a65-97d9-4578-baf4-6803b4eeb941</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Avoiding Development Disasters is the tile of an <a href="http://worsethanfailure.com/Articles/Avoiding-Development-Disasters.aspx">article</a> I
came across today and talks about how and why software projects fail. Here's what
I got out of the article.
</p>
        <blockquote>
          <p>
            <strong>FBI Virtual Case File</strong>
          </p>
          <p>
The article opens up talking about the monumental failure that is/was the VCF and
touches 6 factors which lead to the projects failure.
</p>
          <ul>
            <li>
Lack of an Enterprise Architecture - Unfortunately the article doesn't go into what
they did have, have not. 
</li>
            <li>
Poor management of developers, including a lack of management or micro-management</li>
            <li>
Unqualified persons were placed in critical roles</li>
            <li>
Constantly changing requirements</li>
            <li>
Scope Creep</li>
            <li>
Throwing more developers at the project in a last ditch effort to meet deadlines.</li>
          </ul>
        </blockquote>
        <blockquote>
          <p>
I am personally experiencing 3 of the listed items on a current development project,
although it's far from a $100 million dollar system, I bet there are some striking
similarities. I would imagine that every project at every company experiences 1 or
more of the things in that list to some extent or another. 
</p>
          <p>
            <strong>What is Success?</strong>
          </p>
          <p>
The VCF was eventually scrapped, but the author claims, that had it gone to production,
it would have been deemed a success, even with all it's flaws. The author goes on
to say that this is the general practice in the software industry (at least enterprise
applications). As much as I like Microsoft, I think Vista is a shining example of
this (although perhaps it is deemed less of a success inside of Microsoft). 
</p>
          <p>
I have to agree, and would be willing to say it's common in software projects in general,
from small to large. How many times is a game released, and the day of, a patch is
released? Even Epic Games, creators of the Unreal platform, and who coined the phrase
"When it's done", still manage to release a product with known issues. 
</p>
          <p>
I'm not trying to criticize any one company or developer, other then myself, as I
have created some less then magnificent code over my short life as a developer. I
think part of the problem is that there are no points for creating good code. At the
end of the day, "Well it works doesn't it?" pays the bills. 
</p>
          <p>
Why is it so hard to write code, almost 30-40 years since the first programs were
written? We have better tools, faster computers, and years of other people's failures
to learn from, and here we are, still producing less then our potential.
</p>
          <p>
            <strong>The Code to Ruin</strong>
          </p>
          <p>
The diagram "The Code to Ruin" presented in the article is so true, it's scary. You
pretty much know what's going to happen before you start the project, but you still
can't avoid it. That's depressing at best. 
</p>
          <p>
            <strong>Maintainability</strong>
          </p>
          <p>
The article spends the last half, talking about the maintainability of code. Without
code that is maintainable, while you launch may be a success, you next point release
is probably going to be a failure. The article states that enterprise software should
have a 15 year life span, that's longer then I have been coding. 
</p>
          <p>
I think ideas such as software as a service might help us reach that goal, and have
more maintainable code overall. I'm not taking about providing software as a service,
I mean, that the internal make up of your application is constructed from (loosely
coupled) services. Breaking stuff down into more manageable pieces seems to be the
way to go. We already do it with proper OOD design, we should also be applying it
to the system in general. Of course there is a trade off, the most notable to me being
one of performance, but that's what these faster computers are for ;)
</p>
        </blockquote>
        <p>
All in all, it was a good article, and made me really think about software projects,
both past and current that I am working on. I have to imagine that there are people
out there that would be the perfect compliment to a talented programmer such as myself
(well at least I think I'm talented). Or, does it mean, that I need to spend less
time with technology and programming, and learn more skills like project management,
documentation, business analysis, etc.? To specialize, or generalize, that is the
question?
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=bd0d7a65-97d9-4578-baf4-6803b4eeb941" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Avoiding Development Disasters</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,bd0d7a65-97d9-4578-baf4-6803b4eeb941.aspx</guid>
      <link>http://blog.salvoz.com/2007/12/01/AvoidingDevelopmentDisasters.aspx</link>
      <pubDate>Sat, 01 Dec 2007 01:29:49 GMT</pubDate>
      <description>&lt;p&gt;
Avoiding Development Disasters is the tile of an &lt;a href="http://worsethanfailure.com/Articles/Avoiding-Development-Disasters.aspx"&gt;article&lt;/a&gt; I
came across today and talks about how and why software projects fail. Here's what
I got out of the article.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;FBI Virtual Case File&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The article opens up talking about the monumental failure that is/was the VCF and
touches 6 factors which lead to the projects failure.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Lack of an Enterprise Architecture - Unfortunately the article doesn't go into what
they did have, have not. 
&lt;/li&gt;
&lt;li&gt;
Poor management of developers, including a lack of management or micro-management&lt;/li&gt;
&lt;li&gt;
Unqualified persons were placed in critical roles&lt;/li&gt;
&lt;li&gt;
Constantly changing requirements&lt;/li&gt;
&lt;li&gt;
Scope Creep&lt;/li&gt;
&lt;li&gt;
Throwing more developers at the project in a last ditch effort to meet deadlines.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
I am personally experiencing 3 of the listed items on a current development project,
although it's far from a $100 million dollar system, I bet there are some striking
similarities. I would imagine that every project at every company experiences 1 or
more of the things in that list to some extent or another. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;What is Success?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The VCF was eventually scrapped, but the author claims, that had it gone to production,
it would have been deemed a success, even with all it's flaws. The author goes on
to say that this is the general practice in the software industry (at least enterprise
applications). As much as I like Microsoft, I think Vista is a shining example of
this (although perhaps it is deemed less of a success inside of Microsoft). 
&lt;/p&gt;
&lt;p&gt;
I have to agree, and would be willing to say it's common in software projects in general,
from small to large. How many times is a game released, and the day of, a patch is
released? Even Epic Games, creators of the Unreal platform, and who coined the phrase
"When it's done", still manage to release a product with known issues. 
&lt;/p&gt;
&lt;p&gt;
I'm not trying to criticize any one company or developer, other then myself, as I
have created some less then magnificent code over my short life as a developer. I
think part of the problem is that there are no points for creating good code. At the
end of the day, "Well it works doesn't it?" pays the bills. 
&lt;/p&gt;
&lt;p&gt;
Why is it so hard to write code, almost 30-40 years since the first programs were
written? We have better tools, faster computers, and years of other people's failures
to learn from, and here we are, still producing less then our potential.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;The Code to Ruin&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The diagram "The Code to Ruin" presented in the article is so true, it's scary. You
pretty much know what's going to happen before you start the project, but you still
can't avoid it. That's depressing at best. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Maintainability&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The article spends the last half, talking about the maintainability of code. Without
code that is maintainable, while you launch may be a success, you next point release
is probably going to be a failure. The article states that enterprise software should
have a 15 year life span, that's longer then I have been coding. 
&lt;/p&gt;
&lt;p&gt;
I think ideas such as software as a service might help us reach that goal, and have
more maintainable code overall. I'm not taking about providing software as a service,
I mean, that the internal make up of your application is constructed from (loosely
coupled) services. Breaking stuff down into more manageable pieces seems to be the
way to go. We already do it with proper OOD design, we should also be applying it
to the system in general. Of course there is a trade off, the most notable to me being
one of performance, but that's what these faster computers are for ;)
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
All in all, it was a good article, and made me really think about software projects,
both past and current that I am working on. I have to imagine that there are people
out there that would be the perfect compliment to a talented programmer such as myself
(well at least I think I'm talented). Or, does it mean, that I need to spend less
time with technology and programming, and learn more skills like project management,
documentation, business analysis, etc.? To specialize, or generalize, that is the
question?
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=bd0d7a65-97d9-4578-baf4-6803b4eeb941" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,bd0d7a65-97d9-4578-baf4-6803b4eeb941.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=4a5b95f2-b8d9-47c3-a366-2a2498dd5879</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,4a5b95f2-b8d9-47c3-a366-2a2498dd5879.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,4a5b95f2-b8d9-47c3-a366-2a2498dd5879.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=4a5b95f2-b8d9-47c3-a366-2a2498dd5879</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Found some more <a href="http://blogs.msdn.com/bharry/archive/2007/11/22/2008-installation-questions.aspx">information</a> on
TFS 2008 RTM from bharry's blog on MSDN. Most important to me and my team, is that
the RTM media is not available for volume license customers until sometime in January.
However, you could upgrade to the RTM Trial, and then add in your PID (Product ID) in
January when it's finally available. The trial is good for 90 days, and bharry assures
his readers that PID's for volume license customers will be available before then,
and if not to contact him directly. 
</p>
        <p>
Upgrading to RTM sounds like something I will probably do around Christmas, as it's
usually a slow week anyway. This would give me until the end of March to get my PID,
which is probably close to when the beta we are currently running would be expiring
anyway. Speaking of upgrading, it sounds like the process outlined by ScottGu which
I talk about in my <a href="http://blog.salvoz.com/2007/11/22/MovingFromVS2008Beta2ToRTM.aspx">previous
post</a>, also apply to TFS.  There is a <a href="http://blogs.infosupport.com/marcelv/archive/2007/11/21/Upgrading-Visual-studio-Team-System-Beta-to-RTM-uninstall-scripts.aspx">link</a> script
on bharry's post, which is supposed to help with the process. I will try to use the
script for when I update my primary workstation, and will report back on how well
it works.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=4a5b95f2-b8d9-47c3-a366-2a2498dd5879" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>TFS 2008 RTM</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,4a5b95f2-b8d9-47c3-a366-2a2498dd5879.aspx</guid>
      <link>http://blog.salvoz.com/2007/11/27/TFS2008RTM.aspx</link>
      <pubDate>Tue, 27 Nov 2007 20:38:48 GMT</pubDate>
      <description>&lt;p&gt;
Found some more &lt;a href="http://blogs.msdn.com/bharry/archive/2007/11/22/2008-installation-questions.aspx"&gt;information&lt;/a&gt;&amp;nbsp;on
TFS 2008 RTM from bharry's blog on MSDN. Most important to me and my team, is that
the RTM media is not available for volume license customers until sometime in January.
However, you could upgrade to the RTM Trial, and then add in your PID (Product ID)&amp;nbsp;in
January when it's finally available. The trial is good for 90 days, and bharry assures
his readers that PID's for volume license customers will be available before then,
and if not to contact him directly. 
&lt;/p&gt;
&lt;p&gt;
Upgrading to RTM sounds like something I will probably do around Christmas, as it's
usually a slow week anyway. This would give me until the end of March to get my PID,
which is probably close to when the beta we are currently running would be expiring
anyway. Speaking of upgrading, it sounds like the process outlined by ScottGu which
I talk about in my &lt;a href="http://blog.salvoz.com/2007/11/22/MovingFromVS2008Beta2ToRTM.aspx"&gt;previous
post&lt;/a&gt;,&amp;nbsp;also apply to TFS. &amp;nbsp;There is a &lt;a href="http://blogs.infosupport.com/marcelv/archive/2007/11/21/Upgrading-Visual-studio-Team-System-Beta-to-RTM-uninstall-scripts.aspx"&gt;link&lt;/a&gt; script
on bharry's post, which is supposed to help with the process. I will try to use the
script for when I update my primary workstation, and will report back on how well
it works.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=4a5b95f2-b8d9-47c3-a366-2a2498dd5879" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,4a5b95f2-b8d9-47c3-a366-2a2498dd5879.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=649074f1-6464-4c94-8363-1f5542317dc1</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,649074f1-6464-4c94-8363-1f5542317dc1.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,649074f1-6464-4c94-8363-1f5542317dc1.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=649074f1-6464-4c94-8363-1f5542317dc1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <strong>Note:</strong> While I didn't have any problems, I would recommend keeping
the iso for Beta 2 around until you are confident you got everything removed. Sometimes
software needs to get something from the original installer to uninstall.
</p>
        <p>
In case you have been living under a rock this week, VS 2008 RTM was released. I don't
expect to see much difference between Beta 2 and RTM, given how solid of a product
Beta 2 was. ScottGu has a <a href="http://weblogs.asp.net/scottgu/archive/2007/11/20/steps-to-uninstall-vs-2008-beta2-before-installing-the-vs-2008-final-release.aspx">post</a> on
the recommended steps to uninstall Beta2 and install the RTM version. It sounds like
you could install on the top of Beta 2, but I prefer to put forth the extra effort
to get a "clean" install, or at least as clean as I can get without wiping my machine
(is this another example of where moving to virtual platform would make sense?). 
</p>
        <p>
Of course the first step was to obtain VS 2008 Team Suite from MSDN, which was a bit
of a challenge earlier in the week. I'm assuming everyone was trying to get their
hands on it, and unless Microsoft is cheap when it comes to bandwidth (doubtful),
it goes to show how much people wanted this as soon as it was released. ScottGu had
a <a href="http://weblogs.asp.net/scottgu/archive/2007/11/19/visual-studio-2008-and-net-3-5-released.aspx">previous
post</a> about where to get all the bits (including the <a href="http://download.microsoft.com/download/6/0/f/60fc5854-3cb8-4892-b6db-bd4f42510f28/dotnetfx35.exe">3.5
redistributable</a>), and I found this <a href="http://geekswithblogs.net/hinshelm/archive/2007/11/19/RTM-Confusion.aspx">post</a> which
led me to the stand alone download for <a href="http://www.microsoft.com/downloads/details.aspx?familyid=0ED12659-3D41-4420-BBB0-A46E51BFCA86&amp;displaylang=en">Team
Explorer</a>.
</p>
        <p>
Next, I followed the recommended uninstall order. I'm glad that I don't install things
I know I will never use, less things to uninstall. The names provided in Scott's post
are word for word as they show up in Add/Remove programs, so feel free to sort by
name. Even with detailed instructions, I still managed to screw up. .Net Framework
3.5 looks very similar to .Net Compact Framework 3.5, and I ended up uninstalling
the full framework first. Not on the list, is Team Explorer, and Visual Studio itself.
I opted to uninstall Team Explorer first, and the process froze on me. 
</p>
        <p>
A "quick" reboot seemed to fix the problem. I proceeded with uninstalling Team Explorer,
and the two entries for Visual Studio. I also rebooted again as per Scott's recommendation,
and then began the install process, starting with Team Suite, and then Team Explorer
and a few more reboots and I was done.
</p>
        <p>
          <strong>Update: </strong>
        </p>
        <p>
I came across a <a href="http://blog.salvoz.com/ct.ashx?id=4a5b95f2-b8d9-47c3-a366-2a2498dd5879&amp;url=http%3a%2f%2fblogs.infosupport.com%2fmarcelv%2farchive%2f2007%2f11%2f21%2fUpgrading-Visual-studio-Team-System-Beta-to-RTM-uninstall-scripts.aspx">script</a> which
is supposed to help with the uninstall of the Beta Bits.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=649074f1-6464-4c94-8363-1f5542317dc1" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Moving from VS 2008 Beta 2 to RTM</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,649074f1-6464-4c94-8363-1f5542317dc1.aspx</guid>
      <link>http://blog.salvoz.com/2007/11/22/MovingFromVS2008Beta2ToRTM.aspx</link>
      <pubDate>Thu, 22 Nov 2007 17:51:50 GMT</pubDate>
      <description>&lt;p&gt;
&lt;strong&gt;Note:&lt;/strong&gt; While I didn't have any problems, I would recommend keeping
the iso for Beta 2 around until you are confident you got everything removed. Sometimes
software needs to get something from the original installer to uninstall.
&lt;/p&gt;
&lt;p&gt;
In case you have been living under a rock this week, VS 2008 RTM was released. I don't
expect to see much difference between Beta 2 and RTM, given how solid of a product
Beta 2 was. ScottGu has a &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/11/20/steps-to-uninstall-vs-2008-beta2-before-installing-the-vs-2008-final-release.aspx"&gt;post&lt;/a&gt; on
the recommended steps to uninstall Beta2 and install the RTM version. It sounds like
you could install on the top of Beta 2, but I prefer to put forth the extra effort
to get a "clean" install, or at least as clean as I can get without wiping my machine
(is this another example of where moving to virtual platform would make sense?). 
&lt;/p&gt;
&lt;p&gt;
Of course the first step was to obtain VS 2008 Team Suite from MSDN, which was a bit
of a challenge earlier in the week. I'm assuming everyone was trying to get their
hands on it, and unless Microsoft is cheap when it comes to bandwidth (doubtful),
it goes to show how much people wanted this as soon as it was released. ScottGu had
a &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/11/19/visual-studio-2008-and-net-3-5-released.aspx"&gt;previous
post&lt;/a&gt; about where to get all the bits (including the &lt;a href="http://download.microsoft.com/download/6/0/f/60fc5854-3cb8-4892-b6db-bd4f42510f28/dotnetfx35.exe"&gt;3.5
redistributable&lt;/a&gt;), and I found this &lt;a href="http://geekswithblogs.net/hinshelm/archive/2007/11/19/RTM-Confusion.aspx"&gt;post&lt;/a&gt; which
led me to the stand alone download for &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=0ED12659-3D41-4420-BBB0-A46E51BFCA86&amp;amp;displaylang=en"&gt;Team
Explorer&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Next, I followed the recommended uninstall order. I'm glad that I don't install things
I know I will never use, less things to uninstall. The names provided in Scott's post
are word for word as they show up in Add/Remove programs, so feel free to sort by
name. Even with detailed instructions, I still managed to screw up. .Net Framework
3.5 looks very similar to .Net Compact Framework 3.5, and I ended up uninstalling
the full framework first. Not on the list, is Team Explorer, and Visual Studio itself.
I opted to uninstall Team Explorer first, and the process froze on me. 
&lt;/p&gt;
&lt;p&gt;
A "quick" reboot seemed to fix the problem. I proceeded with uninstalling Team Explorer,
and the two entries for Visual Studio. I also rebooted again as per Scott's recommendation,
and then began the install process, starting with Team Suite, and then Team Explorer
and a few more reboots and I was done.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Update: &lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I came across a &lt;a href="http://blog.salvoz.com/ct.ashx?id=4a5b95f2-b8d9-47c3-a366-2a2498dd5879&amp;amp;url=http%3a%2f%2fblogs.infosupport.com%2fmarcelv%2farchive%2f2007%2f11%2f21%2fUpgrading-Visual-studio-Team-System-Beta-to-RTM-uninstall-scripts.aspx"&gt;script&lt;/a&gt; which
is supposed to help with the uninstall of the Beta Bits.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=649074f1-6464-4c94-8363-1f5542317dc1" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,649074f1-6464-4c94-8363-1f5542317dc1.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=89790816-bc6b-4d33-81d0-78973cfd2291</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,89790816-bc6b-4d33-81d0-78973cfd2291.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,89790816-bc6b-4d33-81d0-78973cfd2291.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=89790816-bc6b-4d33-81d0-78973cfd2291</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
As a follow up to my last post, I wanted to post a quick note about a change in the
location of AL.exe (assembly linker), in .Net 3.5. 
</p>
        <p>
I was attempting to use TFS Build to build a project that was 100% VS 2005 (basically
the solution was still a VS 2005 solution), but I was getting an error stating that
al.exe could not be found in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727, and that
I either needed to pass the path in to MSBuild, or, install the SDK. Not wanting to
install an older SKD, I opted for the path option, but then I needed to determine
the path. I figured a newer version of al.exe must be installed somewhere with .Net
3.5, and sure enough, it's under C:\Program Files\Microsoft SDKs\Windows\v6.0a\Bin.
</p>
        <p>
I checked out the TFSBuild.rsp file and added the following line:
</p>
        <p>
/p:ALToolPath="C:\Program Files\Microsoft SDKs\Windows\v6.0a\Bin"
</p>
        <p>
Checked it back in, and it worked.  
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=89790816-bc6b-4d33-81d0-78973cfd2291" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>TFS Build and AL.exe</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,89790816-bc6b-4d33-81d0-78973cfd2291.aspx</guid>
      <link>http://blog.salvoz.com/2007/11/05/TFSBuildAndALexe.aspx</link>
      <pubDate>Mon, 05 Nov 2007 15:58:30 GMT</pubDate>
      <description>&lt;p&gt;
As a follow up to my last post, I wanted to post a quick note about a change in the
location of AL.exe (assembly linker), in .Net 3.5. 
&lt;/p&gt;
&lt;p&gt;
I was attempting to use TFS Build to build a project that was 100% VS 2005 (basically
the solution was still a VS 2005 solution), but I was getting an error stating that
al.exe could not be found in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727, and that
I either needed to pass the path in to MSBuild, or, install the SDK. Not wanting to
install an older SKD, I opted for the path option, but then I needed to determine
the path. I figured a newer version of al.exe must be installed somewhere with .Net
3.5, and sure enough, it's under C:\Program Files\Microsoft SDKs\Windows\v6.0a\Bin.
&lt;/p&gt;
&lt;p&gt;
I checked out the TFSBuild.rsp file and added the following line:
&lt;/p&gt;
&lt;p&gt;
/p:ALToolPath="C:\Program Files\Microsoft SDKs\Windows\v6.0a\Bin"
&lt;/p&gt;
&lt;p&gt;
Checked it back in, and it worked. &amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=89790816-bc6b-4d33-81d0-78973cfd2291" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,89790816-bc6b-4d33-81d0-78973cfd2291.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=5aeeadaa-1e97-4042-bd76-9264048aaf21</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,5aeeadaa-1e97-4042-bd76-9264048aaf21.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,5aeeadaa-1e97-4042-bd76-9264048aaf21.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5aeeadaa-1e97-4042-bd76-9264048aaf21</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
With our migration to VS 2008 (Beta 2) complete, the next task was to formally adopt
an automate build process, and we chose Team Build as the software to drive that process.
Previously I had setup <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET">CC.Net</a>,
as I had used it at a prior job so I was familiar with out. However, there was never
a buy in from the whole team, so no one except me really cared when the build broke,
or how to go about fixing it. 
</p>
        <p>
As part of our migration plan, we have gotten buy in from the entire team (IS) on
an automated build process, so for at least a the development and testing level we
will have an automated process. The next step after that, is using Team Build to actually
automate the deployment to our staging and production environments, such that we can
easily deploy small, and large changes in an efficient, consistent, and error free
manor.
</p>
        <p>
One of the downsides to development, at least for me, is the task of deploying a change
to production. There is usually a lengthy change management process, a number of documented
(and un documented) steps needed to do the actual deployment, and then a series of
manual tests to run to make sure everything is still working. At a <a href="http://blog.salvoz.com/2007/09/14/ArcReady.aspx">presentation</a> I
attended as part of the <a href="http://www.arcready.com/">ARCReady</a> series, the
concept of a truly automated build and deployment process was presented, and that
concept is what I hope to accomplish (eventually) on my <a href="http://www.tersosolutions.com">current
project</a>.
</p>
        <p>
The first step in achieving my utopia, is to start with a simple build that can be
invoked at anytime. I actually have another developer working on setting up the builds
for our main project. The project I'm using for this example, is for our smart devices.
</p>
        <p>
To get started, open Visual Studio and select New Build Definition from the Build
Menu. This opens up a dialog box with 6 tabs/sections listed on the right, and the
tab details on the left. The General, Project File and Build Defaults require information
in order to proceed. Workspace, Retention Policy and Trigger all have defaults chosen,
but you can change them if so desired. When you are done configuring all of the tabs,
click OK.
</p>
        <ul>
          <li>
General: 
</li>
        </ul>
        <blockquote>
          <p>
Build definition name, an optional description, and a checkbox to enable or disable
the build. I named the build "ProjectName - All", and entered a short description
of what I hoped to accomplish with the build. 
</p>
        </blockquote>
        <ul>
          <li>
Workspaces: 
</li>
        </ul>
        <blockquote>
          <p>
You need to select a Source Control Folder, and a Local folder. The defaults are the
root of the project in TFS, and a folder defined as $(SourceDir) 
</p>
        </blockquote>
        <ul>
          <li>
Project File: 
</li>
        </ul>
        <blockquote>
          <p>
Here you select the MSBuild file used to define the build. The default location is
$/ProjectRoot/TeamBuildTypes/BuildDefinitionName. If there is no TFSBuild.proj file
in the location, you will have the option to created one, which is what I did here. 
</p>
          <p>
Choosing to create a new TFSBuild file, bring up a new dialog that will allow you
to select a solution in the workspace, 1+ configuration options (i.e. debug or release
and target platform), and build options (unit tests, code analysis, etc). I happen
to have a solution in this workspace, so I am using it, and chose to build both a
debug and release version. 
</p>
          <p>
When you are finished with the TFSBuild options, click finsih to return to the Build
Definition dialog
</p>
        </blockquote>
        <ul>
          <li>
Retention Policy:</li>
        </ul>
        <blockquote>
          <p>
Here you describe how builds should be retained, and the values you choose is completely
dependent on your individual needs. For now, I'm selecting "Keep Latest Only" for
Failed, Stopped and Partially Succeeded, and "Keep 5 Latest" for Succeeded.
</p>
        </blockquote>
        <ul>
          <li>
 Build Defaults:</li>
        </ul>
        <blockquote>
          <p>
You need to specify a default Build Agent (computer running Team Build), and a staging
share. I was surprised to see that the Build agent we had already defined in another
project, was not available in the drop down list. I recreated it by clicking the New
button. I had to sepcifcy a Agent Name, computer name, and working directory (defaulted
to $(Temp)\$BuildDefinitionPath)). If you don't want the source downloaded and built
from C:\Documents and Settings\TFSServiceAccountName\Local Settings\Temp\Projectname\BuildName,
change the working directory here. 
</p>
          <p>
Since the team working on this project is a little different, I've setup a different
folder/share for this project so that I can assign appropriate share and NTFS
rights. 
</p>
        </blockquote>
        <ul>
          <li>
Trigger:</li>
        </ul>
        <blockquote>
          <p>
Finally, you can select when to build. Options include manual (check-ins do not trigger
a new build), Build each check-in, Accumulate check-ins until the prior build finishes,
build every week on the following days. 
</p>
          <p>
For requirements, I am choosing the manual build option. 
</p>
        </blockquote>
        <p>
You new build definition should show up under TFSServer\Proejct\Builds in Team Explorer.
Right click on the build and choose Queue New Build. Here you can select the build
definition (defaults to the build you right clicked on), Build Agent, drop folder
for the build (defaults to the folder you chose under Build Defaults), a queue priority,
and option MSBuild command line arguments. 
</p>
        <p>
My build started, and downloaded all of the source from the root of the Project, which
is somewhat undesirable, as it's not all needed. Also, it would be better if the build
kicked off from a specific project within the solution I had selected. However, I'm
in a pretty good position right now, I just need to tweak some stuff. When the build
fails, a new bug is created, and if you have email alerts setup, you will be notified. 
</p>
        <p>
          <strong>Issues Resolved:</strong>
        </p>
        <ul>
          <li>
Limit the amount of source downloaded (don't download the entire tree starting at
$/Project</li>
        </ul>
        <blockquote>
          <p>
I solved this, at least for now, by going back into the build definition, and editing
the workspace mapping. I change the default from $/Project -&gt; $(Source) to $/Project/Folder
-&gt; $(Source)\Folder. Not only will this limit the amount of source downloaded,
it is also used to 
</p>
        </blockquote>
        <ul>
          <li>
Reference Paths</li>
        </ul>
        <blockquote>
          <p>
There is a section in the TFSBuild.csproj file for specifying reference paths. This
is very useful when you have those developers who always add a reference in a nonstandard
location and break the build. It is specified in an item group property, as a child
of the root &lt;Project&gt; element. In my file, it was inserted at the end. I am
going to try to insert this into a .targets file that I can reference from multiple
build files.
</p>
        </blockquote>
        <blockquote>
          <div>
            <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: #0000ff">&lt;</span>
              <span style="color: #800000">ItemGroup</span>
              <span style="color: #0000ff">&gt;</span>
              <span style="color: #008000">&lt;!--
ADDITIONAL REFERENCE PATH</span>
              <span style="color: #008000"> The list of additional
reference paths to use while resolving references. For example:</span>
              <span style="color: #008000">
              </span>
              <span style="color: #008000"> &lt;AdditionalReferencePath
Include="C:\MyFolder\" /&gt;</span>
              <span style="color: #008000"> &lt;AdditionalReferencePath
Include="C:\MyFolder2\" /&gt;</span>
              <span style="color: #008000"> --&gt;</span>
              <span style="color: #0000ff">&lt;/</span>
              <span style="color: #800000">ItemGroup</span>
              <span style="color: #0000ff">&gt;</span>
            </pre>
          </div>
          <p>
 
</p>
        </blockquote>
        <ul>
          <li>
Get a specific version (label)</li>
        </ul>
        <blockquote>
          <p>
I should have realized this earlier, but without an option in the Queue Build GUI,
my need for building a specific version from a label drops significantly. I wanted
QA to be able to build a version from a label, as defined by the dev team, such that
the dev team could move on and start developing and checking in without impacting
QA. The only "supported" way to get a specific version is to override the CoreGet
task (see Ref #8), which means QA would have to check out and modify the TFSBuild.csproj
file.
</p>
        </blockquote>
        <p>
          <strong>Open Issues:</strong>
        </p>
        <ul>
          <li>
Select a specific project in a solution to build from.</li>
          <ul>
            <li>
Current work around, is to create a new solution, or modify the solution I've been
using to unselect some problem projects.</li>
          </ul>
        </ul>
        <p>
          <strong>Miscellaneous:</strong>
        </p>
        <ul>
          <li>
Read on Buck's blog that you have to have an interactive session running on the build
server to do automated UI tests. He has instructions on how to do this. (See Ref #5) 
</li>
          <li>
Extending the TFSBuild.csproj file. You can define reusable .targets files, which
are just MSBuild files, and then import them into the TFSBuild.csproj file using &lt;Import
Project="Path\FileName.targets"/&gt; 
</li>
          <li>
You can add tasks based on TF Build targets in either the TFSBuild.csproj file, or
your imported .targets. (See Ref #2) 
</li>
          <li>
You can do incremental builds by setting the SkipClean property to true (See Ref #3). 
</li>
          <li>
The .rsp file that is created with the TFSBuild.csproj file is a file that is used
to pass command line arguments to MSBuild (See Ref #7).</li>
        </ul>
        <p>
          <strong>References: </strong>
        </p>
        <ol>
          <li>
            <a href="http://msdn2.microsoft.com/en-us/library/ms181286(VS.80).aspx">MSDN Documentation</a>
          </li>
          <li>
            <a href="http://msdn2.microsoft.com/en-us/library/aa337604(vs.90).aspx">Customizable
Team Foundation Build Targets</a>
          </li>
          <li>
            <a href="http://msdn2.microsoft.com/en-us/library/bb399127(VS.90).aspx">How to: Customize
the SolutionToBuild Item Group</a>
          </li>
          <li>
            <a href="http://blogs.msdn.com/buckh/">Buck Hodges Blog</a>
          </li>
          <li>
            <a href="http://blogs.msdn.com/buckh/archive/2007/08/14/tfs-2008-a-basic-guide-to-team-build-2008.aspx">Buck's
basic guide to Team Build 2008</a>
          </li>
          <li>
            <a href="http://msdn2.microsoft.com/en-us/library/aa833876(VS.90).aspx">Incremental
Builds</a>
          </li>
          <li>
            <a href="http://msdn2.microsoft.com/en-us/library/ms164311(VS.90).aspx">MSBuild command
line reference</a>
          </li>
          <li>
            <a href="http://blogs.msdn.com/nagarajp/archive/2005/10/21/483590.aspx">Get a specific
version</a>
          </li>
        </ol>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=5aeeadaa-1e97-4042-bd76-9264048aaf21" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>My first TFS Build</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,5aeeadaa-1e97-4042-bd76-9264048aaf21.aspx</guid>
      <link>http://blog.salvoz.com/2007/11/04/MyFirstTFSBuild.aspx</link>
      <pubDate>Sun, 04 Nov 2007 22:19:19 GMT</pubDate>
      <description>&lt;p&gt;
With our migration to VS 2008 (Beta 2) complete, the next task was to formally adopt
an automate build process, and we chose Team Build as the software to drive that process.
Previously I had setup &lt;a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET"&gt;CC.Net&lt;/a&gt;,
as I had used it at a prior job so I was familiar with out. However, there was never
a buy in from the whole team, so no one except me really cared when the build broke,
or how to go about fixing it. 
&lt;/p&gt;
&lt;p&gt;
As part of our migration plan, we have gotten buy in from the entire team (IS)&amp;nbsp;on
an automated build process, so for at least a the development and testing level we
will have an automated process. The next step after that, is using Team Build to actually
automate the deployment to our staging and production environments, such that we can
easily deploy small, and large changes in an efficient, consistent, and error free
manor.
&lt;/p&gt;
&lt;p&gt;
One of the downsides to development, at least for me, is the task of deploying a change
to production. There is usually a lengthy change management process, a number of documented
(and un documented) steps needed to do the actual deployment, and then a series of
manual tests to run to make sure everything is still working. At a &lt;a href="http://blog.salvoz.com/2007/09/14/ArcReady.aspx"&gt;presentation&lt;/a&gt; I
attended as part of the &lt;a href="http://www.arcready.com/"&gt;ARCReady&lt;/a&gt; series, the
concept of a truly automated build and deployment process was presented, and that
concept is what I hope to accomplish (eventually) on my &lt;a href="http://www.tersosolutions.com"&gt;current
project&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The first step in achieving my utopia, is to start with a simple build that can be
invoked at anytime. I actually have another developer working on setting up the builds
for our main project. The project I'm using for this example, is for our smart devices.
&lt;/p&gt;
&lt;p&gt;
To get started, open Visual Studio and select New Build Definition from the Build
Menu. This opens up a dialog box with 6 tabs/sections listed on the right, and the
tab details on the left. The General, Project File and Build Defaults require information
in order to proceed. Workspace, Retention Policy and Trigger all have defaults chosen,
but you can change them if so desired. When you are done configuring all of the tabs,
click OK.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
General: 
&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Build definition name, an optional description, and a checkbox to enable or disable
the build. I named the build "ProjectName - All", and entered a short description
of what I hoped to accomplish with the build. 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;ul&gt;
&lt;li&gt;
Workspaces: 
&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt; 
&lt;p&gt;
You need to select a Source Control Folder, and a Local folder. The defaults are the
root of the project in TFS, and a folder defined as $(SourceDir) 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;ul&gt;
&lt;li&gt;
Project File: 
&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Here you select the MSBuild file used to define the build. The default location is
$/ProjectRoot/TeamBuildTypes/BuildDefinitionName. If there is no TFSBuild.proj file
in the location, you will have the option to created one, which is what I did here. 
&lt;/p&gt;
&lt;p&gt;
Choosing to create a new TFSBuild file, bring up a new dialog that will allow you
to select a solution in the workspace, 1+ configuration options (i.e. debug or release
and target platform), and build options (unit tests, code analysis, etc). I happen
to have a solution in this workspace, so I am using it, and chose to build both a
debug and release version. 
&lt;/p&gt;
&lt;p&gt;
When you are finished with the TFSBuild options, click finsih to return to the Build
Definition dialog
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;ul&gt;
&lt;li&gt;
Retention Policy:&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Here you describe how builds should be retained, and the values you choose is completely
dependent on your individual needs. For now, I'm selecting "Keep Latest Only" for
Failed, Stopped and Partially Succeeded, and "Keep 5 Latest" for Succeeded.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;ul&gt;
&lt;li&gt;
&amp;nbsp;Build Defaults:&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt; 
&lt;p&gt;
You need to specify a default Build Agent (computer running Team Build), and a staging
share. I was surprised to see that the Build agent we had already defined in another
project, was not available in the drop down list. I recreated it by clicking the New
button. I had to sepcifcy a Agent Name, computer name, and working directory (defaulted
to $(Temp)\$BuildDefinitionPath)). If you don't want the source downloaded and built
from C:\Documents and Settings\TFSServiceAccountName\Local Settings\Temp\Projectname\BuildName,
change the working directory here. 
&lt;/p&gt;
&lt;p&gt;
Since the team working on this project is a little different, I've setup a different
folder/share for this project so that I can assign appropriate share and&amp;nbsp;NTFS
rights. 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;ul&gt;
&lt;li&gt;
Trigger:&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Finally, you can select when to build. Options include manual (check-ins do not trigger
a new build), Build each check-in, Accumulate check-ins until the prior build finishes,
build every week on the following days. 
&lt;/p&gt;
&lt;p&gt;
For&amp;nbsp;requirements, I am choosing the manual build option. 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
You new build definition should show up under TFSServer\Proejct\Builds in Team Explorer.
Right click on the build and choose Queue New Build. Here you can select the build
definition (defaults to the build you right clicked on), Build Agent, drop folder
for the build (defaults to the folder you chose under Build Defaults), a queue priority,
and option MSBuild command line arguments. 
&lt;/p&gt;
&lt;p&gt;
My build started, and downloaded all of the source from the root of the Project, which
is somewhat undesirable, as it's not all needed. Also, it would be better if the build
kicked off from a specific project within the solution I had selected. However, I'm
in a pretty good position right now, I just need to tweak some stuff. When the build
fails, a new bug is created, and if you have email alerts setup, you will be notified. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Issues Resolved:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Limit the amount of source downloaded (don't download the entire tree starting at
$/Project&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt; 
&lt;p&gt;
I solved this, at least for now, by going back into the build definition, and editing
the workspace mapping. I change the default from $/Project -&amp;gt; $(Source) to $/Project/Folder
-&amp;gt; $(Source)\Folder. Not only will this limit the amount of source downloaded,
it is also used to 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;ul&gt;
&lt;li&gt;
Reference Paths&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt; 
&lt;p&gt;
There is a section in the TFSBuild.csproj file for specifying reference paths. This
is very useful when you have those developers who always add a reference in a nonstandard
location and break the build. It is specified in an item group property, as a child
of the root &amp;lt;Project&amp;gt; element. In my file, it was inserted at the end. I am
going to try to insert this into a .targets file that I can reference from multiple
build files.
&lt;/p&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;div&gt;&lt;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"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008000"&gt;&amp;lt;!--
ADDITIONAL REFERENCE PATH&lt;/span&gt; &lt;span style="color: #008000"&gt; The list of additional
reference paths to use while resolving references. For example:&lt;/span&gt; &lt;span style="color: #008000"&gt; &lt;/span&gt; &lt;span style="color: #008000"&gt; &amp;lt;AdditionalReferencePath
Include="C:\MyFolder\" /&amp;gt;&lt;/span&gt; &lt;span style="color: #008000"&gt; &amp;lt;AdditionalReferencePath
Include="C:\MyFolder2\" /&amp;gt;&lt;/span&gt; &lt;span style="color: #008000"&gt; --&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;ul&gt;
&lt;li&gt;
Get a specific version (label)&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt; 
&lt;p&gt;
I should have realized this earlier, but without an option in the Queue Build GUI,
my need for building a specific version from a label drops significantly. I wanted
QA to be able to build a version from a label, as defined by the dev team, such that
the dev team could move on and start developing and checking in without impacting
QA. The only "supported" way to get a specific version is to override the CoreGet
task (see Ref #8), which means QA would have to check out and modify the TFSBuild.csproj
file.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;Open Issues:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Select a specific project in a solution to build from.&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Current work around, is to create a new solution, or modify the solution I've been
using to&amp;nbsp;unselect some problem projects.&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Miscellaneous:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Read on Buck's blog that you have to have an interactive session running on the build
server to do automated UI tests. He has instructions on how to do this. (See Ref #5) 
&lt;li&gt;
Extending the TFSBuild.csproj file. You can define reusable .targets files, which
are just MSBuild files, and then import them into the TFSBuild.csproj file using &amp;lt;Import
Project="Path\FileName.targets"/&amp;gt; 
&lt;li&gt;
You can add tasks based on TF Build targets in either the TFSBuild.csproj file, or
your imported .targets. (See Ref #2) 
&lt;li&gt;
You can do incremental builds by setting the SkipClean property to true (See Ref #3). 
&lt;li&gt;
The .rsp file that is created with the TFSBuild.csproj file is a file that is used
to pass command line arguments to MSBuild (See Ref #7).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;References: &lt;/strong&gt;
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/ms181286(VS.80).aspx"&gt;MSDN Documentation&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/aa337604(vs.90).aspx"&gt;Customizable
Team Foundation Build Targets&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/bb399127(VS.90).aspx"&gt;How to: Customize
the SolutionToBuild Item Group&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://blogs.msdn.com/buckh/"&gt;Buck Hodges Blog&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://blogs.msdn.com/buckh/archive/2007/08/14/tfs-2008-a-basic-guide-to-team-build-2008.aspx"&gt;Buck's
basic guide to Team Build 2008&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/aa833876(VS.90).aspx"&gt;Incremental
Builds&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/ms164311(VS.90).aspx"&gt;MSBuild command
line reference&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://blogs.msdn.com/nagarajp/archive/2005/10/21/483590.aspx"&gt;Get a specific
version&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=5aeeadaa-1e97-4042-bd76-9264048aaf21" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,5aeeadaa-1e97-4042-bd76-9264048aaf21.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=e1c234eb-1be4-4aa6-b0ea-fdc5b5f3d9fe</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,e1c234eb-1be4-4aa6-b0ea-fdc5b5f3d9fe.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,e1c234eb-1be4-4aa6-b0ea-fdc5b5f3d9fe.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e1c234eb-1be4-4aa6-b0ea-fdc5b5f3d9fe</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Not that we use the TFS reports that much, but I noticed the main report on the front
page of project site in Share Point, showed the warehouse hadn't been updated in a
couple of days. So begins another adventure into getting it to work again.
</p>
        <p>
At first I thought it was going to be easy, the service wasn't running. We had a power
failure in the data center this past week, and it looks like on reboot, the service
failed to start. Our new data center isn't running at production levels yet, so a
power failure due to human error is not surprising. However, after restarting the
service, the warehouse still wasn't updating. 
</p>
        <p>
I decided to invoke the warehouse manually, and ran the scripts suggested on this
familiar MSDN <a href="http://forums.microsoft.com/msdn/showpost.aspx?postid=156444&amp;siteid=1&amp;sb=0&amp;d=1&amp;at=7&amp;ft=11&amp;tf=0&amp;pageid=0">thread</a> to
try to see what was going on. The manual warehouse update worked once, then wouldn't
work again (Status always returned idle) until I restarted the IIS server. The results
of the query did not seem to update, even though the Status values returned from the
web service indicated that the warehouse update had ran. I decided to look at the
ScheduledServices.xml in Program Files\Microsoft Visual Studio 2008 Team Foundation
Server\TFSServerSchedule, and it was showing a wierd value for last run time (lastrun="1:1:1:0:0:0").
I'm guessing that this value indicates the process started, but never finished, so
it never updated the date. My final clue to work with was an event log entry stating
there was an unexpected exception while calculating code churn (TF53010). The specific
details spoke of a incomplete character stream and possibly invalid encoding, in an
xml file I had checked in recently.
</p>
        <p>
I came across a MSDN <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=112925&amp;SiteID=1">post</a> that
mentioned that you can add this (&lt;add key="ProcessingType" value="Full" /&gt;) appKey
to your warehouse app.config. I could tell the warehouse web service restarted due
to the delay in the web page for invoking the warehouse, but it appears like the run command
has no effect again. So after "running" once, it won't run again at all. The value
in ScheduleServices.xml is not changing at all (I manually changed the value so I
could tell), so things are working at all. Event log is clear, so I need to find some
other type of information.
</p>
        <p>
I downloaded an installed DebugView from Sysinternals (used it before in TFS 2005)
and changed tracing levels as outlined in the MSDN post linked to above, however either
something change in 2008, or I setup the debugger wrong cause I got nothing. There
were some other settings related to tracing, so I turned those on as well (appSettings.traceWriter
= true, and set all switches to level 4). Nothing at all. The changes to the web.config
file, which restart the app domain, seem to have some effect in that GetWarehouseStatus
returns values to indicated it's trying to process, however, I get no debug or trace
information. I take that back, Debug information has finally stared showing up I just
don't know why. 
</p>
        <p>
Unfortunately there was nothing that pointed to why the warehouse processing was failing
in Debug View. It seemed to show that everything was working correctly. I'm thinking
that ScheduledServices.xml is only updated when the scheduler runs the warehouse,
not manually. Looking back at my reports, them seem to be updating now.
</p>
        <p>
So in summary, things appear to be working for now (need to wait 1 hour to see if
the scheduler runs as expected), but I don't know exactly what fixed the problem.
I turned off debugging and full processing, and things seemed to continue to work.
I think the TfsWarehouse.dbo._WarehouseConfig table has contains rows that provide
better information on when the warehouse last ran. You can easily change the RunIntervalSeconds
setting to change how often the scheduler runs the task. I restarted the scheduler
tasks after changing. Since our database is small, I set this to 2 minutes just to
see if it was working, then set it back to 60 minutes. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=e1c234eb-1be4-4aa6-b0ea-fdc5b5f3d9fe" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>TFS Warehouse Not Updating (Again)</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,e1c234eb-1be4-4aa6-b0ea-fdc5b5f3d9fe.aspx</guid>
      <link>http://blog.salvoz.com/2007/11/03/TFSWarehouseNotUpdatingAgain.aspx</link>
      <pubDate>Sat, 03 Nov 2007 22:41:51 GMT</pubDate>
      <description>&lt;p&gt;
Not that we use the TFS reports that much, but I noticed the main report on the front
page of project site in Share Point, showed the warehouse hadn't been updated in a
couple of days. So begins another adventure into getting it to work again.
&lt;/p&gt;
&lt;p&gt;
At first I thought it was going to be easy, the service wasn't running. We had a power
failure in the data center this past week, and it looks like on reboot, the service
failed to start. Our new data center isn't running at production levels yet, so a
power failure due to human error is not surprising. However, after restarting the
service, the warehouse still wasn't updating. 
&lt;/p&gt;
&lt;p&gt;
I decided to invoke the warehouse manually, and ran the scripts suggested on this
familiar MSDN &lt;a href="http://forums.microsoft.com/msdn/showpost.aspx?postid=156444&amp;amp;siteid=1&amp;amp;sb=0&amp;amp;d=1&amp;amp;at=7&amp;amp;ft=11&amp;amp;tf=0&amp;amp;pageid=0"&gt;thread&lt;/a&gt;&amp;nbsp;to
try to see what was going on. The manual warehouse update worked once, then wouldn't
work again (Status always returned idle) until I restarted the IIS server. The results
of the query did not seem to update, even though the Status values returned from the
web service indicated that the warehouse update had ran. I decided to look at the
ScheduledServices.xml in Program Files\Microsoft Visual Studio 2008 Team Foundation
Server\TFSServerSchedule, and it was showing a wierd value for last run time (lastrun="1:1:1:0:0:0").
I'm guessing that this value indicates the process started, but never finished, so
it never updated the date. My final clue to work with was an event log entry stating
there was an unexpected exception while calculating code churn (TF53010). The specific
details spoke of a incomplete character stream and possibly invalid encoding, in an
xml file I had checked in recently.
&lt;/p&gt;
&lt;p&gt;
I came across a&amp;nbsp;MSDN &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=112925&amp;amp;SiteID=1"&gt;post&lt;/a&gt; that
mentioned that you can add this (&amp;lt;add key="ProcessingType" value="Full" /&amp;gt;)&amp;nbsp;appKey
to your warehouse app.config. I could tell the warehouse web service restarted due
to the delay in the web page for invoking the warehouse, but it appears like the run&amp;nbsp;command
has no effect again. So after "running" once, it won't run again at all. The value
in ScheduleServices.xml is not changing at all (I manually changed the value so I
could tell), so things are working at all. Event log is clear, so I need to find some
other type of information.
&lt;/p&gt;
&lt;p&gt;
I downloaded an installed DebugView from Sysinternals (used it before in TFS 2005)
and changed tracing levels as outlined in the MSDN post linked to above, however either
something change in 2008, or I setup the debugger wrong cause I got nothing. There
were some other settings related to tracing, so I turned those on as well (appSettings.traceWriter
= true, and set all switches to level 4). Nothing at all. The changes to the web.config
file, which restart the app domain, seem to have some effect in that GetWarehouseStatus
returns values to indicated it's trying to process, however, I get no debug or trace
information. I take that back, Debug information has finally stared showing up I just
don't know why. 
&lt;/p&gt;
&lt;p&gt;
Unfortunately there was nothing that pointed to why the warehouse processing was failing
in Debug View. It seemed to show that everything was working correctly. I'm thinking
that ScheduledServices.xml is only updated when the scheduler runs the warehouse,
not manually. Looking back at my reports, them seem to be updating now.
&lt;/p&gt;
&lt;p&gt;
So in summary, things appear to be working for now (need to wait 1 hour to see if
the scheduler runs as expected), but I don't know exactly what fixed the problem.
I turned off debugging and full processing, and things seemed to continue to work.
I think the TfsWarehouse.dbo._WarehouseConfig table has contains rows that provide
better information on when the warehouse last ran. You can easily change the RunIntervalSeconds
setting to change how often the scheduler runs the task. I restarted the scheduler
tasks after changing. Since our database is small, I set this to 2 minutes just to
see if it was working, then set it back to 60 minutes. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=e1c234eb-1be4-4aa6-b0ea-fdc5b5f3d9fe" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,e1c234eb-1be4-4aa6-b0ea-fdc5b5f3d9fe.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=5097f379-94f5-47de-919d-9b8809c78ae1</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,5097f379-94f5-47de-919d-9b8809c78ae1.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,5097f379-94f5-47de-919d-9b8809c78ae1.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5097f379-94f5-47de-919d-9b8809c78ae1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
While looking to download BizTalk 2006 R2 off MSDN, I came across Software Licensing
and Protection Online Server (SLP Services), and an offer for MSDN subscribers for
free use for 1 year. This was the first time I've heard of SLP Services, so I wanted
to check it out, the home page is here: <a title="http://www.microsoft.com/SLPS/Default.aspx" href="http://www.microsoft.com/SLPS/Default.aspx">http://www.microsoft.com/SLPS/Default.aspx</a>. 
<br /><br />
Key features include:
</p>
        <ul>
          <li>
Code Protection (Advanced Obfuscation?) 
</li>
          <li>
License Enforcement thru activation and client side enforcement. 
</li>
          <li>
1 code base, "unlimited" configurations. Create trial software, add-on packages, timed
demos, etc.</li>
        </ul>
        <p>
SLP Services is either a Microsoft hosted, or server based product that can be used
to protect, license and distribute your software. In the hosted model, Microsoft runs
the service, and you pay them a fee. In the server model, you install the server onto
your network and host it yourself. It might also be possible to resell SLP services,
but I have not read the licensing to know that for sure. This <a href="http://blogs.msdn.com/slps/archive/2007/09/11/part-2-3-shipping-continued.aspx">blog
post</a><strong> </strong>indicates that reselling the SLP Service is an intened
use. In addition to the traditional use for licensing, the SLP Services web site also
talks about benefits of using the technology in the enterprise, for in house applications,
which include monitoring application use, and controller who can use a specific application,
or feature. The <a href="http://www.microsoft.com/SLPS/downloads.aspx">Downloads</a> page,
for information on downloading a trial version of the code protection tool and
documentation for online and offline products.
</p>
        <p>
The basic version you get thru MSDN allows you to do the following
</p>
        <ul>
          <li>
1 licensed product 
</li>
          <li>
100 Commercial Activations (i.e. Customers who <em>purchase</em> a license) 
</li>
          <li>
1000 non-commercial activations (activations that were not purchased) 
</li>
          <li>
1 basic permutation, which allows you to "create" 5 products from a single code base. 
</li>
        </ul>
        <p>
The more expensive licenses of SLP Services allow for more activations, permutations
and you get statistics and an API for license creation. Check out the <a href="http://www.microsoft.com/SLPS/how-to-buy.aspx">How
to Buy</a> page for details. Regular retail pricing for the basic hosted version
(after your free year and for non MSDN subscribers) is $500/yr, which as I already
mention, includes 100 commercial activations. Additional activations cost $1000 for
1000.
</p>
        <p>
I really, really like the concept, but once again feel like Microsoft could be doing
a better job at making this more accessible to smaller ISV's and independent contractors
(in the same way I disagree with some of the pricing for VSTS and TFS). Granted these
are retail prices, but but the point of entry for someone hoping to make $9.95 on
a product, and who could really benefit from something like this, is a little high.
I'd like to see a starter edition that gives you the 1000 non-commercial activations
but includes no commercial activations, however, you could purchase them at $1/each.
This way you could develop your code using the technology and then once you start
selling, start paying for the service. I think that Microsoft is trying to avoid giving
away the code protection for free so that they do not directly compete with other
companies offering a similar product, which if that is the case, should offer a limited
functionality version with the starter edition, again to get people started. 
</p>
        <table cellspacing="0" cellpadding="2" width="440" border="0" unselectable="on">
          <tbody>
            <tr>
              <td valign="top" width="141">
Software Cost</td>
              <td valign="top" width="297">
Number of Copies to Break Even to cover $500/yr</td>
            </tr>
            <tr>
              <td valign="top" width="142">
$9.95</td>
              <td valign="top" width="297">
51</td>
            </tr>
            <tr>
              <td valign="top" width="143">
$19.95</td>
              <td valign="top" width="297">
26</td>
            </tr>
            <tr>
              <td valign="top" width="143">
$29.95</td>
              <td valign="top" width="297">
17</td>
            </tr>
            <tr>
              <td valign="top" width="143">
$39.95</td>
              <td valign="top" width="297">
13</td>
            </tr>
            <tr>
              <td valign="top" width="143">
$49.95</td>
              <td valign="top" width="297">
11</td>
            </tr>
            <tr>
              <td valign="top" width="143">
$59.95</td>
              <td valign="top" width="297">
9</td>
            </tr>
            <tr>
              <td valign="top" width="143">
$69.95</td>
              <td valign="top" width="297">
8</td>
            </tr>
            <tr>
              <td valign="top" width="143">
$79.95</td>
              <td valign="top" width="297">
7</td>
            </tr>
            <tr>
              <td valign="top" width="143">
$89.95</td>
              <td valign="top" width="297">
6</td>
            </tr>
            <tr>
              <td valign="top" width="143">
$99.95</td>
              <td valign="top" width="297">
5</td>
            </tr>
            <tr>
              <td valign="top" width="143">
 </td>
              <td valign="top" width="297">
 </td>
            </tr>
          </tbody>
        </table>
        <p>
 
</p>
        <p>
UPDATE: Someone from MS responded to a <a href="http://forums.microsoft.com/MSDN/showpost.aspx?postid=2329422&amp;siteid=1">post</a> I
made on the MSDN forums, confirming that, as a MSDN subscriber, as long as you renew
each year, you have access to the basic version. This does make this a little more
attractive, as a MSDN professional subscription is a good deal IMO.
</p>
        <p>
I fully expect to see new hosted solutions start to popup that are based on SLP Services,
that include e-commerce capabilities, and charge per copy based on purchase price. 
</p>
        <p>
In addition to the price, which may or may not be a detractor to you, there is one
other issue. Since this is a Microsoft product, you are going to have allot of talented
individuals looking to crack it. It will be interesting to see if a "universal" crack
could be developed, and how MS will respond. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=5097f379-94f5-47de-919d-9b8809c78ae1" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Software Licensing and Protection Online Service Basic</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,5097f379-94f5-47de-919d-9b8809c78ae1.aspx</guid>
      <link>http://blog.salvoz.com/2007/10/20/SoftwareLicensingAndProtectionOnlineServiceBasic.aspx</link>
      <pubDate>Sat, 20 Oct 2007 04:21:58 GMT</pubDate>
      <description>&lt;p&gt;
While looking to download BizTalk 2006 R2 off MSDN, I came across Software Licensing
and Protection Online Server (SLP Services), and an offer for MSDN subscribers for
free use for 1 year. This was the first time I've heard of SLP Services, so I wanted
to check it out, the home page is here: &lt;a title="http://www.microsoft.com/SLPS/Default.aspx" href="http://www.microsoft.com/SLPS/Default.aspx"&gt;http://www.microsoft.com/SLPS/Default.aspx&lt;/a&gt;. 
&lt;br&gt;
&lt;br&gt;
Key features include:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Code Protection (Advanced Obfuscation?) 
&lt;li&gt;
License Enforcement thru activation and client side enforcement. 
&lt;li&gt;
1 code base, "unlimited" configurations. Create trial software, add-on packages, timed
demos, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
SLP Services is either a Microsoft hosted, or server based product that can be used
to protect, license and distribute your software. In the hosted model, Microsoft runs
the service, and you pay them a fee. In the server model, you install the server onto
your network and host it yourself. It might also be possible to resell SLP services,
but I have not read the licensing to know that for sure. This &lt;a href="http://blogs.msdn.com/slps/archive/2007/09/11/part-2-3-shipping-continued.aspx"&gt;blog
post&lt;/a&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;indicates that reselling the SLP Service is an intened
use. In addition to the traditional use for licensing, the SLP Services web site also
talks about benefits of using the technology in the enterprise, for in house applications,
which include monitoring application use, and controller who can use a specific application,
or feature. The&amp;nbsp;&lt;a href="http://www.microsoft.com/SLPS/downloads.aspx"&gt;Downloads&lt;/a&gt;&amp;nbsp;page,
for information on downloading&amp;nbsp;a trial version of the code protection tool and
documentation for online and offline products.
&lt;/p&gt;
&lt;p&gt;
The basic version you get thru MSDN allows you to do the following
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
1 licensed product 
&lt;li&gt;
100 Commercial Activations (i.e. Customers who &lt;em&gt;purchase&lt;/em&gt; a license) 
&lt;li&gt;
1000 non-commercial activations (activations that were not purchased) 
&lt;li&gt;
1 basic permutation, which allows you to "create" 5 products from a single code base. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The more expensive licenses of SLP Services allow for more activations, permutations
and you get statistics and an API for license creation. Check out the &lt;a href="http://www.microsoft.com/SLPS/how-to-buy.aspx"&gt;How
to Buy&lt;/a&gt;&amp;nbsp;page for details. Regular retail pricing for the basic hosted version
(after your free year and for non MSDN subscribers) is $500/yr, which as I already
mention, includes 100 commercial activations. Additional activations cost $1000 for
1000.
&lt;/p&gt;
&lt;p&gt;
I really, really like the concept, but once again feel like Microsoft could be doing
a better job at making this more accessible to smaller ISV's and independent contractors
(in the same way I disagree with some of the pricing for VSTS and TFS). Granted these
are retail prices, but but the point of entry for someone hoping to make $9.95 on
a product, and who could really benefit from something like this, is a little high.
I'd like to see a starter edition that gives you the 1000 non-commercial activations
but includes no commercial activations, however, you could purchase them at&amp;nbsp;$1/each.
This way you could develop your code using the technology and then once you start
selling, start paying for the service. I think that Microsoft is trying to avoid giving
away the code protection for free so that they do not directly compete with other
companies offering a similar product, which if that is the case, should offer a limited
functionality version with the starter edition, again to get people started. 
&lt;/p&gt;
&lt;table cellspacing="0" cellpadding="2" width="440" border="0" unselectable="on"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="141"&gt;
Software Cost&lt;/td&gt;
&lt;td valign="top" width="297"&gt;
Number of Copies to Break Even to cover $500/yr&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="142"&gt;
$9.95&lt;/td&gt;
&lt;td valign="top" width="297"&gt;
51&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="143"&gt;
$19.95&lt;/td&gt;
&lt;td valign="top" width="297"&gt;
26&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="143"&gt;
$29.95&lt;/td&gt;
&lt;td valign="top" width="297"&gt;
17&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="143"&gt;
$39.95&lt;/td&gt;
&lt;td valign="top" width="297"&gt;
13&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="143"&gt;
$49.95&lt;/td&gt;
&lt;td valign="top" width="297"&gt;
11&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="143"&gt;
$59.95&lt;/td&gt;
&lt;td valign="top" width="297"&gt;
9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="143"&gt;
$69.95&lt;/td&gt;
&lt;td valign="top" width="297"&gt;
8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="143"&gt;
$79.95&lt;/td&gt;
&lt;td valign="top" width="297"&gt;
7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="143"&gt;
$89.95&lt;/td&gt;
&lt;td valign="top" width="297"&gt;
6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="143"&gt;
$99.95&lt;/td&gt;
&lt;td valign="top" width="297"&gt;
5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="143"&gt;
&amp;nbsp;&lt;/td&gt;
&lt;td valign="top" width="297"&gt;
&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
UPDATE: Someone from MS responded to a &lt;a href="http://forums.microsoft.com/MSDN/showpost.aspx?postid=2329422&amp;amp;siteid=1"&gt;post&lt;/a&gt;&amp;nbsp;I
made on the MSDN forums, confirming that, as a MSDN subscriber, as long as you renew
each year, you have access to the basic version. This does make this a little more
attractive, as a MSDN professional subscription is a good deal IMO.
&lt;/p&gt;
&lt;p&gt;
I fully expect to see new hosted solutions start to popup that are based on SLP Services,
that include e-commerce capabilities, and charge per copy based on purchase price. 
&lt;/p&gt;
&lt;p&gt;
In addition to the price, which may or may not be a detractor to you, there is one
other issue. Since this is a Microsoft product, you are going to have allot of talented
individuals looking to crack it. It will be interesting to see if a "universal" crack
could be developed, and how MS will respond. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=5097f379-94f5-47de-919d-9b8809c78ae1" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,5097f379-94f5-47de-919d-9b8809c78ae1.aspx</comments>
      <category>Technology/Programming</category>
      <category>Technology/Review For Future Projects</category>
      <category>Technology/Tools</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=f9da3299-4bea-4dea-8335-858df7b04e1d</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,f9da3299-4bea-4dea-8335-858df7b04e1d.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,f9da3299-4bea-4dea-8335-858df7b04e1d.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=f9da3299-4bea-4dea-8335-858df7b04e1d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Assumption: You have remote performance monitor installed and running (this will be
the topic of another blog post, or you can review the references at the end of this
article).
</p>
        <p>
          <strong>Garbage Collector</strong>
        </p>
        <ul>
          <li>
GC Latency Time</li>
        </ul>
        <p>
          <strong>Memory Usage</strong>
        </p>
        <ul>
          <li>
AppDomain and JIT Heaps: 
<ul><li>
Never shrinks. 
</li><li>
Returns memory at the end of the applications life. 
</li><li>
Impacts the 32MB virtual memory limit on Windows CE 5.0. 
</li><li>
Typically these should be under 1MB, although they can be larger on really big applications. 
</li><li>
Size is related to the number of types, along with the number and size of method calls.</li></ul></li>
          <li>
GC Heap 
<ul><li>
Varies with the life of the application 
</li><li>
Impacts the 32MB virtual memory limit 
</li><li>
4-5 MB is not uncommon. 
</li><li>
The amount of change in the GC heap is of more concern</li></ul></li>
        </ul>
        <p>
 
</p>
        <p>
          <strong>How can I make my app faster?</strong>
        </p>
        <p>
I would suggest reading the post referenced below published by the MS Compact Framework
team. I've seen it copied almost word for word at several places, so I'm not going
to do that here. There is also an entire section in MSDN on Compact Framework Performance
(see references below).
</p>
        <p>
          <strong>References:</strong>
        </p>
        <ul>
          <li>
            <a title="http://dotnet.sys-con.com/read/315037_2.htm" href="http://dotnet.sys-con.com/read/315037_2.htm">http://dotnet.sys-con.com/read/315037_2.htm</a>
          </li>
          <li>
            <a title="http://dotnet.sys-con.com/read/180970.htm" href="http://dotnet.sys-con.com/read/180970.htm">http://dotnet.sys-con.com/read/180970.htm</a>
          </li>
          <li>
            <a href="http://blogs.msdn.com/davidklinems/archive/2005/12/09/502125.aspx">Definitions
of all Performance Monitor Objects</a>
          </li>
          <li>
            <a href="http://download.microsoft.com/documents/australia/medc2006/Compact_Framework_Optimising_for_Performance_Boling.ppt">PPT
from MDC 2006</a>
          </li>
          <li>
            <a href="http://blogs.msdn.com/netcfteam/archive/2005/05/04/414820.aspx">MS Compact
Framework Team on Performance</a>
          </li>
          <li>
            <a href="http://msdn2.microsoft.com/en-us/library/aa127190.aspx">MSDN section on Compact
Framework Performance</a>
          </li>
        </ul>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=f9da3299-4bea-4dea-8335-858df7b04e1d" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Analyzing a Compact Framework Application using Remote Performance Monitor</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,f9da3299-4bea-4dea-8335-858df7b04e1d.aspx</guid>
      <link>http://blog.salvoz.com/2007/10/15/AnalyzingACompactFrameworkApplicationUsingRemotePerformanceMonitor.aspx</link>
      <pubDate>Mon, 15 Oct 2007 10:43:17 GMT</pubDate>
      <description>&lt;p&gt;
Assumption: You have remote performance monitor installed and running (this will be
the topic of another blog post, or you can review the references at the end of this
article).
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Garbage Collector&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
GC Latency Time&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Memory Usage&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
AppDomain and JIT Heaps: 
&lt;ul&gt;
&lt;li&gt;
Never shrinks. 
&lt;li&gt;
Returns memory at the end of the applications life. 
&lt;li&gt;
Impacts the 32MB virtual memory limit on Windows CE 5.0. 
&lt;li&gt;
Typically these should be under 1MB, although they can be larger on really big applications. 
&lt;li&gt;
Size is related to the number of types, along with the number and size of method calls.&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
GC Heap 
&lt;ul&gt;
&lt;li&gt;
Varies with the life of the application 
&lt;li&gt;
Impacts the 32MB virtual memory limit 
&lt;li&gt;
4-5 MB is not uncommon. 
&lt;li&gt;
The amount of change in the GC heap is of more concern&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;How can I make my app faster?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I would suggest reading the post referenced below published by the MS Compact Framework
team. I've seen it copied almost word for word at several places, so I'm not going
to do that here. There is also an entire section in MSDN on Compact Framework Performance
(see references below).
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;References:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a title="http://dotnet.sys-con.com/read/315037_2.htm" href="http://dotnet.sys-con.com/read/315037_2.htm"&gt;http://dotnet.sys-con.com/read/315037_2.htm&lt;/a&gt; 
&lt;li&gt;
&lt;a title="http://dotnet.sys-con.com/read/180970.htm" href="http://dotnet.sys-con.com/read/180970.htm"&gt;http://dotnet.sys-con.com/read/180970.htm&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://blogs.msdn.com/davidklinems/archive/2005/12/09/502125.aspx"&gt;Definitions
of all Performance Monitor Objects&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://download.microsoft.com/documents/australia/medc2006/Compact_Framework_Optimising_for_Performance_Boling.ppt"&gt;PPT
from MDC 2006&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://blogs.msdn.com/netcfteam/archive/2005/05/04/414820.aspx"&gt;MS Compact
Framework Team on Performance&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/aa127190.aspx"&gt;MSDN section on Compact
Framework Performance&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=f9da3299-4bea-4dea-8335-858df7b04e1d" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,f9da3299-4bea-4dea-8335-858df7b04e1d.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=55db9a09-4fd7-4959-a86c-d7965622fc77</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,55db9a09-4fd7-4959-a86c-d7965622fc77.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,55db9a09-4fd7-4959-a86c-d7965622fc77.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=55db9a09-4fd7-4959-a86c-d7965622fc77</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
WCF support was something I was really looking forward to, but I seem to have missed
some announcements on what was, and was not supported. I came across this blog post
today <a href="http://blogs.msdn.com/andrewarnottms/archive/2007/08/21/the-wcf-subset-supported-by-netcf.aspx">http://blogs.msdn.com/andrewarnottms/archive/2007/08/21/the-wcf-subset-supported-by-netcf.aspx</a> and
similar confirmations on the MSDN forums. The blog post was from late August, so it
looks like I need to stay on top of these things a little better. 
</p>
        <p>
  
</p>
        <p>
Basically, the lack of TransportWithCredentials as a security option kills WCF for
us out right. I was able to get this working using traditional ASMX web service client
on our devices communicating back to a WCF service, thanks in large part to the work
Casey Chesnut did to get WSE working on the compact framework (which is now part of
OpenNetCF). It looks like X.509 is the preferred method, but we have had extremely
bad luck with certs, and I don’t think management will ever allow their use again.
I see managing certs for thousands of remote devices to be a little more
complicated than a simple username/password approach. 
</p>
        <p>
  
</p>
        <p>
I was really hoping for binary formatting, but can’t say I’m surprised that it’s not
included, because it seems like binary serialization has never been part of the compact
framework. No support for Streaming Messages is also a let-down. I find it ironic
that functionality such as binary formatting and streaming messaging is left you,
give that the usual argument with respect to the compact framework one of size limitations.
I see there is mention of a Gzip Encoder which sounds promising, but is unusable for
us until we can implement a work around to no TransportWithCredentials security. 
</p>
        <p>
  
</p>
        <p>
I was talking with Travis (president of Madison DotNet UG), and we both agreed that
one of the best things MS could do with regard to the Compact Framework, is allow
developers to customize what modules are included. Start with a small base install,
similar to what it is now, but at least give developers the option to deploy additional
functionality (without having to re-invent the wheel themselves) when needed. 
</p>
        <p>
  
</p>
        <p>
I guess once CF 3.5 Is released, I’ll be on the lookout for what types of extensibility
options are available, but probably won’t be able to program anything custom until
after our first release in April. 
</p>
        <p>
  
</p>
        <p>
From what I can tell from a few posts online, it sounds like I’m not alone in my criticism
and hopefully, enough developers send MS feedback so that we can get some of this
functionality introduced as an add-on at least. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=55db9a09-4fd7-4959-a86c-d7965622fc77" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>WCF in CF 3.5 leaves something to be desired</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,55db9a09-4fd7-4959-a86c-d7965622fc77.aspx</guid>
      <link>http://blog.salvoz.com/2007/10/14/WCFInCF35LeavesSomethingToBeDesired.aspx</link>
      <pubDate>Sun, 14 Oct 2007 23:46:48 GMT</pubDate>
      <description>&lt;p&gt;
WCF support was something I was really looking forward to, but I seem to have missed
some announcements on what was, and was not supported. I came across this blog post
today &lt;a href="http://blogs.msdn.com/andrewarnottms/archive/2007/08/21/the-wcf-subset-supported-by-netcf.aspx"&gt;http://blogs.msdn.com/andrewarnottms/archive/2007/08/21/the-wcf-subset-supported-by-netcf.aspx&lt;/a&gt; and
similar confirmations on the MSDN forums. The blog post was from late August, so it
looks like I need to stay on top of these things a little better. 
&lt;p&gt;
&amp;nbsp; 
&lt;p&gt;
Basically, the lack of TransportWithCredentials as a security option kills WCF for
us out right. I was able to get this working using traditional ASMX web service client
on our devices communicating back to a WCF service, thanks in large part to the work
Casey Chesnut did to get WSE working on the compact framework (which is now part of
OpenNetCF). It looks like X.509 is the preferred method, but we have had extremely
bad luck with certs, and I don’t think management will ever allow their use again.
I see managing certs for&amp;nbsp;thousands of remote&amp;nbsp;devices to be a little more
complicated than a simple username/password approach. 
&lt;p&gt;
&amp;nbsp; 
&lt;p&gt;
I was really hoping for binary formatting, but can’t say I’m surprised that it’s not
included, because it seems like binary serialization has never been part of the compact
framework. No support for Streaming Messages is also a let-down. I find it ironic
that functionality such as binary formatting and streaming messaging is left you,
give that the usual argument with respect to the compact framework one of size limitations.
I see there is mention of a Gzip Encoder which sounds promising, but is unusable for
us until we can implement a work around to no TransportWithCredentials security. 
&lt;p&gt;
&amp;nbsp; 
&lt;p&gt;
I was talking with Travis (president of Madison DotNet UG), and we both agreed that
one of the best things MS could do with regard to the Compact Framework, is allow
developers to customize what modules are included. Start with a small base install,
similar to what it is now, but at least give developers the option to deploy additional
functionality (without having to re-invent the wheel themselves) when needed. 
&lt;p&gt;
&amp;nbsp; 
&lt;p&gt;
I guess once CF 3.5 Is released, I’ll be on the lookout for what types of extensibility
options are available, but probably won’t be able to program anything custom until
after our first release in April. 
&lt;p&gt;
&amp;nbsp; 
&lt;p&gt;
From what I can tell from a few posts online, it sounds like I’m not alone in my criticism
and hopefully, enough developers send MS feedback so that we can get some of this
functionality introduced as an add-on at least. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=55db9a09-4fd7-4959-a86c-d7965622fc77" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,55db9a09-4fd7-4959-a86c-d7965622fc77.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=6465a14f-dccd-49ee-ad4d-a88cca4b3b76</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,6465a14f-dccd-49ee-ad4d-a88cca4b3b76.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,6465a14f-dccd-49ee-ad4d-a88cca4b3b76.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=6465a14f-dccd-49ee-ad4d-a88cca4b3b76</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Slow week on the blog. Been busy with work, flooring project at home, and getting
ready to announce a new personal development project (and all the research I've been
putting into it). 
</p>
        <p>
VsTestHost was crashing on me today. It started out that TD.Net was failing, so I
switched over to using the TestView to invoke the tests, fail. Since I'm running VS
2008 B2, I switched back to VS 2005 and created a new solution with only a handful
of projects, fail. Installed the latest version of TD.Net, fail. Googled on VsTestHost.exe,
only got a handful of results, one of which suggested re-installing VS (argh). Finally
decided to test in debug mode, oh look a stack over flow exception. One of the posts
on Google even mentioned that stack overflow exceptions are not (always) caught by
VsTestHost. The stack overflow exception was caused by a property referencing itself,
which was the result of an over ambitious find replace all.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=6465a14f-dccd-49ee-ad4d-a88cca4b3b76" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>VsTestHost Crashing</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,6465a14f-dccd-49ee-ad4d-a88cca4b3b76.aspx</guid>
      <link>http://blog.salvoz.com/2007/10/12/VsTestHostCrashing.aspx</link>
      <pubDate>Fri, 12 Oct 2007 22:33:50 GMT</pubDate>
      <description>&lt;p&gt;
Slow week on the blog. Been busy with work, flooring project at home, and getting
ready to announce a new personal development project (and all the research I've been
putting into it). 
&lt;/p&gt;
&lt;p&gt;
VsTestHost was crashing on me today. It started out that TD.Net was failing, so I
switched over to using the TestView to invoke the tests, fail. Since I'm running VS
2008 B2, I switched back to VS 2005 and created a new solution with only a handful
of projects, fail. Installed the latest version of TD.Net, fail. Googled on VsTestHost.exe,
only got a handful of results, one of which suggested re-installing VS (argh). Finally
decided to test in debug mode, oh look a stack over flow exception. One of the posts
on Google even mentioned that stack overflow exceptions are not (always) caught by
VsTestHost. The stack overflow exception was caused by a property referencing itself,
which was the result of an over ambitious find replace all.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=6465a14f-dccd-49ee-ad4d-a88cca4b3b76" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,6465a14f-dccd-49ee-ad4d-a88cca4b3b76.aspx</comments>
      <category>Technology/Programming</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=03d4c933-e2a7-4ad3-b51e-35543cea0389</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,03d4c933-e2a7-4ad3-b51e-35543cea0389.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,03d4c933-e2a7-4ad3-b51e-35543cea0389.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=03d4c933-e2a7-4ad3-b51e-35543cea0389</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm not even sure what led me to start playing around with the new Linq to SQL (formerly
called DLinq) DAL in VS2008B2, but I'm glad I did. I discovered some very
fascinating functionality that I believe will really shake up the way most developers
approach the DAL. I see some similarities  between Linq to SQL and other OR/M
plugins (tools, methodologies) out there, but since this is Microsoft's approach,
I anticipate it will catch on en mass. I don't believe Microsoft is trying to make
the other methods obsolete, but that they are delivering a product demanded by their
customers. One of the problems with the current OR/M scene, is that there are so many
options to choose from, that you never know if you've made the right choice. While
Linq to SQL, may have some deficiencies, it will give developers, and their managers
a little piece of mind when breaking from the traditional DAL mold. I can only hope
that Linq to SQL does not disappoint, even after taking into consideration it's a
Gen 1 product. Issues such as performance, extendibility, and plugability (into
one's code or way of doing things) are some things that I want to explore
(as with any tool such as Linq to SQL). 
</p>
        <p>
I used this <a href="http://www.ftponline.com/vsm/2007_07/magazine/features/rjennings/">article</a> to
help jump start my foray into Linq to SQL (let's just call it L2S from here on). Being
away from WinForms for so long, I've missed out on some of the data binding features
available, and was surprised to see how easy it was to get up and going with a grid
and details form. I remember seeing the videos when VS 2005 was coming out, but never
had a need to play around with it until now. I've also never had good luck with drag
and drop data binding, as it assumes to much, I'm hoping that there are plenty of
hooks available to help customize the data binding experience, but any fault with
data binding should not be confused with L2S as they are 2 separate features (actually
data binding is a feature, and L2S is a feature of VS 2008, and part of the .Net Framework
3.5).
</p>
        <p>
In a couple of minutes, I was able to generate a data class using the new visual OR/M
tool in VS2008, create a binding source, drag/drop elements from the binding source
onto my form, and create a functional application. Functional should not
be confused with enterprise level, nor was I expecting it to be. If I could create
something like that in 2 minutes using drag and drop, my value ($$$$) as a developer
would be on the decline. Allow me to recap some of my steps I took to create a functional
application.
</p>
        <ol>
          <li>
Create a new Winforms 3.5 
</li>
          <li>
Right click on the new project and select add new item, choose Linq To SQL Classses. 
<ol><li>
This will create a new .dbml file. It will open a design surface where you can drag/drop
tables, views and stored procedures. This creates a DataContext class.</li></ol></li>
          <li>
Create a new database connection, or open an existing connection on your Server Explorer
Window 
</li>
          <li>
Drag tables from the database from the Server Explorer to the design surface of your
DataContext class. 
</li>
          <li>
From the top menu bar, choose Data/Add new data source, or, show the data sources
window, and choose the add new data source option 
<ol><li>
Create a project data source 
</li><li>
Here is where it starts to get tricky. Select an object to make a data source for.
It will depend on what you are trying to accomplish and your database schema. The
schema I was using, relies heavily on extended tables, and it took me a couple of
tries to pick the object that made the most sense. It's possible that I will have
to go back and create a different object down the road as I get more into this.</li></ol></li>
          <li>
If you haven't already opened the Data Source window, do so now. Select some elements
from your data source, and drag/drop them onto the default Form1. I chose a grid to
list a collection of objects, and then their details below. A BindingNavigator was
added for me automatically. If you didn't get one, or need to add one later, just
drag one onto the form from the tool box, and set it's BindingSource property to the
bind source you created in step 5. 
</li>
          <li>
Open the code view of Form1 
</li>
          <li>
Add a private member variable: DataClasses1DataContext test; 
</li>
          <li>
Under the form's constructor, do the following</li>
        </ol>
        <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
          <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; 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 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: #606060"> 1:</span>
              <span style="color: #0000ff">public</span> Form1()</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: #606060"> 2:</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: #606060"> 3:</span> InitializeComponent();</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: #606060"> 4:</span> test
= <span style="color: #0000ff">new</span> DataClasses1DataContext();</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: #606060"> 5:</span>
              <span style="color: #0000ff">if</span>(test.DatabaseExists()
== <span style="color: #0000ff">false</span>) <span style="color: #008000">//Not required,
just testing feature found thru intellisense</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: #606060"> 6:</span> test.CreateDatabase();</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: #606060"> 7:</span> x_t_personBindingSource.DataSource
= test.x_t_persons;</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: #606060"> 8:</span> }</pre>
          </div>
        </div>
        <li>
Jump back to the Form, and add a button to your binding navigator for saving. Double
click on the new button to have the event handler code generated and add the following:</li>
        <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
          <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; 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 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: #606060"> 1:</span>
              <span style="color: #0000ff">private</span>
              <span style="color: #0000ff">void</span> saveToolStripButton_Click(<span style="color: #0000ff">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: #f4f4f4; border-bottom-style: none">
              <span style="color: #606060"> 2:</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: #606060"> 3:</span> test.SubmitChanges(); <span style="color: #008000">//Need
to add exception handling and pre-save validation</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: #606060"> 4:</span> }</pre>
          </div>
        </div>
        <li>
Build and Debug.</li>
        <p>
A connection string is automatically added to your App.Config file for you. You
can test out the CreateDatabase feature by changing the connection string to
a non-existent database. You should be able to add/edit/delete records in your
database, using this simple application we just created. The DataContext class, is
the top level class in the hierarchy used to work with your database. It controls
the connection to the database, and, as you've seen, has support for creating and
deleting the database. The create database feature reminds me of a similar feature
in the Castle's <a href="http://www.castleproject.org/activerecord/index.html">Active
Record</a> project. Just take a look via object explorer or intelli-sense, all
of the methods available to you. I've listed the ones that caught my attention below. 
</p>
        <ul>
          <li>
Create/Delete Database</li>
          <li>
Deferred Loading Enabled: Implies that L2S uses deferred loading for many to one relationships</li>
          <li>
ExecuteCommand: Direct execution of a command.</li>
          <li>
ExecuteQuerey: Returns IEnumerable or &lt;T&gt; based on a provided query.</li>
          <li>
GetChangeSet: Returns changes tracked by the DataContext</li>
          <li>
Transaction: Set a transaction object to support transactions</li>
        </ul>
        <p>
          <strong>Validation - </strong>Check out ScottGu's <a href="http://weblogs.asp.net/scottgu/archive/2007/07/11/linq-to-sql-part-4-updating-our-database.aspx">part
4</a> on L2S
</p>
        <ul>
          <li>
Schema Validation - Linq is supposed to check for obvious schema issues, such as null
values. However, the exception I got when I tried to insert a null value, came from
SQL, not Linq. Also I was adding items on a grid, and added 2 items in a row. Their
Id fields were both set to 0, and when I went to save, I got a Linq exception saying
I couldn't have duplicate keys. Setting the ID values to something different, allowed
me to get to the database at least, so I need to look into this more.</li>
          <li>
Property and Submit Validation - Create a partial class, then a partial method
that implements validation when a property is changed. If you type partial in the
code view window, you will get a list of partial methods you can implement. You
have access to 2 methods for each property, OnChanging and OnChanged. You also get
access to a OnValidate method. If there is an error, you throw an exception. This
works OK, but doesn't provide the nicest feedback available. However, for anything
less then an enterprise application, this may be OK, especially in a proof of concept,
or highly iterative application, where you can add better a better user experience
later. </li>
          <li>
Insert/Update/Delete Validation - Same scheme as property and submit validation, but
you can have validation in response to an Insert, Update or Delete.</li>
          <li>
ChangeSet: Starting with Beta2, you can get access to all of the changes in the DataContext.
One possible use, is to inherit the DataContextClass, and override the SubmitChanges
method, checking the ChangeSet and performing validation.</li>
          <li>
My Take on validation: 
</li>
          <ul>
            <li>
There is some work that needs to be done with validation. I could see an edition to
the Enterprise Library designed specifically for L2S. 
</li>
            <li>
My own idea would be to create a class to track validation errors.</li>
            <ul>
              <li>
New custom exception called validation error. 
</li>
              <li>
A collection of validation errors, including error text, and the property that is
invalid</li>
              <li>
Starting to sound allot like CSLA</li>
            </ul>
          </ul>
        </ul>
        <p>
          <strong>Other things I noticed</strong>
        </p>
        <ul>
          <ul>
            <li>
You can manually create classes in the Design Surface, as well as edit the auto generated
ones</li>
            <ul>
              <li>
Control nullable, access modifier, and inheritance modifier.</li>
            </ul>
            <li>
There is an inheritance property you can set on the design surface, allowing you
to indicate which objects inherit from another. This looks very promising for some
of the schemas I work with.  </li>
          </ul>
        </ul>
        <p>
          <strong>What's Next?</strong>
        </p>
        <p>
I'm going to read over ScottGu's 7 part series on L2S to get some good ideas on what
I can do with L2S, and see how it can fit into future and existing projects. I am
really excited to see how people start to integrate L2S with their existing projects
and frameworks. Of particular interest would be using CSLA and L2S.
</p>
        <p>
          <strong>Additional Resources</strong>
        </p>
        <ul>
          <li>
            <a href="http://www.ftponline.com/vsm/2007_07/magazine/features/rjennings/">First
article I found, which I used to setup my example above</a>
          </li>
          <li>
ScottGu has a 7 part series on L2S. Here is a link to <a href="http://weblogs.asp.net/scottgu/archive/2007/07/11/linq-to-sql-part-4-updating-our-database.aspx">part
4</a> which I found when Googling for Validation Ideas.</li>
        </ul>
        <p>
          <strong>Note:</strong> First post where I've had formatted HTML for source code. I'm
using the <a href="http://gallery.live.com/liveItemDetail.aspx?li=d4409446-af7f-42ec-aa20-78aa5bac4748&amp;bt=9&amp;pl=8">Code
Snippet Plugin</a> for Windows Live Writer.
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=03d4c933-e2a7-4ad3-b51e-35543cea0389" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Linq to SQL</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,03d4c933-e2a7-4ad3-b51e-35543cea0389.aspx</guid>
      <link>http://blog.salvoz.com/2007/10/07/LinqToSQL.aspx</link>
      <pubDate>Sun, 07 Oct 2007 22:02:14 GMT</pubDate>
      <description>&lt;p&gt;
I'm not even sure what led me to start playing around with the new Linq to SQL&amp;nbsp;(formerly
called DLinq)&amp;nbsp;DAL&amp;nbsp;in VS2008B2, but I'm glad I did. I discovered some very
fascinating functionality that I believe will really shake up the way most developers
approach the DAL. I see some similarities&amp;nbsp; between Linq to SQL and other OR/M
plugins (tools, methodologies) out there, but since this is Microsoft's approach,
I anticipate it will catch on en mass. I don't believe Microsoft is trying to make
the other methods obsolete, but that they are delivering a product demanded by their
customers. One of the problems with the current OR/M scene, is that there are so many
options to choose from, that you never know if you've made the right choice. While
Linq to SQL, may have some deficiencies, it will give developers, and their managers
a little piece of mind when breaking from the traditional DAL mold. I can only hope
that Linq to SQL does not disappoint, even after taking into consideration it's a
Gen 1 product. Issues such as performance, extendibility,&amp;nbsp;and plugability (into
one's code or way of doing things)&amp;nbsp;are&amp;nbsp;some things that I want to explore
(as with any tool such as Linq to SQL). 
&lt;/p&gt;
&lt;p&gt;
I used this &lt;a href="http://www.ftponline.com/vsm/2007_07/magazine/features/rjennings/"&gt;article&lt;/a&gt;&amp;nbsp;to
help jump start my foray into Linq to SQL (let's just call it L2S from here on). Being
away from WinForms for so long, I've missed out on some of the data binding features
available, and was surprised to see how easy it was to get up and going with a grid
and details form. I remember seeing the videos when VS 2005 was coming out, but never
had a need to play around with it until now. I've also never had good luck with drag
and drop data binding, as it assumes to much, I'm hoping that there are plenty of
hooks available to help customize the data binding experience, but any fault with
data binding should not be confused with L2S as they are 2 separate features (actually
data binding is a feature, and L2S is a feature of VS 2008, and part of the .Net Framework
3.5).
&lt;/p&gt;
&lt;p&gt;
In a couple of minutes, I was able to generate a data class using the new visual OR/M
tool in VS2008, create a binding source, drag/drop elements from the binding source
onto my form, and create&amp;nbsp;a functional application. Functional should&amp;nbsp;not
be confused with enterprise level, nor was I expecting it to be. If I could create
something like that in 2 minutes using drag and drop,&amp;nbsp;my value ($$$$) as a developer
would be on the decline. Allow me to recap some of my steps I took to create a functional
application.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Create a new Winforms 3.5 
&lt;li&gt;
Right click on the new project and select add new item, choose Linq To SQL Classses. 
&lt;ol&gt;
&lt;li&gt;
This will create a new .dbml file. It will open a design surface where you can drag/drop
tables, views and stored procedures. This creates a DataContext class.&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;
Create a new database connection, or open an existing connection on your Server Explorer
Window 
&lt;li&gt;
Drag tables from the database from the Server Explorer to the design surface of your
DataContext class. 
&lt;li&gt;
From the top menu bar, choose Data/Add new data source, or, show the data sources
window, and choose the add new data source option 
&lt;ol&gt;
&lt;li&gt;
Create a project data source 
&lt;li&gt;
Here is where it starts to get tricky. Select an object to make a data source for.
It will depend on what you are trying to accomplish and your database schema. The
schema I was using, relies heavily on extended tables, and it took me a couple of
tries to pick the object that made the most sense. It's possible that I will have
to go back and create a different object down the road as I get more into this.&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;
If you haven't already opened the Data Source window, do so now. Select some elements
from your data source, and drag/drop them onto the default Form1. I chose a grid to
list a collection of objects, and then their details below. A BindingNavigator was
added for me automatically. If you didn't get one, or need to add one later, just
drag one onto the form from the tool box, and set it's BindingSource property to the
bind source you created in step 5. 
&lt;li&gt;
Open the code view of Form1 
&lt;li&gt;
Add a private member variable: DataClasses1DataContext test; 
&lt;li&gt;
Under the form's constructor, do the following&lt;/li&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; 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"&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Form1()&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 2:&lt;/span&gt; {&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 3:&lt;/span&gt; InitializeComponent();&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 4:&lt;/span&gt; test
= &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DataClasses1DataContext();&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;(test.DatabaseExists()
== &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;) &lt;span style="color: #008000"&gt;//Not required,
just testing feature found thru intellisense&lt;/span&gt;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 6:&lt;/span&gt; test.CreateDatabase();&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 7:&lt;/span&gt; x_t_personBindingSource.DataSource
= test.x_t_persons;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 8:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;li&gt;
Jump back to the Form, and add a button to your binding navigator for saving. Double
click on the new button to have the event handler code generated and add the following:&lt;/li&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; 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"&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; saveToolStripButton_Click(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender,
EventArgs e)&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 2:&lt;/span&gt; {&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 3:&lt;/span&gt; test.SubmitChanges(); &lt;span style="color: #008000"&gt;//Need
to add exception handling and pre-save validation&lt;/span&gt;&lt;/pre&gt;&lt;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"&gt;&lt;span style="color: #606060"&gt; 4:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;li&gt;
Build and Debug.&lt;/li&gt;&gt;
&lt;p&gt;
A connection string is automatically added&amp;nbsp;to your App.Config file for you. You
can test out the CreateDatabase feature by changing the&amp;nbsp;connection string to
a non-existent database. You should be able to add/edit/delete&amp;nbsp;records in&amp;nbsp;your
database, using this simple application we just created. The DataContext class, is
the top level class in the hierarchy used to work with your database. It controls
the connection to the database, and, as you've seen, has support for creating and
deleting the database. The create database feature reminds me of a similar feature
in the Castle's &lt;a href="http://www.castleproject.org/activerecord/index.html"&gt;Active
Record&lt;/a&gt;&amp;nbsp;project. Just take a look via object explorer or intelli-sense, all
of the methods available to you. I've listed the ones that caught my attention below.&amp;nbsp;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Create/Delete Database&lt;/li&gt;
&lt;li&gt;
Deferred Loading Enabled: Implies that L2S uses deferred loading for many to one relationships&lt;/li&gt;
&lt;li&gt;
ExecuteCommand: Direct execution of a command.&lt;/li&gt;
&lt;li&gt;
ExecuteQuerey: Returns IEnumerable or &amp;lt;T&amp;gt; based on a provided query.&lt;/li&gt;
&lt;li&gt;
GetChangeSet: Returns changes tracked by the DataContext&lt;/li&gt;
&lt;li&gt;
Transaction: Set a transaction object to support transactions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Validation - &lt;/strong&gt;Check out ScottGu's &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/07/11/linq-to-sql-part-4-updating-our-database.aspx"&gt;part
4&lt;/a&gt; on L2S
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Schema Validation - Linq is supposed to check for obvious schema issues, such as null
values. However, the exception I got when I tried to insert a null value, came from
SQL, not Linq. Also I was adding items on a grid, and added 2 items in a row. Their
Id fields were both set to 0, and when I went to save, I got a Linq exception saying
I couldn't have duplicate keys. Setting the ID values to something different, allowed
me to get to the database at least, so I need to look into this more.&lt;/li&gt;
&lt;li&gt;
Property and&amp;nbsp;Submit Validation - Create a partial class, then a partial method
that implements validation when a property is changed. If you type partial in the
code view window, you will get&amp;nbsp;a list of partial methods you can implement. You
have access to 2 methods for each property, OnChanging and OnChanged. You also get
access to a OnValidate method. If there is an error, you throw an exception. This
works OK, but doesn't provide the nicest feedback available. However, for anything
less then an enterprise application, this may be OK, especially in a proof of concept,
or highly iterative application, where you can add better a better user experience
later.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
Insert/Update/Delete Validation - Same scheme as property and submit validation, but
you can have validation in response to an Insert, Update or Delete.&lt;/li&gt;
&lt;li&gt;
ChangeSet: Starting with Beta2, you can get access to all of the changes in the DataContext.
One possible use, is to&amp;nbsp;inherit the DataContextClass, and override the SubmitChanges
method, checking the ChangeSet and performing validation.&lt;/li&gt;
&lt;li&gt;
My Take on validation: 
&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
There is some work that needs to be done with validation. I could see an edition to
the Enterprise Library designed specifically for L2S. 
&lt;/li&gt;
&lt;li&gt;
My own idea would be to create a class to track validation errors.&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
New custom exception called validation error. 
&lt;/li&gt;
&lt;li&gt;
A collection of validation errors, including error text, and the property that is
invalid&lt;/li&gt;
&lt;li&gt;
Starting to sound allot like CSLA&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Other things I noticed&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;
You can manually create classes in the Design Surface, as well as edit the auto generated
ones&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Control nullable, access modifier, and inheritance modifier.&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
There is an inheritance property you can set on the design surface, allowing&amp;nbsp;you
to indicate which objects inherit from another. This looks very promising for some
of the schemas&amp;nbsp;I work with. &amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;What's Next?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I'm going to read over ScottGu's 7 part series on L2S to get some good ideas on what
I can do with L2S, and see how it can fit into future and existing projects. I am
really excited to see how people start to integrate L2S with their existing projects
and frameworks. Of particular interest would be using CSLA and L2S.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Additional Resources&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.ftponline.com/vsm/2007_07/magazine/features/rjennings/"&gt;First
article I found, which I used to setup my example above&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
ScottGu has a 7 part series on L2S. Here is a link to &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/07/11/linq-to-sql-part-4-updating-our-database.aspx"&gt;part
4&lt;/a&gt; which I found when Googling for Validation Ideas.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Note:&lt;/strong&gt; First post where I've had formatted HTML for source code. I'm
using the &lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=d4409446-af7f-42ec-aa20-78aa5bac4748&amp;amp;bt=9&amp;amp;pl=8"&gt;Code
Snippet Plugin&lt;/a&gt;&amp;nbsp;for Windows Live Writer.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=03d4c933-e2a7-4ad3-b51e-35543cea0389" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,03d4c933-e2a7-4ad3-b51e-35543cea0389.aspx</comments>
      <category>Technology/Programming</category>
      <category>Technology/Review For Future Projects</category>
    </item>
    <item>
      <trackback:ping>http://blog.salvoz.com/Trackback.aspx?guid=bb76b1e4-4dfd-422d-a031-25afa174e1ed</trackback:ping>
      <pingback:server>http://blog.salvoz.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.salvoz.com/PermaLink,guid,bb76b1e4-4dfd-422d-a031-25afa174e1ed.aspx</pingback:target>
      <dc:creator>Adam Salvo</dc:creator>
      <wfw:comment>http://blog.salvoz.com/CommentView,guid,bb76b1e4-4dfd-422d-a031-25afa174e1ed.aspx</wfw:comment>
      <wfw:commentRss>http://blog.salvoz.com/SyndicationService.asmx/GetEntryCommentsRss?guid=bb76b1e4-4dfd-422d-a031-25afa174e1ed</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Wow! Microsoft is making available, starting with the core libraries of .net 3.5,
the full, commented source code for the .Net Framework. ScottGu posted about it <a href="http://weblogs.asp.net/scottgu/archive/2007/10/03/releasing-the-source-code-for-the-net-framework-libraries.aspx">here</a>,
and ScottH has a podcast about it <a href="http://www.hanselman.com/blog/HanselminutesPodcast83MicrosoftToReleaseNETFrameworkLibrariesSource.aspx">here</a>.
Not only are they releasing the source code, but they are doing it in such a way as
to make it actually useful to the end developer, by offering full support in Visual
Studio 2008. Not only can you download the source and install it, but Visual Studio
2008 will be smart enough to go out to a server hosted by Microsoft and dynamically
download the correct source file. By correct, I mean, that the service is smart enough
to know what patches, service packs, etc you have installed. Chalk this up as one
huge reason to jump on the VS 2008 band wagon. 
</p>
        <p>
For those of you in legal, the code is released under the <a title="Microsoft Reference License" href="http://www.microsoft.com/resources/sharedsource/licensingbasics/referencelicense.mspx">Microsoft
Reference License</a>, which in a nutshell, states you can review, but not compile.
Now at first, I thought, who cares if you can't recompile, but then I got to thinking,
and remembered a project someone was telling me about where they used reflector to
view the source and implement an asp.net server running off the compact framework.
Given the use of the compact framework on my <a href="http://www.tersosolutions.com">current
project</a>, I could see a similar need arising. I will have to monitor this closely
and see what other people say, as I'm sure I won't be the only one looking to implement
some full framework features on our closed WinCE systems. 
</p>
        <img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=bb76b1e4-4dfd-422d-a031-25afa174e1ed" />
        <br />
        <hr />
This weblog is sponsored by <a href="http://www.salvoz.com">Adam Salvo</a>. 
</body>
      <title>Microsoft to Release .Net Framework Library Source Code</title>
      <guid isPermaLink="false">http://blog.salvoz.com/PermaLink,guid,bb76b1e4-4dfd-422d-a031-25afa174e1ed.aspx</guid>
      <link>http://blog.salvoz.com/2007/10/03/MicrosoftToReleaseNetFrameworkLibrarySourceCode.aspx</link>
      <pubDate>Wed, 03 Oct 2007 18:42:53 GMT</pubDate>
      <description>&lt;p&gt;
Wow! Microsoft is making available, starting with the core libraries of .net 3.5,
the full, commented source code for the .Net Framework. ScottGu posted about it &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/10/03/releasing-the-source-code-for-the-net-framework-libraries.aspx"&gt;here&lt;/a&gt;,
and ScottH has a podcast about it &lt;a href="http://www.hanselman.com/blog/HanselminutesPodcast83MicrosoftToReleaseNETFrameworkLibrariesSource.aspx"&gt;here&lt;/a&gt;.
Not only are they releasing the source code, but they are doing it in such a way as
to make it actually useful to the end developer, by offering full support in Visual
Studio 2008. Not only can you download the source and install it, but Visual Studio
2008 will be smart enough to go out to a server hosted by Microsoft and dynamically
download the correct source file. By correct, I mean, that the service is smart enough
to know what patches, service packs, etc you have installed. Chalk this up as one
huge reason to jump on the VS 2008 band wagon. 
&lt;/p&gt;
&lt;p&gt;
For those of you in legal, the code is released under the &lt;a title="Microsoft Reference License" href="http://www.microsoft.com/resources/sharedsource/licensingbasics/referencelicense.mspx"&gt;Microsoft
Reference License&lt;/a&gt;, which in a nutshell, states you can review, but not compile.
Now at first, I thought, who cares if you can't recompile, but then I got to thinking,
and remembered a project someone was telling me about where they used reflector to
view the source and implement an asp.net server running off the compact framework.
Given the use of the compact framework on my &lt;a href="http://www.tersosolutions.com"&gt;current
project&lt;/a&gt;, I could see a similar need arising. I will have to monitor this closely
and see what other people say, as I'm sure I won't be the only one looking to implement
some full framework features on our closed WinCE systems. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.salvoz.com/aggbug.ashx?id=bb76b1e4-4dfd-422d-a031-25afa174e1ed" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.salvoz.com"&gt;Adam Salvo&lt;/a&gt;. </description>
      <comments>http://blog.salvoz.com/CommentView,guid,bb76b1e4-4dfd-422d-a031-25afa174e1ed.aspx</comments>
      <category>Technology/Programming</category>
    </item>
  </channel>
</rss>