<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Hongye Sun's Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/hongyes/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/hongyes/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:23:07 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>ASP.NET Web API OData - Support Composite Key</title>
      <link>https://docs.microsoft.com/archive/blogs/hongyes/asp-net-web-api-odata-support-composite-key</link>
      <pubDate>Tue, 05 Feb 2013 17:13:00 GMT</pubDate>
      <dc:creator><![CDATA[Hongye Sun - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hongyes/2013/02/05/asp-net-web-api-odata-support-composite-key/</guid>
      <description><![CDATA[The default EntitySetController doesn't support composite keys. So if you have composite key models,...]]></description>
      <content:encoded><![CDATA[<p>The default EntitySetController doesn't support composite keys. So if you have composite key models, you need some additional work. Here is an example about how to do that.<br />The model is simple:</p>
<p><span style="font-family: 'courier new', courier;">public class Person</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;">{</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;[Key]</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;public string FirstName { get; set; }</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;[Key]</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;public string LastName { get; set; }</span><br class="kix-line-break" /><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;public int Age { get; set; }</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;">}</span><br class="kix-line-break" /><br />The odata url for this model will look like:<br /><span style="font-family: 'courier new', courier;">GET&nbsp;<a href="http://localhost:33051/People(FirstName=">http://localhost:33051/People(FirstName='Kate',LastName='Jones</a>') HTTP/1.1</span><br class="kix-line-break" /><br />And we want to have strong typed parameters in web api actions to this URL.<br /> &nbsp;&nbsp;public Person Get([FromODataUri] string firstName, [FromODataUri] string lastName)<br class="kix-line-break" /><br />Note that the FromODataUri model binder attribute is used to parse from odata uri representation to clr type. In odata, string value is "'xxx'" and we want it to be "xxx".<br />In order to make the route to work, you can add a custom routing convention to parse the key path. Here is a sample implementation:</p>
<p><span style="font-family: 'courier new', courier;">public class CompositeKeyRoutingConvention : EntityRoutingConvention</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;">{</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;public override string SelectAction(System.Web.Http.OData.Routing.ODataPath odataPath,<a href="http://msdn.microsoft.com/en-US/library/System.Web.Http.Controllers.HttpControllerContext.aspx">System.Web.Http.Controllers.HttpControllerContext</a> controllerContext, ILookup&lt;string, System.Web.Http.Controllers.HttpActionDescriptor&gt; actionMap)</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;{</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var action = base.SelectAction(odataPath, controllerContext, actionMap);</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (action != null)</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var routeValues = controllerContext.RouteData.Values;</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (routeValues.ContainsKey(ODataRouteConstants.Key))</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var keyRaw = routeValues[ODataRouteConstants.Key] as string;</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IEnumerable&lt;string&gt; compoundKeyPairs = keyRaw.Split(',');</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (compoundKeyPairs == null || compoundKeyPairs.Count() == 0)</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return action;</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br class="kix-line-break" /><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach (var compoundKeyPair in compoundKeyPairs)</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string[] pair = compoundKeyPair.Split('=');</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (pair == null || pair.Length != 2)</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var keyName = pair[0].Trim();</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var keyValue = pair[1].Trim();</span><br class="kix-line-break" /><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;routeValues.Add(keyName, keyValue);</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br class="kix-line-break" /><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return action;</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;}</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;">}</span><br class="kix-line-break" /><br />The convention is inherited from EntityRoutingConvention, which is the default convetion to handle entity key. By calling base.SelectAction, it will add the full key path into routeValues. The new convention will check if it contains "," and seperate it into multiple keys and set each of them into routeValues. So when web api select actions, it will use those values to determine which action to choose. If there is no "," found, it behaves same as base convetion.<br />To register the convetion, you need to set it when mapping odata route:</p>
<p><span style="font-family: 'courier new', courier;">public static class WebApiConfig</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;">{</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;public static void Register(HttpConfiguration config)</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;{</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;config.EnableQuerySupport();</span><br class="kix-line-break" /><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var mb = new ODataConventionModelBuilder(config);</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mb.EntitySet&lt;Person&gt;("People");</span><br class="kix-line-break" /><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var conventions = ODataRoutingConventions.CreateDefault();</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;conventions.Insert(0, new CompositeKeyRoutingConvention());</span><br class="kix-line-break" /><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;config.Routes.MapODataRoute(</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;routeName: "OData", </span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;routePrefix: null, </span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;model: mb.GetEdmModel(), </span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pathHandler: new DefaultODataPathHandler(), </span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;routingConventions: conventions);</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;}</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;">}</span><br class="kix-line-break" /><br />Register the route at the postion 0 is to make it be executed before other default routing convetions. So the default EntityRoutingConvetion won't be executed before it. After that, you should be able to get routing work.<br />Then, how to build url for composite keys? <br />You don't need to do that for odata links include edit link and self link when using ODataConventionModelBuilder. It will automatically identify composite keys and build the uri for you.<br />However, you need to build the link for location header. Here is a sample code from PeopleController.cs to handle post request:</p>
<p><span style="font-family: 'courier new', courier;">public HttpResponseMessage PostPerson(Person person)</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;">{</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;if (ModelState.IsValid)</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;{</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_repo.UpdateOrAdd(person);</span><br class="kix-line-break" /><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, person);</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string key = string.Format(</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"{0}={1},{2}={3}",</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"FirstName", ODataUriUtils.ConvertToUriLiteral(person.FirstName, Microsoft.Data.OData.ODataVersion.V3),</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"LastName", ODataUriUtils.ConvertToUriLiteral(person.LastName, Microsoft.Data.OData.ODataVersion.V3));</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;response.Headers.Location = new Uri(Url.ODataLink(</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new EntitySetPathSegment("People"),</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new KeyValuePathSegment(key)));</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return response;</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;}</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;else</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;{</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return Request.CreateResponse(HttpStatusCode.BadRequest);</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;"> &nbsp;&nbsp;&nbsp;}</span><br class="kix-line-break" /><span style="font-family: 'courier new', courier;">}</span><br class="kix-line-break" /><br />The source code can be downloaded from:&nbsp;<a href="http://code.msdn.microsoft.com/Support-Composite-Key-in-d1d53161">http://code.msdn.microsoft.com/Support-Composite-Key-in-d1d53161</a><br /><br /></p>]]></content:encoded>
    </item>
    <item>
      <title>Loop Reference handling in Web API</title>
      <link>https://docs.microsoft.com/archive/blogs/hongyes/loop-reference-handling-in-web-api</link>
      <pubDate>Tue, 04 Sep 2012 03:32:00 GMT</pubDate>
      <dc:creator><![CDATA[Hongye Sun - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hongyes/2012/09/04/loop-reference-handling-in-web-api/</guid>
      <description><![CDATA[The Issue
It's very common to have circular reference in models. For example, the following models...]]></description>
      <content:encoded><![CDATA[<h2>The Issue</h2>
<p>It's very common to have circular reference in models. For example, the following models shows a bidirection navigation property:</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> Category </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum2"> 2:</span> { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum3"> 3:</span>     <span style="color: #0000ff;">public</span> Category() </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum4"> 4:</span>     { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum5"> 5:</span>         Products = <span style="color: #0000ff;">new</span> Collection&lt;Product&gt;(); </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum6"> 6:</span>     } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum7"> 7:</span>     </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum8"> 8:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> Id { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum9"> 9:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Name { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum10"> 10:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">virtual</span> ICollection&lt;Product&gt; Products { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum11"> 11:</span> } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum12"> 12:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum13"> 13:</span> <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> Product </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum14"> 14:</span> { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum15"> 15:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> Id { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum16"> 16:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Name { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum17"> 17:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">virtual</span> Category Category { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum18"> 18:</span> } </pre>
<!--CRLF--></div>
</div>
<p>When using with Web Api by generating an EF scaffolding api controller, it won't work by default, however. The following error will occur when serializing with json.net serializer:</p>
<pre><code>Self referencing loop detected for property 'Category' with type </code></pre>
<pre><code>'System.Data.Entity.DynamicProxies.Category_A97AC61AD05BA6A886755C779FD3F96E86FE903ED7C9BA9400E79162C11BA719'. </code></pre>
<pre><code>Path '[0].Products[0]' </code></pre>
<p>The error occurs because the serializer doesn't know how to handle cirular reference. (Similar error occurs in xml serializer as well)</p>
<h2>Disable proxy and include reference</h2>
<p>EF proxy doesn't work well with POCO data serialization. There are several <a href="http://blogs.msdn.com/b/adonet/archive/2010/01/05/poco-proxies-part-2-serializing-poco-proxies.aspx">workarounds</a>. For simplicity, we just disable it in the data context class:</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> <span style="color: #0000ff;">public</span> CircularReferenceSampleContext() : <span style="color: #0000ff;">base</span>(<span style="color: #006080;">"name=CircularReferenceSampleContext"</span>) </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum2"> 2:</span> { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum3"> 3:</span>     Database.SetInitializer(<span style="color: #0000ff;">new</span> CircularReferenceDataInitializer()); </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum4"> 4:</span>     <span style="color: #0000ff;">this</span>.Configuration.LazyLoadingEnabled = <span style="color: #0000ff;">false</span>; </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum5"> 5:</span>     <span style="color: #0000ff;">this</span>.Configuration.ProxyCreationEnabled = <span style="color: #0000ff;">false</span>; </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum6"> 6:</span> } </pre>
<!--CRLF--></div>
</div>
<p>However, after disable proxy, the navigation property won't be lazy loaded. So you have to include the reference when retrieving data from database. Change the scaffolding controller code to:</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> <span style="color: #0000ff;">public</span> IEnumerable&lt;Product&gt; GetProducts() </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum2"> 2:</span> { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum3"> 3:</span>     <span style="color: #0000ff;">return</span> db.Products.Include(p =&gt; p.Category).AsEnumerable(); </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum4"> 4:</span> } </pre>
<!--CRLF--></div>
</div>
<p>The include call will include the reference data for all records.</p>
<h2>Fix 1: Ignoring circular reference globally</h2>
<p>json.net serializer supports to ignore circular reference on global setting. A quick fix is to put following code in WebApiConfig.cs file:</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; </pre>
<!--CRLF--></div>
</div>
<p>The simple fix will make serializer to ignore the reference which will cause a loop. However, it has limitations:</p>
<ul>
<li>The data loses the looping reference information</li>
<li>The fix only applies to JSON.net</li>
<li>The level of references can't be controlled if there is a deep reference chain</li>
</ul>
<h2>Fix 2: Preserving circular reference globally</h2>
<p>This second fix is similar to the first. Just change the code to:</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum2"> 2:</span>     = Newtonsoft.Json.ReferenceLoopHandling.Serialize; </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum3"> 3:</span> config.Formatters.JsonFormatter.SerializerSettings.PreserveReferencesHandling </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum4"> 4:</span>     = Newtonsoft.Json.PreserveReferencesHandling.Objects; </pre>
<!--CRLF--></div>
</div>
<p>The data shape will be changed after applying this setting.</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> [{<span style="color: #006080;">"$id"</span>:<span style="color: #006080;">"1"</span>,<span style="color: #006080;">"Category"</span>:{<span style="color: #006080;">"$id"</span>:<span style="color: #006080;">"2"</span>,<span style="color: #006080;">"Products"</span>:[{<span style="color: #006080;">"$id"</span>:<span style="color: #006080;">"3"</span>,<span style="color: #006080;">"Category"</span>:{<span style="color: #006080;">"$ref"</span>:<span style="color: #006080;">"2"</span>},<span style="color: #006080;">"Id"</span>:2,<span style="color: #006080;">"Name"</span>:<span style="color: #006080;">"Yogurt"</span>},{<span style="color: #006080;">"$ref"</span>:<span style="color: #006080;">"1"</span>}],<span style="color: #006080;">"Id"</span>:1,<span style="color: #006080;">"Name"</span>:<span style="color: #006080;">"Diary"</span>},<span style="color: #006080;">"Id"</span>:1,<span style="color: #006080;">"Name"</span>:<span style="color: #006080;">"Whole Milk"</span>},{<span style="color: #006080;">"$ref"</span>:<span style="color: #006080;">"3"</span>}] </pre>
<!--CRLF--></div>
</div>
<p>The $id and $ref keeps the all the references and makes the object graph level flat, but the client code needs to know the shape change to consume the data and it only applies to JSON.NET serializer as well.</p>
<h2>Fix 3: Ignore and preserve reference attributes</h2>
<p>This fix is decorate attributes on model class to control the serialization behavior on model or property level. To ignore the property:</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> Category </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum2"> 2:</span> { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum3"> 3:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> Id { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum4"> 4:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Name { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum5"> 5:</span>     </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum6"> 6:</span>     [JsonIgnore] </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum7"> 7:</span>     [IgnoreDataMember] </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum8"> 8:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">virtual</span> ICollection&lt;Product&gt; Products { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum9"> 9:</span> } </pre>
<!--CRLF--></div>
</div>
<p>JsonIgnore is for JSON.NET and IgnoreDataMember is for XmlDCSerializer. <br />To preserve reference:</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> <span style="color: #008000;">// Fix 3 </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum2"> 2:</span> [JsonObject(IsReference = <span style="color: #0000ff;">true</span>)] </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum3"> 3:</span> <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> Category </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum4"> 4:</span> { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum5"> 5:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> Id { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum6"> 6:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Name { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum7"> 7:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum8"> 8:</span>     <span style="color: #008000;">// Fix 3 </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum9"> 9:</span>     <span style="color: #008000;">//[JsonIgnore] </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum10"> 10:</span>     <span style="color: #008000;">//[IgnoreDataMember] </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum11"> 11:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">virtual</span> ICollection&lt;Product&gt; Products { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum12"> 12:</span> } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum13"> 13:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum14"> 14:</span> [DataContract(IsReference = <span style="color: #0000ff;">true</span>)] </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum15"> 15:</span> <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> Product </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum16"> 16:</span> { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum17"> 17:</span>     [Key] </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum18"> 18:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> Id { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum19"> 19:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum20"> 20:</span>     [DataMember] </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum21"> 21:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Name { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum22"> 22:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum23"> 23:</span>     [DataMember] </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum24"> 24:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">virtual</span> Category Category { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum25"> 25:</span> } </pre>
<!--CRLF--></div>
</div>
<p>[JsonObject(IsReference = true)] is for JSON.NET and [DataContract(IsReference = true)] is for XmlDCSerializer. Note that: after applying DataContract on class, you need to add DataMember to properties that you want to serialize.</p>
<p>The attributes can be applied on both json and xml serializer and gives more controls on model class.</p>
<p><a href="http://code.msdn.microsoft.com/Loop-Reference-handling-in-caaffaf7">Download sample code here</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Support $format in ASP.NET Web Api</title>
      <link>https://docs.microsoft.com/archive/blogs/hongyes/support-format-in-asp-net-web-api</link>
      <pubDate>Sun, 02 Sep 2012 00:33:00 GMT</pubDate>
      <dc:creator><![CDATA[Hongye Sun - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hongyes/2012/09/02/support-format-in-asp-net-web-api/</guid>
      <description><![CDATA[OData protocal defines $format to support different format:...]]></description>
      <content:encoded><![CDATA[<p>OData protocal defines $format to support different format: http://www.odata.org/documentation/uri-conventions#FormatSystemQueryOption</p>
<p>User can use following URL to change the return format to json instead of setting Accept header: http://localhost/api/Values?$format=json</p>
<p>However, QueryableAttribute in <a href="http://www.nuget.org/packages/Microsoft.AspNet.WebApi.OData">Web Api OData package</a> doesn't support $format.</p>
<p>ASP.NET Web Api provides such extensibility that you can change the default content negotiation by adding mappings to any part of the a request. So what we just need to do is to add following code to WebApiConfig.cs:</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">class</span> WebApiConfig </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum2"> 2:</span> { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum3"> 3:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> Register(HttpConfiguration config) </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum4"> 4:</span>     { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum5"> 5:</span>         config.Formatters.JsonFormatter.AddQueryStringMapping(<span style="color: #006080;">"$format"</span>, <span style="color: #006080;">"json"</span>, <span style="color: #006080;">"application/json"</span>); </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum6"> 6:</span>         config.Formatters.XmlFormatter.AddQueryStringMapping(<span style="color: #006080;">"$format"</span>, <span style="color: #006080;">"xml"</span>, <span style="color: #006080;">"application/xml"</span>); </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum7"> 7:</span>         config.Routes.MapHttpRoute( name: <span style="color: #006080;">"DefaultApi"</span>, routeTemplate: <span style="color: #006080;">"api/{controller}/{id}"</span>, </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum8"> 8:</span>             defaults: <span style="color: #0000ff;">new</span> { id = RouteParameter.Optional } ); </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum9"> 9:</span>     } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum10"> 10:</span> } </pre>
<!--CRLF--></div>
</div>
<p>In order to support QueryableAttribute together with $format, you also need to extend it to make it silent on unsupported query options. Following code do the trick:</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> ExtendedQueryableAttribute : QueryableAttribute </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum2"> 2:</span> { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum3"> 3:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">override</span> <span style="color: #0000ff;">void</span> ValidateQuery(System.Net.Http.HttpRequestMessage request) </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum4"> 4:</span>     { <span style="color: #008000;">// don't report error for unsupported query </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum5"> 5:</span>     } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum6"> 6:</span> } </pre>
<!--CRLF--></div>
</div>
<p>BTW, at current point, the ValidateQuery method is not virtual in public nuget pacakge. You can use it nighly build feed to install the nightly build: http://www.myget.org/F/aspnetwebstacknightly/</p>
<p><a href="http://code.msdn.microsoft.com/Support-format-in-ASPNET-e3785b2a">Download Sample Code</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Single Page Application with Backbone.js and ASP.NET Web API</title>
      <link>https://docs.microsoft.com/archive/blogs/hongyes/single-page-application-with-backbone-js-and-asp-net-web-api</link>
      <pubDate>Thu, 30 Aug 2012 13:58:00 GMT</pubDate>
      <dc:creator><![CDATA[Hongye Sun - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hongyes/2012/08/30/single-page-application-with-backbone-js-and-asp-net-web-api/</guid>
      <description><![CDATA[Spa is quite hot right now. There are many client choices. The reason why I chose backbone.js is...]]></description>
      <content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Single-page_application">Spa</a> is quite hot right now. There are many client choices. The reason why I chose backbone.js is because it supports connecting to a json web api. I am building an app on top of ASP.NET web api so I want to see how easy to make them work together.</p>
<p>I won't talk about too much about how backbone.js works. You can got to <a href="http://backbonejs.org/">http://backbonejs.org</a> for it's documentation and I find<a href="http://backbonetutorials.com/">http://backbonetutorials.com</a> is quite helpful to learn it.</p>
<p><a href="http://code.msdn.microsoft.com/Single-Page-Application-ddb08430">You can download the sample here</a></p>
<h4>Backbone.js Todo List Sample</h4>
<p>To make things easy. I directly copy the sample code from <a href="https://github.com/documentcloud/backbone/tree/master/examples/todos">backbone.js source</a>.</p>
<p>The sample is quite simple. It implements a todo list and save the data in browser local storage.</p>
<p>Let's first take a look of backbone.js model</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> <span style="color: #008000;">// Our basic **Todo** model has `title`, `order`, and `done` attributes. </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum2"> 2:</span> <span style="color: #0000ff;">var</span> Todo = Backbone.Model.extend({ </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum3"> 3:</span>     <span style="color: #008000;">// Default attributes for the todo item. </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum4"> 4:</span>     defaults: <span style="color: #0000ff;">function</span>() { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum5"> 5:</span>         <span style="color: #0000ff;">return</span> { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum6"> 6:</span>             title: <span style="color: #006080;">"empty todo..."</span>, </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum7"> 7:</span>             order: Todos.nextOrder(), </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum8"> 8:</span>             done: <span style="color: #0000ff;">false</span> }; </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum9"> 9:</span>     }, </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum10"> 10:</span> ... </pre>
<!--CRLF--></div>
</div>
<p>The model has three attributes: title, order and done. Each maps model property in C# world.</p>
<p>Backbone.js has a collection concept that represents a collection of model.</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> <span style="color: #008000;">// The collection of todos is backed by *localStorage* instead of a remote </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum2"> 2:</span> <span style="color: #008000;">// server. </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum3"> 3:</span> <span style="color: #0000ff;">var</span> TodoList = Backbone.Collection.extend({ </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum4"> 4:</span>     <span style="color: #008000;">// Reference to this collection's model. </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum5"> 5:</span>     model: Todo, </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum6"> 6:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum7"> 7:</span>     <span style="color: #008000;">// Save all of the todo items under the `"todos"` namespace. </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum8"> 8:</span>     localStorage: <span style="color: #0000ff;">new</span> Store(<span style="color: #006080;">"todos-backbone"</span>), </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum9"> 9:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum10"> 10:</span> ... </pre>
<!--CRLF--></div>
</div>
<p>The collection defines its model as Todo and assign a local storage which will save the data to browser's storage. As we are going to use web api,</p>
<h4>Create server model and web api</h4>
<p>Based on the model on in the backbone.js sample, I create a corresponding EF code first mode.</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> Todo </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum2"> 2:</span> { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum3"> 3:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> Id { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum4"> 4:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Title { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum5"> 5:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> Order { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum6"> 6:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">bool</span> Done { get; set; } </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum7"> 7:</span> } </pre>
<!--CRLF--></div>
</div>
<p>And create a EF scaffolding API controller based on the model. Simple? Yeah, it's done for the server side.</p>
<h4>Connect client to the server</h4>
<p>I just changed the localStorage line to the url to tell backbone to use a web api instead of browser storage.</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> <span style="color: #008000;">// The collection of todos is backed by *localStorage* instead of a remote </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum2"> 2:</span> <span style="color: #008000;">// server. </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum3"> 3:</span> var TodoList = Backbone.Collection.extend({ </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum4"> 4:</span>     <span style="color: #008000;">// Reference to this collection's model. </span></pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum5"> 5:</span>     model: Todo, </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum6"> 6:</span>     url: function () { <span style="color: #0000ff;">return</span> <span style="color: #006080;">'api/todos'</span>; },</pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum7"> 7:</span> ... </pre>
<!--CRLF--></div>
</div>
<p>You many notice that there is something different between server and client code: Model's property names are different by their first letter cases.</p>
<p>Web API uses JSON.NET to serialize and deserialize json. Fortunately, JSON.NET supports case insensitive deserialization by default. And it can support serialization as well by adding one line code in WebApiConfig.cs.</p>
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;" id="codeSnippetWrapper">
<div style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum1"> 1:</span> <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> Register(HttpConfiguration config) </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum2"> 2:</span> { </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum3"> 3:</span>     config.Formatters.JsonFormatter.SerializerSettings.ContractResolver </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum4"> 4:</span>         = <span style="color: #0000ff;">new</span> CamelCasePropertyNamesContractResolver(); </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum5"> 5:</span>     config.Routes.MapHttpRoute( name: <span style="color: #006080;">"DefaultApi"</span>, routeTemplate: <span style="color: #006080;">"api/{controller}/{id}"</span>, defaults: <span style="color: #0000ff;">new</span> { id = RouteParameter.Optional } ); </pre>
<!--CRLF-->
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #606060;" id="lnum6"> 6:</span> } </pre>
<!--CRLF--></div>
</div>
<p>The CamelCasePropertyNamesContractResolver will automatically convert property name to camel case, which is same as the attribute name on client side.</p>
<p>After this change, every thing works like a charm.</p>
<h4>Conclusion</h4>
<p>To implement a SPA with backbone.js and ASP.NET web api is quite easy. It's because they are all based on Restful convention. Backbone.js enforce a best practice to organize client code which looks very useful when the application grows. It also supports hashtag routing. I will give it a try in a more complicated application.</p>
<p><a href="http://code.msdn.microsoft.com/Single-Page-Application-ddb08430">You can download the sample here</a></p>
<pre><code></code></pre>]]></content:encoded>
    </item>
    <item>
      <title>Using Razor Template Engine in Web API Self Host Application</title>
      <link>https://docs.microsoft.com/archive/blogs/hongyes/using-razor-template-engine-in-web-api-self-host-application</link>
      <pubDate>Mon, 12 Mar 2012 00:46:16 GMT</pubDate>
      <dc:creator><![CDATA[Hongye Sun - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hongyes/2012/03/12/using-razor-template-engine-in-web-api-self-host-application/</guid>
      <description><![CDATA[[Update 8/15/2012] Update sample to Web API RTM packages  As Web API is released with ASP.NET MVC 4...]]></description>
      <content:encoded><![CDATA[<p>[Update 8/15/2012] Update sample to Web API RTM packages</p>  <p>As Web API is released with ASP.NET MVC 4 beta, it can be used in both web host and self host. You can view <a href="http://code.msdn.microsoft.com/ASPNET-Web-API-Self-Host-30abca12" target="_blank">a sample code for self host here</a>.</p>  <p>When writing self host app, you may probably want to use template engine to show web pages just like in Sinatra or Nancy. However, Web API doesn’t natively support it right now. You can use MVC but it depends on ASP.NET which can’t be self hosted.</p>  <p>This article is a tutorial on how to use latest <a href="http://razorengine.codeplex.com/" target="_blank">Razor Engine v3</a> within Web API self host app.</p>  <h2></h2>  <h2></h2>  <p><strong>Setup Web API Self Host Project</strong></p>  <p><a href="http://www.asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api" target="_blank">Follow the tutorial at here</a>.</p>  <p>Install Razor Engine v3 Nuget Package</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/30/10/metablogapi/6013.image_2AE1978E.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-30-10-metablogapi/6013.image_5F00_2AE1978E.png"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/30/10/metablogapi/8176.image_thumb_4780A412.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-30-10-metablogapi/8176.image_5F00_thumb_5F00_4780A412.png" width="644" height="434" /></a></p>  <p>&#160;</p>  <p>Add one more route to serve web page request</p>  <pre class="csharpcode">config.Routes.MapHttpRoute(
    <span class="str">&quot;API Default&quot;</span>, <span class="str">&quot;api/{controller}/{id}&quot;</span>,
    <span class="kwrd">new</span> { id = RouteParameter.Optional });

config.Routes.MapHttpRoute(
    <span class="str">&quot;Default&quot;</span>, <span class="str">&quot;{controller}/{action}&quot;</span>,
    <span class="kwrd">new</span> { controller = <span class="str">&quot;Home&quot;</span>, action = <span class="str">&quot;Index&quot;</span> }); </pre>

<p></p>

<p><strong>Inline Template</strong> </p>

<p>Add HomeController.cs to the project</p>

<pre class="csharpcode"><span class="kwrd">using</span> System.Net.Http;
<span class="kwrd">using</span> System.Web.Http;
<span class="kwrd">using</span> RazorEngine;

<span class="kwrd">namespace</span> SelfHost
{
    <span class="kwrd">public</span> <span class="kwrd">class</span> HomeController : ApiController
    {
        <span class="kwrd">public</span> HttpContent Index()
        {
            <span class="kwrd">string</span> template = <span class="str">&quot;Hello @Model.Name! Welcome to Web API and Razor!&quot;</span>;
            <span class="kwrd">string</span> result = Razor.Parse(template, <span class="kwrd">new</span> { Name = <span class="str">&quot;World&quot;</span> });

            <span class="kwrd">return</span> <span class="kwrd">new</span> StringContent(result, System.Text.Encoding.UTF8, <span class="str">&quot;text/html&quot;</span>);
        }
    }
}</pre>

<p>Web API doesn’t has a html media formatter right now, so I have to use HttpContent as return type to prevent it from using default JSON or XML formatter to format the return content.</p>

<p>Open browser and visit <a href="http://localhost:8080/">http://localhost:8080/</a>, it should show the content:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/30/10/metablogapi/2100.image_30552994.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-30-10-metablogapi/2100.image_5F00_30552994.png"><img style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/30/10/metablogapi/7080.image_thumb_16ED265A.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-30-10-metablogapi/7080.image_5F00_thumb_5F00_16ED265A.png" width="244" height="112" /></a></p>

<p>&#160;</p>

<p><strong>Rendering Template files (cshtml)</strong></p>

<p>Razor engine supports to inject resolver to resolve template name to template content. I will resolve template name to embedded resource content in this tutorial. You can resolve it from physical file like what MVC did as well.</p>

<p>Put following coding just next to the routing code</p>

<pre class="csharpcode"><span class="kwrd">string</span> viewPathTemplate = <span class="str">&quot;SelfHost.Views.{0}&quot;</span>;
TemplateServiceConfiguration templateConfig = <span class="kwrd">new</span> TemplateServiceConfiguration();
templateConfig.Resolver = <span class="kwrd">new</span> DelegateTemplateResolver(name =&gt;
{
    <span class="kwrd">string</span> resourcePath = <span class="kwrd">string</span>.Format(viewPathTemplate, name);
    var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourcePath);
    <span class="kwrd">using</span> (StreamReader reader = <span class="kwrd">new</span> StreamReader(stream))
    {
        <span class="kwrd">return</span> reader.ReadToEnd();
    }
});
Razor.SetTemplateService(<span class="kwrd">new</span> TemplateService(templateConfig));</pre>

<pre class="csharpcode">Next change the HomeController to use template file name to render</pre>

<pre class="csharpcode"><span class="kwrd">using</span> System.Net.Http;
<span class="kwrd">using</span> System.Web.Http;
<span class="kwrd">using</span> RazorEngine;
<span class="kwrd">using</span> RazorEngine.Templating;

<span class="kwrd">namespace</span> SelfHost
{
    <span class="kwrd">public</span> <span class="kwrd">class</span> HomeController : ApiController
    {
        <span class="kwrd">public</span> HttpContent Index()
        {
            var model = <span class="kwrd">new</span> { Name = <span class="str">&quot;World&quot;</span>, Email = <span class="str">&quot;someone@somewhere.com&quot;</span> };
            <span class="kwrd">string</span> result = Razor.Resolve(<span class="str">&quot;Index.cshtml&quot;</span>, model).Run(<span class="kwrd">new</span> ExecuteContext());
            <span class="kwrd">return</span> <span class="kwrd">new</span> StringContent(result, System.Text.Encoding.UTF8, <span class="str">&quot;text/html&quot;</span>);
        }
    }
}</pre>

<pre class="csharpcode">&#160;</pre>

<pre class="csharpcode">Add template file Index.cshtml to Views folder and set it as embedded resource</pre>

<pre class="csharpcode"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/30/10/metablogapi/4341.image_1276A593.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-30-10-metablogapi/4341.image_5F00_1276A593.png"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/30/10/metablogapi/6087.image_thumb_32257F5B.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-30-10-metablogapi/6087.image_5F00_thumb_5F00_32257F5B.png" width="278" height="484" /></a>
</pre>

<p>Copy the following content to the Index.cshtml file (Note: there is a known bug in Razor editor, which will hang when copying and pasting. Please open it by Html editor instead)</p>

<pre class="csharpcode"><span class="kwrd">&lt;!</span><span class="html">DOCTYPE</span> <span class="attr">HTML</span> <span class="attr">PUBLIC</span> <span class="kwrd">&quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">html</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">head</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">title</span><span class="kwrd">&gt;</span>Hello @Model.Name<span class="kwrd">&lt;/</span><span class="html">title</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">body</span><span class="kwrd">&gt;</span>
        Email: <span class="kwrd">&lt;</span><span class="html">input</span> <span class="attr">type</span><span class="kwrd">='text'</span> <span class="attr">value</span><span class="kwrd">='@Model.Email'</span><span class="kwrd">&gt;&lt;/</span><span class="html">input</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">body</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">html</span><span class="kwrd">&gt;</span></pre>

<p>&#160;</p>

<p>Run the application and it will show the content in browser.</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/30/10/metablogapi/0624.image_34CE3B0C.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-30-10-metablogapi/0624.image_5F00_34CE3B0C.png"><img style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/30/10/metablogapi/0647.image_thumb_0D93F1D7.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-30-10-metablogapi/0647.image_5F00_thumb_5F00_0D93F1D7.png" width="244" height="161" /></a></p>

<p>&#160;</p>

<p><strong>Support Layout page</strong></p>

<p>Since we already implemented the resolver, Razor will use it to resolve the Layout template as well. So the change will be very simple.</p>

<p>Add Layout.cshtml file to the Views folder and set it as embedded resource.</p>

<p>Copy the following content to the file:</p>

<pre class="csharpcode"><span class="kwrd">&lt;!</span><span class="html">DOCTYPE</span> <span class="attr">HTML</span> <span class="attr">PUBLIC</span> <span class="kwrd">&quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">html</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">head</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">title</span><span class="kwrd">&gt;</span>Hello @ViewBag.Title<span class="kwrd">&lt;/</span><span class="html">title</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">body</span><span class="kwrd">&gt;</span>
        @RenderBody()
    <span class="kwrd">&lt;/</span><span class="html">body</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">html</span><span class="kwrd">&gt;</span></pre>

<p></p>

<p>Replace Index.cshtml with following content:</p>

<pre class="csharpcode">@{
    _Layout = &quot;Layout&quot;;
    ViewBag.Title = @Model.Name;
}
Email: <span class="kwrd">&lt;</span><span class="html">input</span> <span class="attr">type</span><span class="kwrd">='text'</span> <span class="attr">value</span><span class="kwrd">='@Model.Email'</span><span class="kwrd">&gt;&lt;/</span><span class="html">input</span><span class="kwrd">&gt;</span></pre>

<p>&#160;</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/30/10/Samples/5468.SelfHost.zip" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-30-10-Samples/5468.SelfHost.zip">Download Sample Code</a></p>

<p>&#160;</p>

<p>Hongye Sun</p>]]></content:encoded>
    </item>
    <item>
      <title>AutoF5 1.3 Published: Support Dynamically Loading CSS files</title>
      <link>https://docs.microsoft.com/archive/blogs/hongyes/autof5-1-3-published-support-dynamically-loading-css-files</link>
      <pubDate>Fri, 04 Nov 2011 15:31:00 GMT</pubDate>
      <dc:creator><![CDATA[Hongye Sun - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hongyes/2011/11/04/autof5-1-3-published-support-dynamically-loading-css-files/</guid>
      <description><![CDATA[If you are first time here, please read my previous...]]></description>
      <content:encoded><![CDATA[<p>If you are first time here, please read my previous post:&nbsp;<a href="http://blogs.msdn.com/b/hongyes/archive/2011/11/03/introducing-to-autof5-nuget-package-live-editing-in-asp-net.aspx" title="Introducing to AutoF5 Nuget Package: Live Editing in ASP.NET" target="_blank">http://blogs.msdn.com/b/hongyes/archive/2011/11/03/introducing-to-autof5-nuget-package-live-editing-in-asp-net.aspx</a>&nbsp;</p>
<p>Thanks for&nbsp;Scott Galloway's suggestion.&nbsp;AutoF5 1.3 now supports to refresh CSS file dynamically by javascript instead of reloading the whole page.&nbsp;With this feature, It will be very convenient to develop and style Ajax UI.&nbsp;</p>
<p>In this update, I shamelessly copy the js snippet from&nbsp;<a href="http://snippets.dzone.com/posts/show/2069" title="Automatically reload stylesheets on HTML document" target="_blank">http://snippets.dzone.com/posts/show/2069</a>&nbsp;and fixed the regular expression issue in it. It will dynamically change the href of stylesheet links and append a random seed to avoid browser cache.</p>
<p>Here is the code snippet:</p>
<pre class="scroll"><code class="js"> function updateStylesheets() {<br /> var i, a, s;<br /> a = document.getElementsByTagName('link');<br /> for (i = 0; i &lt; a.length; i++) {<br /> s = a[i];<br /> if (s.rel.toLowerCase().indexOf('stylesheet') &gt;= 0 &amp;&amp; s.href) {<br /> var h = s.href.replace(/(&amp;|\?)forceReload=\d*/g, '');<br /> s.href = h + (h.indexOf('?') &gt;= 0 ? '&amp;' : '?') + 'forceReload=' + (new Date().valueOf());<br /> }<br /> }<br /> }</code></pre>
<p>To make it simple, I just reload all the stylesheets no matter it changed or not.</p>
<p>In the code behind, I changed the monitor handler for CSS file and tell the client to just reload all CSS files.</p>
<p>Some useless file monitors are also removed to avoid unintentional reload of page. Like cs, vb, config files are removed.</p>
<p>Nuget Package:&nbsp;<a href="http://nuget.org/List/Packages/AutoF5">http://nuget.org/List/Packages/AutoF5</a>.</p>
<p>Source:&nbsp;<a href="https://github.com/hongyes/AutoF5">https://github.com/hongyes/AutoF5</a>.</p>
<p></p>
<p>Please leave comments here if you find any issue of it. Thanks.</p>
<p></p>
<p></p>
<p></p>
<p></p>]]></content:encoded>
    </item>
    <item>
      <title>Introducing to AutoF5 Nuget Package: Live Editing in ASP.NET</title>
      <link>https://docs.microsoft.com/archive/blogs/hongyes/introducing-to-autof5-nuget-package-live-editing-in-asp-net</link>
      <pubDate>Wed, 02 Nov 2011 21:24:00 GMT</pubDate>
      <dc:creator><![CDATA[Hongye Sun - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hongyes/2011/11/02/introducing-to-autof5-nuget-package-live-editing-in-asp-net/</guid>
      <description><![CDATA[The problem:
It is always annoying to switch between Visual Studio and browser back and forth when...]]></description>
      <content:encoded><![CDATA[<h2><strong>The problem:</strong></h2>
<p>It is always annoying to switch between Visual Studio and browser back and forth when implementing a simple UI change. Especially editing an MVC project, there is no designer at all.</p>
<p>Imagine that you want to adjust the size of an image, you have to do this:</p>
<p>1. Edit in CSS file</p>
<p>2. Save</p>
<p>3. Switch to Browser</p>
<p>4. F5 or click refresh button to see the changes</p>
<p>Then if you are not satisfied with the adjustment. You have to go through step 1-4 again. This method is very inefficient.</p>
<p>Another method is to :</p>
<p>1. Use IE development tool / Firebug to adjust the CSS changes in browser until you are satisfied</p>
<p>2. Switch to Visual Studio and you should remember all the changes you have made and edit them in CSS file</p>
<p>3. Save</p>
<p>4. Switch back to browser</p>
<p>5. F5 or click refresh button to see the changes</p>
<p>This is better since you can view your changes immediately in browser, but it is still not good enough, because you have to remember all the changes and save them back to the CSS file.</p>
<p></p>
<h2><strong>The solution is AutoF5 nuget package</strong></h2>
<p>I came out this idea to use ajax long polling to dynamically refresh browser, whenever a save operation is detected.</p>
<p>To install AutoF5, you can simply type command in PM Console on your website project:</p>
<p><strong>PM&gt; Install-Package AutoF5</strong></p>
<p>After installation, you will immediately see your changes whenever you save the content file in Visual Studio.</p>
<p>You can view changes in IE, Firefox, Chrome at same time just by Ctrl+S. Here is a quick demo</p>
<p>[View:https://www.youtube.com/watch?v=jVjVbr8mjfo&amp;hd=1]</p>
<p>The package supports all popular browsers and all asp.net project templates. WebMatrix should also be supported.&nbsp;</p>
<p>Nuget Package:&nbsp;<a href="http://nuget.org/List/Packages/AutoF5">http://nuget.org/List/Packages/AutoF5</a>.</p>
<p>Source:&nbsp;<a href="https://github.com/hongyes/AutoF5">https://github.com/hongyes/AutoF5</a>.</p>
<p>Please let me know if you find any issue. Thanks.</p>
<p><a href="http://nuget.org/List/Packages/AutoF5"></a></p>
<p><a href="http://nuget.org/List/Packages/AutoF5"></a></p>
<p><a href="http://nuget.org/List/Packages/AutoF5"></a></p>
<p><a href="http://nuget.org/List/Packages/AutoF5"></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Enable TFS Trace</title>
      <link>https://docs.microsoft.com/archive/blogs/hongyes/enable-tfs-trace</link>
      <pubDate>Thu, 03 Dec 2009 19:27:00 GMT</pubDate>
      <dc:creator><![CDATA[Hongye Sun - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/hongyes/2009/12/03/enable-tfs-trace/</guid>
      <description><![CDATA[Enable Component&nbsp;Trace in TFS AT
How to: Use Web Services to Enable and Configure Trace for...]]></description>
      <content:encoded><![CDATA[<P><STRONG>Enable Component&nbsp;Trace in TFS AT</STRONG></P>
<P mce_keep="true"><A class="" href="http://blogs.msdn.com/controlpanel/blogs/How%20to:%20Use%20Web%20Services%20to%20Enable%20and%20Configure%20Trace%20for%20Team%20Foundation%20Server%20Components" target=_blank mce_href="http://blogs.msdn.com/controlpanel/blogs/How to: Use Web Services to Enable and Configure Trace for Team Foundation Server Components">How to: Use Web Services to Enable and Configure Trace for Team Foundation Server Components</A></P>
<P mce_keep="true"><STRONG>Enable Globally&nbsp;Trace in TFS AT</STRONG></P><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: 16px 'Times New Roman'; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><SPAN class=Apple-style-span style="FONT-SIZE: 13px; COLOR: rgb(51,51,51); LINE-HEIGHT: 16px; FONT-FAMILY: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; TEXT-ALIGN: left">
<DIV style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">1. Open web.config file in&nbsp;C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Web Services</DIV>
<DIV style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">2. Enable traceWriter to write to file:</DIV>
<DIV style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;add key="traceWriter" value="true"/&gt;</DIV>
<DIV style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial"><BR></DIV>
<DIV style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">3. Change the trace switches to</DIV>
<DIV style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">
<DIV style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BACKGROUND-COLOR: white; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial"><PRE style="BORDER-RIGHT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: 0px; PADDING-LEFT: 0px; FONT-SIZE: 1.25em; PADDING-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: 0px; PADDING-TOP: 0px; BORDER-BOTTOM: 0px; FONT-FAMILY: inherit; LIST-STYLE-TYPE: none; TEXT-DECORATION: none; outline-width: 0px; outline-style: initial; outline-color: initial">   <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: rgb(163,21,21); PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">system.diagnostics</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&gt;</SPAN>
        <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: rgb(163,21,21); PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">assert</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">assertuienabled</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">false</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">/&gt;</SPAN>
        <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: rgb(163,21,21); PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">trace</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">autoflush</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">false</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">indentsize</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">4</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">/&gt;</SPAN>
        <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: green; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;!--  Trace Switches
            Each of the trace switches should be set to a value between 0 and 4, inclusive.
              0: No trace output
              1-4: Increasing levels of trace output; see Systems.Diagnostics.TraceLevel
        --&gt;</SPAN>
        <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: rgb(163,21,21); PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">switches</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&gt;</SPAN>
            <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: rgb(163,21,21); PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">add</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">name</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">API</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">value</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">4</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">/&gt;</SPAN>
            <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: rgb(163,21,21); PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">add</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">name</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">Authentication</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">value</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">4</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">/&gt;</SPAN>
            <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: rgb(163,21,21); PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">add</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">name</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">Authorization</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">value</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">4</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">/&gt;</SPAN>
            <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: rgb(163,21,21); PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">add</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">name</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">Database</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">value</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">4</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">/&gt;</SPAN>
            <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: rgb(163,21,21); PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">add</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">name</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">General</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">value</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">4</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">/&gt;</SPAN>
            <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: green; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;!-- WorkItem trace switches --&gt;</SPAN>
            <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: rgb(163,21,21); PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">add</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">name</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">traceLevel</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">value</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">4</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN> <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">/&gt;</SPAN></PRE><PRE style="BORDER-RIGHT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: 0px; PADDING-LEFT: 0px; FONT-SIZE: 1.25em; PADDING-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: 0px; PADDING-TOP: 0px; BORDER-BOTTOM: 0px; FONT-FAMILY: inherit; LIST-STYLE-TYPE: none; TEXT-DECORATION: none; outline-width: 0px; outline-style: initial; outline-color: initial"><FONT color=#0000ff>            <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: green; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;!-- Test Tools trace switches --&gt;</SPAN></FONT></PRE><PRE style="BORDER-RIGHT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: 0px; PADDING-LEFT: 0px; FONT-SIZE: 1.25em; PADDING-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: 0px; PADDING-TOP: 0px; BORDER-BOTTOM: 0px; FONT-FAMILY: inherit; LIST-STYLE-TYPE: none; TEXT-DECORATION: none; outline-width: 0px; outline-style: initial; outline-color: initial"><FONT color=#0000ff><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: green; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial"><FONT color=#000000>            </FONT><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: rgb(163,21,21); PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">add</SPAN><FONT color=#000000> </FONT><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">name</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">EqtTraceLevel</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><FONT color=#000000> </FONT><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: red; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">value</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">=</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">4</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">"</SPAN><FONT color=#000000> </FONT><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">/&gt;</SPAN></SPAN></FONT></PRE><PRE style="BORDER-RIGHT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: 0px; PADDING-LEFT: 0px; FONT-SIZE: 1.25em; PADDING-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: 0px; PADDING-TOP: 0px; BORDER-BOTTOM: 0px; FONT-FAMILY: inherit; LIST-STYLE-TYPE: none; TEXT-DECORATION: none; outline-width: 0px; outline-style: initial; outline-color: initial"><FONT color=#0000ff><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: green; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial"></SPAN></FONT>        <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;/</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: rgb(163,21,21); PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">switches</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&gt;</SPAN>        
    <SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&lt;/</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: rgb(163,21,21); PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">system.diagnostics</SPAN><SPAN style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px; FONT-FAMILY: inherit; BORDER-RIGHT-WIDTH: 0px; outline-width: 0px; outline-style: initial; outline-color: initial">&gt;</SPAN></PRE></DIV></DIV></SPAN></SPAN>
<P mce_keep="true"><STRONG>Enable TSWA Trace</STRONG></P>
<P mce_keep="true">Uncomment the system.diagnostics section in the TSWA's web.config file.</P>
<P mce_keep="true">
<TABLE class=code class="code">
<TBODY>
<TR>
<TD class="" id=codeview>&nbsp;</TD>
<TD class=code class="code">
<DIV id=preview>
<DIV style="COLOR: black; BACKGROUND-COLOR: white"><PRE>  <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">system.diagnostics</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
    <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">trace</SPAN> <SPAN style="COLOR: red">autoflush</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">true</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">listeners</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
        <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">add</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">TeamPlainTracer</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: red">type</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">System.Diagnostics.TextWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</SPAN><SPAN style="COLOR: black">"</SPAN>
          <SPAN style="COLOR: red">initializeData</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">(Log Folder Path)\TswaLog.txt</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: blue">/&gt;</SPAN>
        <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">remove</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">Default</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">/&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">listeners</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
    <SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">trace</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>


    <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">switches</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">add</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">TSWA.General</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">Verbose</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">/&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">add</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">TSWA.Application</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">Verbose</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">/&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">add</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">TSWA.TeamFoundationServer</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">Verbose</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">/&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">add</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">TSWA.UserControl</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">Verbose</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">/&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">add</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">TSWA.Configuration</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">Verbose</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">/&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">add</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">TSWA.Security</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">Verbose</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">/&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">add</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">TSWA.API</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">Verbose</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">/&gt;</SPAN>
    <SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">switches</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
  <SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">system.diagnostics</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
</PRE></DIV></DIV></TD></TR></TBODY></TABLE></P>
<P mce_keep="true"><STRONG>Enable TFS Client Logging</STRONG></P>
<P mce_keep="true"><A href="http://blogs.msdn.com/edhintz/archive/2007/03/30/tfs-client-tracing.aspx">http://blogs.msdn.com/edhintz/archive/2007/03/30/tfs-client-tracing.aspx</A></P>
<P mce_keep="true"><STRONG></STRONG>&nbsp;</P>
<P mce_keep="true"><STRONG>Enable TFS Build Service Logging</STRONG></P>
<P mce_keep="true">Uncomment the system.diagnostics section in the tfsbuildservice.exe.config, which is located at &lt;VS Installation Folder&gt;/Common7/IDE/PrivateAssemblies/.</P>
<P mce_keep="true">&nbsp;</P><PRE>  <SPAN style="COLOR: green">&lt;!-- Trace settings.
       Uncomment the system.diagnostics section below to get a trace log for the
       Team Build Service. Ensure that the C:\logs directory exists and is
       writeable by the Build Service user. 

       The following trace categories are provided for Team Foundation:
	    - API: Covers method usage, service to web service calls (from the caller's
	        perspective), public methods.
	    - Authorization: Covers authorization related components
	    - Authentication: Covers authentication components
	    - Database: Covers database interaction of the component
	    - General: Covers cases that do not fit the above categories.
        
      Trace Switches
	    Each of the trace switches should be set to a value between 0 and 4, inclusive.
	        0:No trace output
	      1-4:Increasing levels of trace output; see Systems.Diagnostics.TraceLevel
  --&gt;</SPAN>

  <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">system.diagnostics</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>      
    <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">switches</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">add</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">API</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">4</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: blue">/&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">add</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">Authentication</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">4</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: blue">/&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">add</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">Database</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">4</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: blue">/&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">add</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">General</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">4</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: blue">/&gt;</SPAN>
    <SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">switches</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
    <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">trace</SPAN> <SPAN style="COLOR: red">autoflush</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">true</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: red">indentsize</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">4</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">listeners</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
        <SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">add</SPAN> <SPAN style="COLOR: red">name</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">myListener</SPAN><SPAN style="COLOR: black">"</SPAN>
            <SPAN style="COLOR: red">type</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">System.Diagnostics.TextWriterTraceListener</SPAN><SPAN style="COLOR: black">"</SPAN>
            <SPAN style="COLOR: red">initializeData</SPAN><SPAN style="COLOR: blue">=</SPAN><SPAN style="COLOR: black">"</SPAN><SPAN style="COLOR: blue">C:\logs\buildmachine.log</SPAN><SPAN style="COLOR: black">"</SPAN> <SPAN style="COLOR: blue">/&gt;</SPAN>
      <SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">listeners</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
    <SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">trace</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
  <SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">system.diagnostics</SPAN><SPAN style="COLOR: blue">&gt;</SPAN>
</PRE>]]></content:encoded>
    </item>
  </channel>
</rss>