<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Thomas Gathings II</title>
        <link>http://geekswithblogs.net/thomasthedeuce/Default.aspx</link>
        <description>hey buddy, the truth hurts.</description>
        <language>en-US</language>
        <copyright>Thomas Gathings</copyright>
        <managingEditor>twgathings@yahoo.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>Thomas Gathings II</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/thomasthedeuce/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Sharing a Generic ViewModel with your master page</title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2009/11/13/136288.aspx</link>
            <description>&lt;div class="ExternalClassD28A011399174AC0B60A639A38542A56"&gt;
&lt;div&gt;If you have a generic ViewModel, such as ContosoViewModel&amp;lt;TModel&amp;gt;, you can share this with the master page, to an extent, by implementing an interface to the data your shared master might need. This will allow you to avoid using things like ViewDataDictionary for something like a 'Current Customer Id'. &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;so, here's a sample class signature for a generic view model:&lt;/div&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;public&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;class&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;EmsViewModel&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;lt;TModel&amp;gt; : &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;IEmsViewModel&lt;/font&gt;&lt;/font&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;and here is a typical view's Inherits attribute:&lt;/div&gt;
&lt;div&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;
&lt;p&gt;Inherits&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;="System.Web.Mvc.ViewPage&amp;lt;EmsViewModel&amp;lt;Finding&amp;gt;&amp;gt;"&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;and lastly, here is the master page's Inherits attribute:&lt;/div&gt;
&lt;div&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;
&lt;p&gt;Inherits&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;="System.Web.Mvc.ViewMasterPage&amp;lt;IEmsViewModel&amp;gt;"&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=136288"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=136288" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/136288.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2009/11/13/136288.aspx</guid>
            <pubDate>Fri, 13 Nov 2009 20:08:08 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/136288.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2009/11/13/136288.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/136288.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/136288.aspx</trackback:ping>
        </item>
        <item>
            <title>SQL Server Reporting Services Tip: Pass dataset results to a subreport to increase reuse and separate concerns</title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2009/11/13/136287.aspx</link>
            <description>&lt;div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;How do I pass dataset results to a subreport?  In the past, my answer warranted too heavy lifting: duplicate filtering logic and query scope in the subreport.&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;I came across this need as I was considering reusability in reports by leveraging subreports. This particular project, like many, has parent/child relationships.  In reporting, this manifests in some typical use cases, such as:&lt;/span&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;·&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;User wishes to see a list of the parent records that meet some search criteria&lt;/span&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;·&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;User wishes to see details for that parent, including lists of its children&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;Further, some of the child types need to be shown together (across different parents). For example, show me southeast sales across all product lines. With this use case in mind, I can use a single report to filter the master and use the resulting dataset to filter subreports. The concept is realized with the following steps:&lt;/span&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;·&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;Create a subreport that takes the master primary key as a multi-valued parameter&lt;/span&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;·&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;Create a master report with search criteria&lt;/span&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;·&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;In the master report, add a new parameter ‘ResultsOfSearch’, ensuring&lt;/span&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;o&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;It is Internal&lt;/span&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;o&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;It is Multi-value&lt;/span&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;o&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;Its default values come from the resulting dataset&lt;/span&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;·&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;Add the subreport, setting its parameter value to =Parameters!ResultsOfSearch&lt;/span&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt"&gt;That’s it. Now, the subreport will display all child records for parents that meet search criteria. The subreport is easily reused on the parent details report by passing the single parent id to the subreport.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=136287"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=136287" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/136287.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2009/11/13/136287.aspx</guid>
            <pubDate>Fri, 13 Nov 2009 20:05:45 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/136287.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2009/11/13/136287.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/136287.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/136287.aspx</trackback:ping>
        </item>
        <item>
            <title>Configurable Authorization: Subclassing ASP.Net MVC AuthorizeAttribute </title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2009/06/25/133056.aspx</link>
            <description>&lt;p&gt;&lt;font size="2" face="Verdana"&gt; With ASP.Net MVC, you can easily use AuthorizeAttribute to control access to controllers and actions. I found it limiting within the context of Windows Authentication. First, I wanted to configure the roles outside of an attibute. Properties of AuthorizeAttribute, as with all attributes, must be set a design-time, such as [Authorize(Roles = “MyCompany\AppAdmin”)]. I want to break that out to configuration so I can have [Authorize(Roles = “Editor”)] and configure the Editor role like this EditorRole=”MyCompany\AppAdmin”, where MyCompany\AppAdmin is an Active Directory security group.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Verdana"&gt;On a semi-related note, it isn't possible to use Users and Roles together with the AuthorizeAttribute. The implementation of AuthorizeCore (an internal, form template pattern in the AuthorizeAttribute class) is written to assert both users and roles. Crack it open with reflector and it's clearly evident. In the following example, only Joe.User can access this controller. Everyone else, including members of the Admins role, will recieve a 401.&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;[&lt;span style="COLOR: #2b91af"&gt;Authorize&lt;/span&gt;(Roles=&lt;span style="COLOR: #a31515"&gt;"Admins"&lt;/span&gt;, Users=&lt;span style="COLOR: #a31515"&gt;"MyCompany\\Joe.User"&lt;/span&gt;)]&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Verdana"&gt;The following code achieves my goals: configurable authorization using Roles, Users, or both in context of Windows Authentication.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;[&lt;span style="COLOR: #2b91af"&gt;AttributeUsage&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;AttributeTargets&lt;/span&gt;.Class | &lt;span style="COLOR: #2b91af"&gt;AttributeTargets&lt;/span&gt;.Method, AllowMultiple = &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;, Inherited = &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;)]&lt;/p&gt;
&lt;div style="FONT-FAMILY: Courier New; BACKGROUND: white; COLOR: black; FONT-SIZE: 9pt"&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;AuthorizeByConfigurationAttribute&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;AuthorizeAttribute&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;{&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    &lt;span style="COLOR: blue"&gt;private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;static&lt;/span&gt; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;[] SafeSplit(&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; toSplit)&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;.IsNullOrEmpty(toSplit)) &lt;span style="COLOR: blue"&gt;return&lt;/span&gt; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;[0];&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;var&lt;/span&gt; splitString = toSplit.Split(&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: blue"&gt;char&lt;/span&gt;[] { &lt;span style="COLOR: #a31515"&gt;','&lt;/span&gt; }, &lt;span style="COLOR: #2b91af"&gt;StringSplitOptions&lt;/span&gt;.RemoveEmptyEntries);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;return&lt;/span&gt; splitString;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    &lt;span style="COLOR: blue"&gt;protected&lt;/span&gt; &lt;span style="COLOR: blue"&gt;override&lt;/span&gt; &lt;span style="COLOR: blue"&gt;bool&lt;/span&gt; AuthorizeCore(&lt;span style="COLOR: #2b91af"&gt;HttpContextBase&lt;/span&gt; httpContext)&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (&lt;span style="COLOR: blue"&gt;false&lt;/span&gt; == &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;.IsNullOrEmpty(Users))&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: blue"&gt;throw&lt;/span&gt; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;NotSupportedException&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"Use of the Users property is not allowed; match Roles to settings in configuration with convention 'GroupsInRoleOf.&amp;lt;NamedRole&amp;gt;' for groups or 'UsersInRoleOf.&amp;lt;NamedRole&amp;gt;', where &amp;lt;NamedRole&amp;gt; is anything, such as Admin."&lt;/span&gt;);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; rolesToCheck = &lt;span style="COLOR: #2b91af"&gt;ConfigurationManager&lt;/span&gt;.AppSettings[&lt;span style="COLOR: #a31515"&gt;"GroupsInRoleOf."&lt;/span&gt; + Roles];&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; usersToCheck = &lt;span style="COLOR: #2b91af"&gt;ConfigurationManager&lt;/span&gt;.AppSettings[&lt;span style="COLOR: #a31515"&gt;"UsersInRoleOf."&lt;/span&gt; + Roles];&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (httpContext == &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;)&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: blue"&gt;throw&lt;/span&gt; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ArgumentNullException&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"httpContext"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: #2b91af"&gt;IPrincipal&lt;/span&gt; user = httpContext.User;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (!user.Identity.IsAuthenticated)&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: blue"&gt;return&lt;/span&gt; &lt;span style="COLOR: blue"&gt;false&lt;/span&gt;;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; ((SafeSplit(usersToCheck).Length &amp;gt; 0) &amp;amp;&amp;amp; SafeSplit(usersToCheck).Contains&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;(user.Identity.Name, &lt;span style="COLOR: #2b91af"&gt;StringComparer&lt;/span&gt;.OrdinalIgnoreCase))&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: blue"&gt;return&lt;/span&gt; &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; ((SafeSplit(rolesToCheck).Length &amp;gt; 0) &amp;amp;&amp;amp; SafeSplit(rolesToCheck).Any&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;(&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;bool&lt;/span&gt;&amp;gt;(user.IsInRole)))&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: blue"&gt;return&lt;/span&gt; &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;return&lt;/span&gt; &lt;span style="COLOR: blue"&gt;false&lt;/span&gt;;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;}&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;font size="2" face="Verdana"&gt;This first-cut uses concatenated keys in app settings. Better to have a custom ConfigurationSection, a simple class configured with an IOC-container, or the like. &lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;font size="2" face="Verdana"&gt;Sample appSettings&lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;div style="FONT-FAMILY: Courier New; BACKGROUND: white; COLOR: black; FONT-SIZE: 9pt"&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;add&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;key&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;GroupsInRoleOf.Editor&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;value&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;MyCompany\My&lt;/span&gt;&lt;font color="#0000ff"&gt;AppEditors&lt;/font&gt;"&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;add&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;key&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;UsersInRoleOf.Editor&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;value&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;MyCompany\JoeThePresident&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;!--EndFragment--&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;font size="2" face="Verdana"&gt;Sample attribute&lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;div style="FONT-FAMILY: Courier New; BACKGROUND: white; COLOR: black; FONT-SIZE: 9pt"&gt;
&lt;p style="MARGIN: 0px"&gt;[&lt;span style="COLOR: #2b91af"&gt;AuthorizeByConfiguration&lt;/span&gt;(Roles = &lt;span style="COLOR: #a31515"&gt;"Editor"&lt;/span&gt;)]&lt;/p&gt;
&lt;/div&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;!--EndFragment--&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133056"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133056" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/133056.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2009/06/25/133056.aspx</guid>
            <pubDate>Thu, 25 Jun 2009 22:06:23 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/133056.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2009/06/25/133056.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/133056.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/133056.aspx</trackback:ping>
        </item>
        <item>
            <title>Linq to SQL: an optimization on working with object graphs</title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2008/12/01/127500.aspx</link>
            <description>&lt;p&gt;I was working on a small web application that was built very quickly using Linq to SQL and I wanted to ensure that a particular page wasn't loading more data than needed into memory. This particular page had a simple GridView, and in the one and only item template, there was an ASP.Net Image (along with some other stuff).&lt;/p&gt;
&lt;p&gt;The data source was of type IQueryable&amp;lt;Article&amp;gt; and an Article may have zero to many ArticleImages. A relationship was present in the dbml, so the ArticleImages were generated as an entity set property. The requirements were to show a thumbnail if there was an image (the first) or else nothing. &lt;/p&gt;
&lt;p&gt;On the image, I set ImageUrl to &lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;%# DataBinder.Eval(Container.DataItem,"ArticleId","~/GetArticleImage.ashx?thumbnail=y&amp;amp;articleid={0}" ) %&amp;gt;&lt;/p&gt;
&lt;p&gt;and Visible to the expresssion: &lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;%# ((Article)Container.DataItem).ArticleImages.Count %&amp;gt;&lt;/p&gt;
&lt;p&gt; The page rendered properly but when I checked the data context log, I noticed that for every row in the GridView, the entire ArticleImage row was being loaded. As it turns out, this is well-documented behavior; in an object graph, if any property of an entity set is accessed, the entire entity is loaded. It is lazy-loaded by default and while this can be changed with DataLoadOptions, I don't believe you can specify options for individual properties. &lt;/p&gt;
&lt;p&gt;What I needed at this point was an efficient way to test whether or not there were any images. There are other ways to do this, such as:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;add a calculated column leveraging a scalar UDF on your table &lt;/li&gt;
    &lt;li&gt;work with a view exposing only narrow metadata &lt;/li&gt;
    &lt;li&gt;separate your metadata into an intermediary table &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; I went with the addition of a property on the Article entity that counts a projected int and it looks like this:&lt;/p&gt;
&lt;div style="FONT-SIZE: 9pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;bool&lt;/span&gt; HasImage&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;{&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    &lt;span style="COLOR: blue"&gt;get&lt;/span&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: #2b91af"&gt;GreenCreditDataContext&lt;/span&gt; db = &lt;span style="COLOR: #2b91af"&gt;DataContextSessionManager&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;GreenCreditDataContext&lt;/span&gt;&amp;gt;.Instance;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;return&lt;/span&gt; db.ArticleImages.Where(x =&amp;gt; x.ArticleId == ArticleId).Count() &amp;gt; 0;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;!--EndFragment--&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;Ok so that problem was solved. However, there was another one. In the handler code that streams the image data to the browser, I was also loading the entire ArticleImage row. This was not necessary as I only needed the title and either the thumbnail data or the image data. Originally, I was calling the FirstOrDefault extension method on IQueryable&amp;lt;ArticleImage&amp;gt; from the data context. After a null check, I accessed either the ThumbnailData or the ImageData property, depending on the existence of a simple thumbnail querystring. However, the log shows that the entire row was loaded. My solution to this was to exercise Where (with the same Func expression used earlier), then chain that to a projection.&lt;/font&gt;&lt;/p&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;div style="FONT-SIZE: 9pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;pre style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;&lt;font face="Arial"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;(thumbnail)&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;{&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="COLOR: blue"&gt;var&lt;/span&gt; s = articleImages&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;        .Select(x =&amp;gt; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; { Data = x.ThumbnailData, Title = x.Title })&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;        .FirstOrDefault();&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (&lt;span style="COLOR: blue"&gt;null&lt;/span&gt; != s) Write(s.Data, s.Title);&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;}&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;{&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="COLOR: blue"&gt;var&lt;/span&gt; s = articleImages&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;        .Select(x =&amp;gt; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; { Data = x.ImageData, Title = x.Title})&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;        .FirstOrDefault();&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt; &lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;    &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (&lt;span style="COLOR: blue"&gt;null&lt;/span&gt; != s) Write(s.Data, s.Title);&lt;/pre&gt;
&lt;pre style="MARGIN: 0px"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;!--EndFragment--&gt;&lt;/div&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;font size="2"&gt;
&lt;div style="FONT-SIZE: 9pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;&lt;/div&gt;
&lt;div style="FONT-SIZE: 9pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;To wrap up, especially when working with datatypes of unrestrained size (such as varbinary(max)), check the logs to ensure your optimizing as necessary.&lt;/div&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127500"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127500" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/127500.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2008/12/01/127500.aspx</guid>
            <pubDate>Mon, 01 Dec 2008 13:56:02 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/127500.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2008/12/01/127500.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/127500.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/127500.aspx</trackback:ping>
        </item>
        <item>
            <title>Reverse Joins with Transient Provisioning</title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2008/01/17/118657.aspx</link>
            <description>&lt;p&gt;If you found this, then you know I'm talking about Microsoft Identity Integration Server (MIIS) / Identity Lifecycle Manager (ILM).  A reverse join is a concept that attempts to solve problems arising from joining existing connector space objects to newly created metaverse objects. Microsoft has a great &lt;a target="_blank" href="http://technet2.microsoft.com/ILM/en/library/d776f904-23f9-4756-9440-09901da5a9ee1033.mspx?mfr=true"&gt;white paper &lt;/a&gt;on the subject. &lt;/p&gt;
&lt;p&gt;I discovered that I might care about this subject because I couldn't get a few unit tests to pass. I had unit tests covering two inactivation scenarios. The tests followed two accounts (User A, User B) over 3 synchronization cycles. The first cycle provisioned the accounts. The second cycle inactivated them. The third cycle 'brought them back to life'. My tests correspond with what you'd expect: Assert the AD account is there and active, assert the AD account is disabled, assert the AD account is active. User A was inactivated with a status change and was correctly covered by deprovisioning actions with passing tests. User B, however, gave me a fit. User B was deleted (effectively deleted, I simply filtered out her account before the connector space import) before cycle 2 as part of the test fixture setup, deferring to object deletion rules. Her AD account was correctly disabled after cycle 2. So far, so good. However, when I brought her 'back to life' by removing the filter, I received provisioning errors about existing duplicate objects, exactly as outlined in the microsoft whitepaper.&lt;/p&gt;
&lt;p&gt;The whitepaper, although lacking in implementation details, does a great job contrasting 2 practical approaches to this problem using reverse joins. One, using transient provisioning is simpler, but it smacks you with a sinking stomach feeling because you are PURPOSEFULLY CREATING DUPLICATE CONNECTOR SPACE OBJECTS!  The other, reverse joins with auxillary management agents, has been &lt;a href="http://miisexperts.org/craigm/2006/10/reverse-joining.html"&gt;posted about by Craig Martin&lt;/a&gt;. I was at first more interested in this approach because it sounds elegant but also very complex. I despise complexity so much that I gave the other approach some more thought. Glad I did, because it turns out to be valid, robust, and as easy as this:&lt;/p&gt;
&lt;p&gt;1. &lt;font face="Arial"&gt;Run profiles must be run in an exact order, where at least a delta synchronization is performed on the CS before export&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;2. Add this code to your provisioning block, testing the condition of more than one connectors:&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;ElseIf numConnectors &amp;gt; 1 Then&lt;br /&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt; Dim connector As CSEntry&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt; For Each connector In activeDirectoryManagementAgent.Connectors&lt;br /&gt;
  If connector.ConnectionRule = RuleType.Provisioning Then connector.Deprovision()&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt; Next&lt;br /&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;End If&lt;/font&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;If you're interested, read my blog entry about &lt;a href="http://geekswithblogs.net/thomasthedeuce/archive/2008/01/17/118655.aspx"&gt;unit testing identity management solutions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;
&lt;p&gt;Thomas&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=118657"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=118657" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/118657.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2008/01/17/118657.aspx</guid>
            <pubDate>Thu, 17 Jan 2008 22:44:38 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/118657.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2008/01/17/118657.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/118657.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/118657.aspx</trackback:ping>
        </item>
        <item>
            <title>Gain confidence with your MIIS or ILM Identity Management solutions</title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2008/01/17/118655.aspx</link>
            <description>&lt;p&gt;Build automated unit tests for your identity management solutions just like you would a normal development  project. Trust me. Here's why:&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;Test Driven Design: design your test first. do your craft until the test passes.&lt;br /&gt;
Comfort and assurance: you know because you've run them 1001 times. others can run them too.&lt;br /&gt;
Free documentation: requirement and business rules can be inferred from the test cases.&lt;br /&gt;
Fix problems instead of looking for them: you will spend almost no time looking for defects&lt;br /&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;Yes, it requires an upfront investment but the payback is tremendous. Here's how.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;First, familiarize yourself with a unit testing framework. My favorite is &lt;a target="_blank" href="http://www.nunit.org"&gt;NUnit&lt;/a&gt;, which is simple, free, and used by the masses. &lt;/p&gt;
&lt;p&gt;Next, get creative. If your connected data sources consist of SQL Server, Active Directory, or any open platform, you'll simply be setting up data to validate your tests. For example, using SQL Server, I like to create a table with as little representative data as I can get away with, maybe 5 - 20 rows. I call this table UnitTestExportStatic. Then, I clone that table into another table, UnitTestExportRunnable. During setup of my test execution, I truncate UnitTestExportRunnable and copy all the rows from UnitTestExportStatic. I can freely make changes, such as updating an attribute to test the flow, to UnitTestExportRunnable throughout the testing of the management agent run profile sequences.&lt;/p&gt;
&lt;p&gt;Create one test fixture (a group of related tests) per management agent run profile sequence. Run as many sequences as you need to test some scenarios. For instance, my favorite tests have an active person that goes inactive, then gets reactivated. This takes 3 cycles to test each condition.  Name them something like A__InitialRun, B__SecondRun, etc, and be sure they run in order. Test fixtures support running setup code, which will run before any tests. Here is where you do things like delete accounts, update phone numbers, create accounts, and invoke the run profiles using the remote wmi calls.&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font face="Arial"&gt;[TestFixtureSetUp]&lt;br /&gt;
public void SetUpAll()&lt;br /&gt;
{&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt; new Setups.SetupEntitleSubContractorsForTeamSiteAndSubportalAccess().Run();&lt;br /&gt;
 new Setups.SetupAddMockUser02().Run(); &lt;br /&gt;
 new Setups.SetupInactivateMockUser06().Run();&lt;br /&gt;
 new Setups.SetupUpdateMockUser03Attributes().Run();&lt;br /&gt;
 new Setups.SetupRunAllManagementAgents().Run();&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;}&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;Here's a sample of vbscript to execute a remote wmi call to MIIS. Just pass in the management agent Guid and the run profile name.&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt; Dim Locator &lt;br /&gt;
 Dim Service &lt;br /&gt;
 Dim ManagementAgent &lt;br /&gt;
 Dim MASet &lt;br /&gt;
 Dim MA &lt;br /&gt;
 Const PktPrivacy = 6 &lt;br /&gt;
 Const wbemAuthenticationLevelPkt = 6 &lt;br /&gt;
 Set Locator = CreateObject("WbemScripting.SWbemLocator") &lt;br /&gt;
 Locator.Security_.AuthenticationLevel = wbemAuthenticationLevelPkt &lt;br /&gt;
 Set Service = Locator.ConnectServer("[your server]", "root/MicrosoftIdentityIntegrationServer", "[domain\user]", "[password]") &lt;br /&gt;
 Set MASet   = Service.ExecQuery("select * from MIIS_ManagementAgent where Guid = '{" &amp;amp; WScript.Arguments(0) &amp;amp; "}'") &lt;br /&gt;
 for each MA in MASet &lt;br /&gt;
 MA.Execute(WScript.Arguments(1)) &lt;br /&gt;
 next&lt;/font&gt;&lt;/p&gt;
&lt;p&gt; So, you're well on your way to a fully automated unit tests. Almost. The only thing you cannot automate (with MIIS) is the deletion of connector space objects. You must open the MIIS console, right-click every MA, choose delete, make sure it's 'delete connector space only', and click ok. I guess this is for the best, but 10 or so clicks is really nothing compared to the payback of automating the rest.&lt;/p&gt;
&lt;p&gt;Last, I'll leave you with one challenge: stick with it. Again, there is an upfront investment but it's has an incredible return. Plus, it is always possible to automate a test. Ok, it's not always possible to automate a test, but you can still include the 'not-automatable' test in your unit test project with my handy-dandy 'human intervention' class.&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;public class HumanIntervention&lt;br /&gt;
{&lt;br /&gt;
 public static void Assert(string test)&lt;br /&gt;
 {&lt;br /&gt;
  DialogResult result = MessageBox.Show&lt;br /&gt;
   (test, "Human Involvement", MessageBoxButtons.YesNo);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;  if (result == DialogResult.No)&lt;br /&gt;
  {&lt;br /&gt;
   throw new ApplicationException("A human involved test failed: " + test);&lt;br /&gt;
  }&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt; &lt;br /&gt;
 }&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;}&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Using human intervention in your unit tests:&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;&lt;br /&gt;
[Test]&lt;br /&gt;
public void MockUser03AddedToBlackBoxSystem()&lt;br /&gt;
{&lt;br /&gt;
 &lt;br /&gt;
 HumanIntervention.Assert("Was Mock User 03 successfully added to Black Box?");&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;
&lt;p&gt;Thomas &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=118655"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=118655" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/118655.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2008/01/17/118655.aspx</guid>
            <pubDate>Thu, 17 Jan 2008 21:38:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/118655.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2008/01/17/118655.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/118655.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/118655.aspx</trackback:ping>
        </item>
        <item>
            <title>ASP.Net 2.0 CS0716: Cannot convert to static type 'System.Web.Security.Roles'</title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2006/04/10/74757.aspx</link>
            <description>&lt;P&gt;I have a simple page which displays the current users active roles. Silly me, I thought a good name would be 'Roles'. &lt;/P&gt;
&lt;P&gt;Turns out, this caused a namespace collision, I think, with&amp;nbsp;the static class System.Web.Security.Roles. The namespace 'System.Web.Security' is included by default with ASP.NET 2.0 code-behinds. Also of interest, by default there are no namespace regions with code-behinds. Not wanting to stray from the typified lazy developer, I left this as-is. Hey, Microsoft knows best.&lt;/P&gt;
&lt;P&gt;This error only appeared on the release to production, as I chose the 'Publish Web Site' deployment method, where I was using the 'Copy Web Site' deployment method to our QA server. For some reason, only the former method yields this error. &lt;/P&gt;
&lt;P&gt;The fix? Changed 'Roles' to '_Roles'. Alternatively, I could have enclosed the class in a namespace. &lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=74757"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=74757" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/74757.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2006/04/10/74757.aspx</guid>
            <pubDate>Mon, 10 Apr 2006 16:33:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/74757.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2006/04/10/74757.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/74757.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/74757.aspx</trackback:ping>
        </item>
        <item>
            <title>Xml ThinNet API integration with JD Edwards, iWay Adapter</title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2006/01/11/65533.aspx</link>
            <description>&lt;P&gt;Anybody doing integration with JD Edwards? We are on OneWorld 8.0. We have purchased adapters from iWay Software but I am having some&amp;nbsp;pains getting up and running, namely while attempting to connect through the JDEdwards adapter. I get the following exception: &lt;/P&gt;
&lt;P&gt;Error getting target [JD Edwards] Failed to connect....com.jdedwards.system.net.JdeNetConnectionClosedException: Connection closed by server&lt;/P&gt;
&lt;P&gt;I've done the setup work from the installation guide). I am have trouble getting support on this...anybody have a clue? &lt;/P&gt;
&lt;P&gt;Also, I would like to establish contact with anyone in the community using iWay, whether or not for JD Edwards....maybe trade some ideas, war stories, that sort of thing.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=65533"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=65533" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/65533.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2006/01/11/65533.aspx</guid>
            <pubDate>Wed, 11 Jan 2006 18:18:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/65533.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2006/01/11/65533.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/65533.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/65533.aspx</trackback:ping>
        </item>
        <item>
            <title>Access to the path "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files...</title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2006/01/11/65516.aspx</link>
            <description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;I see a lot of trouble user have out there when using impersonation under ASP.NET (&amp;lt;identity impersonate=&amp;#8221;true&amp;#8221; /&amp;gt;), namely something such as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Access to the path "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;For our situation, we are using specified credentials ( e.g., &amp;lt;identity impersonate="true" userName="MYDOMAIN\applicationService" password="password" /&amp;gt;) under IIS 6.0 using the default app pool.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Well, I was getting the above error as well, and the simplest way to handle it, I've found, is to add your identity to the IIS_WPG (IIS worker process group). This group seemed to come with all the necessary rights under both NTFS and the Local Security Policy. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=65516"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=65516" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/65516.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2006/01/11/65516.aspx</guid>
            <pubDate>Wed, 11 Jan 2006 14:58:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/65516.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2006/01/11/65516.aspx#feedback</comments>
            <slash:comments>24</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/65516.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/65516.aspx</trackback:ping>
        </item>
        <item>
            <title>Using Enterprise Library? Use a Post Build Event for pain-free config file copying</title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2005/12/29/64432.aspx</link>
            <description>&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Using a post-build event can be a time saver. You can create command lines in the project property pages (right-click the project, say your winform or console, in the solution explorer and then choose 'Properties'). Under common properties, choose 'Build Events'. Then click the ellipsis beside Post-build Command Line. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;In this dialog, you can run commands and&amp;nbsp;call other programs. For this topic, enter this simple one-liner to have all those Enterprise Library config files nicely copied to your output directory:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 12pt 0.5in; TEXT-INDENT: 0.5in"&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;SPAN class=GramE&gt;&lt;B&gt;copy&lt;/B&gt;&lt;/SPAN&gt;&lt;B&gt; $(&lt;SPAN class=SpellE&gt;ProjectDir&lt;/SPAN&gt;)*.&lt;SPAN class=SpellE&gt;config&lt;/SPAN&gt; $(&lt;SPAN class=SpellE&gt;ProjectDir&lt;/SPAN&gt;)$(&lt;SPAN class=SpellE&gt;OutDir&lt;/SPAN&gt;)&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 12pt 0.5in; TEXT-INDENT: 0.5in"&gt;&lt;STRONG&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=64432"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=64432" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/64432.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2005/12/29/64432.aspx</guid>
            <pubDate>Fri, 30 Dec 2005 01:02:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/64432.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2005/12/29/64432.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/64432.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/64432.aspx</trackback:ping>
        </item>
        <item>
            <title>InfoPath hangs...boils down to Thread Identity/Thread Principal</title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2005/12/28/64322.aspx</link>
            <description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;As i toiled over this, I was sure there was some problem with the InfoPath Automation I was doing:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="Courier New" color=#a52a2a size=2&gt;&lt;FONT size=2&gt;
&lt;P&gt;infoPathApplication = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; ApplicationClass();&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;oXDocumentCollection = infoPathApplication.XDocuments;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#a52a2a size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#a52a2a size=2&gt;oXDocument = oXDocumentCollection.NewFromSolution(psrTemplateUrl);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The symptom: InfoPath just hangs right on this line. Now, to put some context around it...&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I found&amp;nbsp;a nifty way to save our accountants tons of hours through the year by prefilling parts of the form. The accountants select a lookup key from a dropdown, and the associated rules run some directives that do some stuff. Anyway, I could automate all that for all accountants just by pluggin in the value right into the Xml Document Object Model used by InfoPath (more on that later). This process is invoked from a web service call, hence it runs in the ASP.NET context.&amp;nbsp; Additionally, to mock a Request-only message pattern (because this takes about an hour to run), I split off a worker thread so the main thread could return immediately. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The problem manifested when I deployed this solution to the dev server. First I got some security errors...Oh, I need to impersonate, so I do so in Web.config. Then, some more hanging. Oh! I need to login as my impersonated account and clear some of the IE warning dialogs. OK so far. This is when I split off a thread from the threadpool using the BeginInvoke pattern of the Delegate class. Again, more security errors occurred. After a quick Google search, I see that worker threads are now harnessed under the WindowsIdentity that harnessed them. So, one can use the WindowsImpersonationContext class to solve this (anywhere in code running under the ThreadPool thread):&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#a52a2a size=2&gt;WindowsIdentity winId = WindowsIdentity.GetCurrent();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#a52a2a size=2&gt;WindowsImpersonationContext impersonationContext = winId.Impersonate();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#a52a2a size=2&gt;&lt;FONT face=Arial color=#000000&gt;Impersonation occurs until you undo it with:&lt;/FONT&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#a52a2a size=2&gt;impersonationContext.Undo();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;At this point, more hair pulling because InfoPath continued to hang at the NewFromSolution() call. Finally, I thought to assign the thread the same principle as the WindowsPrincipal (which seemed to show up as the authenticated caller, not the impersonation context) - And voila, we're cooking with grease!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#a52a2a size=2&gt;WindowsImpersonationContext impersonationContext = winId.Impersonate();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New" color=#a52a2a&gt;System.Security.Principal.WindowsPrincipal principal = new WindowsPrincipal(winId);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#a52a2a size=2&gt;System.Threading.Thread.CurrentPrincipal= principal;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Oh, and for those of you still hangin' on for the InfoPath automation solution....&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Remember that a control (named 'NameLookUp) had some rules on it. The rules will execute when you set the .text property through automation. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;You will need to reference 2 assemblies&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;1) Microsoft Office InfoPath 1.0 Type Library. You can find this in the COM section of your add reference dialog&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;2) Microsoft.Office.Interop.InfoPath.Xml. To find this gem, browse to:C:\Program Files\Microsoft Office\OFFICE11\Microsoft.Office.Interop.InfoPath.Xml.dll&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;It is as simple as this (the setup code from above applies):&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#a52a2a&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New" color=#a52a2a&gt; Microsoft.Office.Interop.InfoPath;&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#a52a2a size=2&gt;Microsoft.Office.Interop.InfoPath.Xml.IXMLDOMNode oProjectNumber;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#a52a2a size=2&gt;oProjectNumber&amp;nbsp;= oXDocument.DOM.selectSingleNode("//my:NameLookUp");&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#a52a2a size=2&gt;oProjectNumber.text = projectNumber;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;FONT face="Courier New" color=#a52a2a&gt;oXDocument.SaveAs(savePath + fileName);&lt;/FONT&gt;&amp;nbsp;&lt;FONT face="Courier New" color=#008000&gt; //here i am just saving the prefilled form for the accountants.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=64322"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=64322" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/64322.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2005/12/28/64322.aspx</guid>
            <pubDate>Wed, 28 Dec 2005 20:44:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/64322.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2005/12/28/64322.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/64322.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/64322.aspx</trackback:ping>
        </item>
        <item>
            <title>A Builder pattern for repeated string concatenation with separators</title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2005/10/31/58741.aspx</link>
            <description>&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;ever needed to something like&amp;nbsp;this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;for(int i=0;i&amp;lt;names.Length;i++)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp; displayNames+= names[i].ToString +&amp;#8220;, &amp;#8220;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;displayNames = displayNames.SubString(displayNames.Length-2, 2);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;That stinks having to worry about that last concatentation. Builder pattern to the rescue. This class lets you concatenate strings with any character or string and never outputs the junk at the end. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;here is a usage example:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;ConcatBuilder commaConcat = ConcatBuilder.&lt;FONT size=2&gt;CreateCustomConcatBuilder(&amp;#8220;, &amp;#8220;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;commaConcat.Add(&amp;#8220;slim&amp;#8220;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;commaConcat.Add(&amp;#8220;lightweight&amp;#8220;);&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Tahoma size=2&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;commaConcat.Add(&amp;#8220;attractive&amp;#8220;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;return commaConcat.ToString();&amp;nbsp; //returns &amp;#8220;slim, lightweight, attractive&amp;#8220;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&amp;lt;code&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Collections.Specialized;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Text;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;namespace&lt;/FONT&gt;&lt;FONT size=2&gt; x&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;summary&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#808080 size=2&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; A Builder for concatenating strings with separator strings. &lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; Simplifies checking for length and null of each part before &lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; applying the separator&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;/summary&amp;gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;class&lt;/FONT&gt;&lt;FONT size=2&gt; ConcatBuilder&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; _separator = &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;" - "&lt;/FONT&gt;&lt;FONT size=2&gt;;&lt;/P&gt;
&lt;P&gt;StringCollection _parts = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; StringCollection();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;private&lt;/FONT&gt;&lt;FONT size=2&gt; ConcatBuilder()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;private&lt;/FONT&gt;&lt;FONT size=2&gt; ConcatBuilder(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; separator)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;_separator = separator;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;static&lt;/FONT&gt;&lt;FONT size=2&gt; ConcatBuilder CreateHyphenConcatBuilder()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; ConcatBuilder(); &lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;static&lt;/FONT&gt;&lt;FONT size=2&gt; ConcatBuilder CreateCustomConcatBuilder(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; separator)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; ConcatBuilder(separator);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; Add(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; part)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;null&lt;/FONT&gt;&lt;FONT size=2&gt; != part &amp;amp;&amp;amp; part.Trim() != &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt;.Empty) &lt;/P&gt;
&lt;P&gt;_parts.Add(part);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; Clear()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;_parts.Clear();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;override&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; ToString()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;StringBuilder&lt;/FONT&gt;&lt;FONT size=2&gt; sb = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;StringBuilder&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;for&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;int&lt;/FONT&gt;&lt;FONT size=2&gt; i=0; i &amp;lt; _parts.Count; i++)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;sb.Append(_parts[i]);&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt;(i &amp;lt; _parts.Count -1) sb.Append(_separator);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; sb.ToString();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&amp;lt;/code&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=58741"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=58741" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/58741.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2005/10/31/58741.aspx</guid>
            <pubDate>Tue, 01 Nov 2005 00:21:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/58741.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2005/10/31/58741.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/58741.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/58741.aspx</trackback:ping>
        </item>
        <item>
            <title>nifty class that abstracts an interval or range</title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2005/10/31/58738.aspx</link>
            <description>&lt;P&gt;the following class cleans up ugly code that tests whether value a is between value b and value c. it works with any class implementing IComparable.&lt;/P&gt;
&lt;P&gt;so stuff like this:&lt;/P&gt;
&lt;P&gt;if(myDate &amp;gt;= startDate &amp;amp;&amp;amp; myDate &amp;nbsp;&amp;lt;= endDate) ..&lt;/P&gt;
&lt;P&gt;becomes this:&lt;/P&gt;
&lt;P&gt;if(goodInterval.IsInInterval(myDate))&lt;/P&gt;
&lt;P&gt;=========================&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;
&lt;P&gt;using System;&lt;/P&gt;
&lt;P&gt;namespace x.Utility&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;public enum IntervalComparison&lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;Inclusive =0,&lt;BR&gt;&amp;nbsp;&amp;nbsp;Exclusive&lt;BR&gt;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;/// &amp;lt;summary&amp;gt;&lt;BR&gt;&amp;nbsp;/// Provides interval needs, defaults to Inclusive on start and end&lt;BR&gt;&amp;nbsp;/// &amp;lt;/summary&amp;gt;&lt;BR&gt;&amp;nbsp;public class Interval&lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;private IComparable _start;&lt;BR&gt;&amp;nbsp;&amp;nbsp;private IComparable _end;&lt;BR&gt;&amp;nbsp;&amp;nbsp;private IntervalComparison _startComparison = IntervalComparison.Inclusive;&lt;BR&gt;&amp;nbsp;&amp;nbsp;private IntervalComparison _endComparison = IntervalComparison.Inclusive;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;public Interval(IComparable start, IComparable end)&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;_start = start;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;_end = end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;public Interval(IComparable start, IComparable end, IntervalComparison startComparison, IntervalComparison endComparison)&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;_start = start;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;_end = end;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;_startComparison = startComparison;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;_endComparison = endComparison;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;public IComparable IntervalStart&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;get{ return _start; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;public IComparable IntervalEnd&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;get{ return _end; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;public bool IsInInterval(IComparable comparable)&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(_startComparison == IntervalComparison.Inclusive) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(1 == _start.CompareTo(comparable)) return false;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(_startComparison == IntervalComparison.Exclusive) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(-1 != _start.CompareTo(comparable) ) return false;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(_endComparison == IntervalComparison.Inclusive) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(0 &amp;gt; _end.CompareTo(comparable) ) return false;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(_endComparison == IntervalComparison.Exclusive) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(1 != _end.CompareTo(comparable) ) return false;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return true;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;}&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;&amp;lt;/code&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=58738"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=58738" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/58738.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2005/10/31/58738.aspx</guid>
            <pubDate>Tue, 01 Nov 2005 00:06:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/58738.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2005/10/31/58738.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/58738.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/58738.aspx</trackback:ping>
        </item>
        <item>
            <title>are BizTalk and InfoPath in diametric opposition regarding web authentication and authorization?</title>
            <link>http://geekswithblogs.net/thomasthedeuce/archive/2005/10/31/58737.aspx</link>
            <description>&lt;P&gt;scratching my head for the past few days...&lt;/P&gt;
&lt;P&gt;in our current SOA migration, i am running into an intrestring quandry. take a composable web service, GetStatusReports.&amp;nbsp;so just how can i provide a suitable authentication and authorization schemes that agree with&amp;nbsp;InfoPath AND BizTalk, where both are consumers of this service?&lt;/P&gt;
&lt;P&gt;InfoPath: &lt;/P&gt;
&lt;P&gt;Supports Integrated Windows Authentication&lt;/P&gt;
&lt;P&gt;Lacks Web Service Extensions (WSE 2.0)&lt;/P&gt;
&lt;P&gt;Custom authentication may not be suitable, as there is no secure place to store credentials.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BizTalk:&lt;/P&gt;
&lt;P&gt;Supports Web Service Extensions (WSE 2.0) with a microsoft-supported adapter&lt;/P&gt;
&lt;P&gt;Lacks Integrated Windows Authentication (as far as i can tell, 401 forbidden returned if anonymous disallowed)&lt;/P&gt;
&lt;P&gt;Custom authentication may be suitable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What other options have i missed? Right now, I can only run the service under ASP.NET impersonation&amp;nbsp;with a domain user account.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=58737"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=58737" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/thomasthedeuce/aggbug/58737.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Thomas Gathings</dc:creator>
            <guid>http://geekswithblogs.net/thomasthedeuce/archive/2005/10/31/58737.aspx</guid>
            <pubDate>Mon, 31 Oct 2005 23:55:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/thomasthedeuce/comments/58737.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/thomasthedeuce/archive/2005/10/31/58737.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/thomasthedeuce/comments/commentRss/58737.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/thomasthedeuce/services/trackbacks/58737.aspx</trackback:ping>
        </item>
    </channel>
</rss>