<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-33814941</id><updated>2012-01-25T20:05:00.683-08:00</updated><category term='C#'/><category term='LINQ'/><category term='Xml'/><category term='FubuMVC'/><category term='SQL Reporting'/><title type='text'>Gary L Cox Jr</title><subtitle type='html'>A peek into my life as a Catholic developer</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>41</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-33814941.post-908355654939162406</id><published>2012-01-25T19:40:00.001-08:00</published><updated>2012-01-25T20:05:00.693-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FubuMVC'/><title type='text'>FubuMVC Conventional Design List View</title><content type='html'>&lt;p&gt;Coming from Asp.Net MVC I was so used to the structure expected, for example all controllers had to end in “Controller” and your controllers were separate from the Views etc.&amp;#160; Nothing wrong with this design, but coming into Fubu and having so much freedom to place files how ever you want them was a bit daunting at first.&amp;#160; What I want to cover over my next blog posts are the following conventional ways FubuMVC makes structuring your project easier, and how it does a lot of the heavy work for you out of the box.&amp;#160; This post assumes you have something similar to the &lt;a href="http://garylcoxjr.blogspot.com/2012/01/getting-started-with-fubumvc.html"&gt;configuration as this&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160; 1) Conventional List Views (this post)    &lt;br /&gt;&amp;#160; 2) Conventional Create Views     &lt;br /&gt;&amp;#160; 3) Conventional Edit Views     &lt;br /&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;I chose these as they are the most commonly structured tree within a web application.&amp;#160; So this looks something like:&lt;/p&gt;  &lt;p&gt;root    &lt;br /&gt;&amp;#160;&amp;#160; - EntityFolder     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - List.spark     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - Edit.spark     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - Create.spark (or New.spark)&lt;/p&gt;  &lt;p&gt;This is pretty common so it makes sense to target the 80% audience and hopefully someone gets something out of this.&amp;#160; To start off I’m assuming you use the following structure and that your entities use an interface like so:&lt;/p&gt;  &lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;interface&lt;/span&gt; IEntity&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; Id { &lt;span style="color: #0000ff"&gt;get&lt;/span&gt;; &lt;span style="color: #0000ff"&gt;set&lt;/span&gt;; }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Note: Id can be int or Guid, doesn’t matter&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now going back to my Asp.Net experience, wanting a list view to render, the most common style was creating a Controller and then an ActionResult method named Index.&amp;#160; I could do this same thing in Fubu, however if my style of entity design is always going to be Create, Edit, and List then why not let Fubu perform this task for me conventionally.&amp;#160; To get started we will need to build up our convention, lets add a class and call it ListEntity&amp;lt;T&amp;gt; so that it accepts any of our entity classes.&amp;#160; This guy will be responsible for getting a collection of our objects and returning them.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ListEntity&amp;lt;TEntity, TList&amp;gt; &lt;/p&gt;&lt;p&gt;             where TEntity: &lt;span style="color: #0000ff"&gt;class&lt;/span&gt;, IEntity&lt;/p&gt;&lt;p&gt;             where TList : IEntityList&amp;lt;TEntity&amp;gt;, new()	  	&lt;br /&gt;&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;readonly&lt;/span&gt; IRepository _repository;  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ListEntity(IRepository repository)  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;          _repository = repository;	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    } &lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; TList&amp;lt;T&amp;gt; Get(EntityList&amp;lt;TEntity&amp;gt; items)  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;       &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; TList&amp;lt;T&amp;gt;() {Items = _repository.All&amp;lt;TEntity&amp;gt;()};&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now lets create our Model that we will use to bind our list&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; EntityList&amp;lt;T&amp;gt; : IEntityList&amp;lt;T&amp;gt; where T : IEntity	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; IEnumerable&amp;lt;T&amp;gt; Items { &lt;span style="color: #0000ff"&gt;get&lt;/span&gt;; &lt;span style="color: #0000ff"&gt;set&lt;/span&gt;; } 	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;You see I’m using an IEntityList, that is nothing more than an interface requiring an IEnumerable&amp;lt;T&amp;gt; Items.&amp;#160; Now what we have here is the conventional piece that will be responsible for delivering EntityList&amp;lt;T&amp;gt; to our Model.&amp;#160; We need a class that takes in IActionSource and will be responsible for ensuring our convention is triggered which will call our ListEntity Get method.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ListEntityActionSource : IActionSource  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;readonly&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; MethodName = ReflectionHelper.GetMethod&amp;lt;ListEntity&amp;lt;IEntity, EntityList&amp;lt;IEntity&amp;gt;&amp;gt;&amp;gt;(a =&amp;gt; a.Get(&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)).Name;	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; MethodInfo GetExecuteMethod(Type action)  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     {  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; action.GetMethod(MethodName);	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; IEnumerable&amp;lt;ActionCall&amp;gt; FindActions(TypePool types)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; types.TypesMatching(type =&amp;gt; type.IsConcreteTypeOf&amp;lt;IEntity&amp;gt;())&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  	.Select(t =&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  	 {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  	     var action = &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(ListEntity&amp;lt;,&amp;gt;).MakeGenericType(t, getListType(t);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  	     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ActionCall(action, GetExecuteMethod(action));&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  	  });&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;     }&lt;/p&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;     &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; Type getListType(Type entity)&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return _container&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .Model&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .DefaultTypeFor(typeof(IEntityList&amp;lt;&amp;gt;).MakeGenericType(entity));&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;And now we need to generate a way to register this with fubu as well as set our route up&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ListEntityEndpoints : IFubuRegistryExtension	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; ToRoutePattern(Type entityType)  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     {	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &amp;quot;&lt;span style="color: #8b0000"&gt;{0}/list&lt;/span&gt;&amp;quot;.ToFormat(entityType.Name.ToLower());	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     }	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Configure(FubuRegistry registry)	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     {	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;         registry.Actions.FindWith(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ListEntityActionSource());	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;         registry.ApplyConvention(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; LambdaConfigurationAction(graph =&amp;gt; graph.Actions().Where(x =&amp;gt; x.HandlerType.Closes(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(ListEntity&amp;lt;,&amp;gt;))).Each(ModifyChain)));	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     }	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ModifyChain(ActionCall action)	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     {	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;         var chain = action.ParentChain();  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;         var pattern = ToRoutePattern(action.HandlerType.GetGenericArguments()[0]);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;         chain.Route = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; RouteDefinition(pattern);	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;         chain.Route.AddHttpMethodConstraint(action.Method.Name.ToUpper());	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     }	  	&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Then to register your ListEntityEndpoints, simply import it into your FubuRegistry like so:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; MyFubuRegistry : FubuRegistry&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    ... &lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    Import&amp;lt;ListEntityEndpoints&amp;gt;();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    ...&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;And now we add into our Registry a section informing Structuremap how to use our IEntityList types, since we are using a generic we have to implement a closing type otherwise spark may have issues:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; WebRegistry : Registry&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; WebRegistry()&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        Scan(x =&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                 {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                     x.TheCallingAssembly();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                     x.WithDefaultConventions();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                     x.ConnectImplementationsToTypesClosing(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt; (IEntityList&amp;lt;&amp;gt;));&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                 });&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This is so awesome how this works, now that I have configured my convention, all I have to do from now on for all my entities that I want a list view is to use IEntityList&amp;lt;T&amp;gt; or I can create a model that inherits EntityList&amp;lt;MyEntityClass&amp;gt; (EntityList inherits IEntityList) for the model of my spark view and voilà! This works for your simplest case.&amp;#160; If you need additional behaviors for your list, this of course would need additional behaviors added.&amp;#160; But for the most part, if you need a view that renders a basic list of data then this covers your common list scenarios.&amp;#160; Fubu will wire this up automatically and you now have a list view, you do not require another Endpoint (Or Controller for Asp.Net MVC guys) from here on out.&amp;#160; Keep in mind this adds a List to all of your IEntity types (person/list, address/list, etc), the only difference is only entities that are wired up to a View will actually be chained to a View endpoint.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I tried pulling parts out of my codebase and we all know its difficult to get what is needed for a blog post only and exclude the rest of the sections, so if you have some issues getting started with this don’t hesitate to contact me gary.l.coxjr AT gmail.com&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Happy Coding!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-908355654939162406?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/908355654939162406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=908355654939162406' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/908355654939162406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/908355654939162406'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2012/01/fubumvc-conventional-design-list-view.html' title='FubuMVC Conventional Design List View'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-7248865314453949342</id><published>2012-01-23T20:01:00.000-08:00</published><updated>2012-01-23T20:21:36.264-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FubuMVC'/><title type='text'>Getting Started with FubuMVC</title><content type='html'>&lt;p&gt;With FubuMVC getting closer and closer to version 1.0, more and more developers are adopting it for its conventional design and the ability to control all aspects of its behavior.&amp;#160; I started using FubuMVC 4 months ago and ran into many road blocks as there wasn’t (And currently as of this post “isn’t”) very much documentation on how to get started and what you can do.&amp;#160; I would like to spend the next few weeks writing up posts on how to first get Fubu up and running, then how to use its conventional power and the underlying magic within.&amp;#160; I say magic because it is what it is, the framework is simply brilliant and I want to demonstrate it’s power little by little over each post.&amp;#160; There are currently two ways you can configure FubuMVC for a new project, one would be to download the Nuget package “FubuMVC”&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-7JxU8NZI_Z8/Tx4rZqIOKsI/AAAAAAAAA5c/_oVu4hiAT_U/s1600-h/image14.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-5Ud2BWlEOjs/Tx4raFEfX0I/AAAAAAAAA5k/Wn6bwScIjWs/image_thumb8.png?imgmax=800" width="468" height="340" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This is basically the Starter package which will load all the references and get FubuMVC configured and Setup for you.&amp;#160; Im not going to cover that route as it’s pretty straight forward and easy for anyone to get started.&amp;#160; What I want to demonstrate is the manual approach to configuring FubuMVC.&amp;#160; For me its always better to get your hands dirty and really learn how to use your tools and what they truly do under the hood.&amp;#160; So lets begin.&lt;/p&gt;  &lt;p&gt;Create a new ASP.NET Web project (Empty).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-P0ZTC0fVV5k/Tx4raZ5y2UI/AAAAAAAAA5s/1JpnsNWnN-s/s1600-h/image13.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-ANM9K5Yk4yI/Tx4ra4UU3cI/AAAAAAAAA50/ghZSzd89jJk/image_thumb7.png?imgmax=800" width="463" height="333" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Next, right click on your references and select Manage NuGet packages, you should get the same screen as the NuGet image above.&amp;#160; Type in FubuMVC in the search and choose FubuMVC.References and FubuMVC.Spark.&amp;#160; This will load all the required references you need to get Fubu up and running.&amp;#160; Lets assume I created my project as MyFubu.&amp;#160; First step we need is to get Fubu bootstrapped and registered.&amp;#160; Create a class in your web project, for me I might call it MyFubuApplication keeping it named after my project.&lt;/p&gt;    &lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; MyFubuApplication : IApplicationSource&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; FubuApplication BuildApplication()&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; FubuApplication&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            .For&amp;lt;MyFubuRegistry&amp;gt;()&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            .StructureMap(WebBootstrapper.BuildContainer);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now we need to create our registry class and our web bootstrap class. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; MyFubuRegistry : FubuRegistry&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; MyFubuRegistry()&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        IncludeDiagnostics(&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        Applies&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            .ToThisAssembly();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        Actions&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            .IncludeTypesNamed(name =&amp;gt; name.ToLower().EndsWith(&amp;quot;&lt;span style="color: #8b0000"&gt;endpoint&lt;/span&gt;&amp;quot;));&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        Routes&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            .HomeIs&amp;lt;MyHomeEndpoint&amp;gt;(e =&amp;gt; e.Index(&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;))&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            .IgnoreControllerNamesEntirely();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        Views&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            .TryToAttachWithDefaultConventions();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.UseSpark();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;and for our bootstrap class, this is where you educate Structuremap on where your Registry classes are:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; WebBootstrapper&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; IContainer BuildContainer()&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        ObjectFactory.Initialize(x =&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            x.AddRegistry&amp;lt;WebRegistry&amp;gt;();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        });&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; ObjectFactory.Container;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; WebRegistry : Registry&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; WebRegistry()&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        Scan(x =&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            x.TheCallingAssembly();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            x.WithDefaultConventions();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        });&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;As you can see in the FubuRegistry I set the route of HomeIs&amp;lt;MyHomeEndpoint&amp;gt;, what this is telling fubu is when the site loads to direct the user to the default landing page which is in MyHomeEndpoint.Index.&amp;#160; That class would look something like this:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; MyHomeEndpoint&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; HomeViewModel Index(HomeViewModel input)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; input;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; HomeViewModel&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; HelloWorld&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;get&lt;/span&gt; { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &amp;quot;&lt;span style="color: #8b0000"&gt;Hello World&lt;/span&gt;&amp;quot;;}&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now all I would need is a spark file that uses my HomeViewModel as its model and FubuMVC will build a route to this view which would look something like MyHomeEndpoint/Index. Now this looks a bit tacky having the word endpoint in your url. Not a problem, Fubu allows you to control the way your routes display. To override the way FubuMVC creates your routes simply create a class that inherits IUrlPolicy, something like the following:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; EndpointUrlPolicy : IUrlPolicy&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; Matches(ActionCall call)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; call.HandlerType.Name.EndsWith(&amp;quot;&lt;span style="color: #8b0000"&gt;Endpoint&lt;/span&gt;&amp;quot;);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; IRouteDefinition Build(ActionCall call)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        var routeDefinition = call.ToRouteDefinition();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        routeDefinition.Append(call.HandlerType.Namespace.Replace(GetType().Namespace + &amp;quot;&lt;span style="color: #8b0000"&gt;.&lt;/span&gt;&amp;quot;, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Empty).ToLower());&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        routeDefinition.Append(call.HandlerType.Name.Replace(&amp;quot;&lt;span style="color: #8b0000"&gt;Endpoint&lt;/span&gt;&amp;quot;, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Empty).ToLower());&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; routeDefinition;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;And register this in your FubuRegistry class&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;Routes.UrlPolicy&amp;lt;EndpointUrlPolicy&amp;gt;();&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;And that’s it, your new route policy is in effect and now our url is rendered as /MyHome/Index.&amp;#160; Further customization could be performed to remove the Index as well if desired.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This covers the setting up of FubuMVC portion, to make sure your routes are wired up correctly, run your application and go to localhost:YOURPORT/_fubu to see the advanced diagnostics.&amp;#160; Click on the Behavior Chains link and check that your routes (Mine would be MyHome/Index) are present.&amp;#160; You can also click on the Behavior chain link next to the route to see how Fubu wired it up.&amp;#160; The Advanced Diagnostics will quickly become your closest friend when working with Fubu as it informs you of any chains that are not correctly routed and helps you understand why they are not working as you desired them too.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This about sums it up for getting started, go check out FubuMVC for yourself and see what you think about it.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://mvc.fubu-project.org/"&gt;The FubuMVC Project&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Happy Coding!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-7248865314453949342?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/7248865314453949342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=7248865314453949342' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/7248865314453949342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/7248865314453949342'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2012/01/getting-started-with-fubumvc.html' title='Getting Started with FubuMVC'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/-5Ud2BWlEOjs/Tx4raFEfX0I/AAAAAAAAA5k/Wn6bwScIjWs/s72-c/image_thumb8.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-767712350066474311</id><published>2010-05-29T10:41:00.001-07:00</published><updated>2010-05-29T11:20:29.147-07:00</updated><title type='text'>Using Sql to generate C# properties</title><content type='html'>&lt;p&gt;I am working on a project which entails myself and another developer &lt;a href="http://www.woodcp.com/" target="_blank"&gt;Todd Wood&lt;/a&gt; to build our business objects with properties (a small piece of the project) matching the Oracle table column names.&amp;#160; Surely this is not hard to accomplish however, very tedious considering the table/column count.&amp;#160; My first thoughts were to use &lt;a href="http://www.devexpress.com/Products/Visual_Studio_Add-in/CodeRushX/" target="_blank"&gt;CodeRush&lt;/a&gt; to generate the properties faster than hand typing each of them.&amp;#160; However, Todd in all his brilliance decided to take another approach.&amp;#160; Instead he wrote a set of queries which will read the table's metadata and generate the properties for us.&amp;#160; Not only does it generate the properties, it takes nullable into consideration and generates nullable types as well.&amp;#160; Another item he took into account was we needed to read the data into the properties at some point, so naturally he wrote a script to generate the reader code for us as well.     &lt;br /&gt;As Genius Beer makers would say, Brilliant, just Brilliant!     &lt;br /&gt;So how did he do this? lets take a look at the Sql:&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;-- Data Reader populate&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;select&lt;/span&gt; replace(initcap(column_name), &lt;span class="str"&gt;'_'&lt;/span&gt;) || &lt;span class="str"&gt;' = '&lt;/span&gt; || decode(data_type, &lt;span class="str"&gt;'NUMBER'&lt;/span&gt;, &lt;span class="str"&gt;'Convert.ToInt32(reader[&amp;quot;'&lt;/span&gt; || column_name || &lt;span class="str"&gt;'&amp;quot;]),'&lt;/span&gt;, &lt;span class="str"&gt;'DATE'&lt;/span&gt;, &lt;span class="str"&gt;'(!reader.IsDBNull('&lt;/span&gt; || to_char(column_id - 1) || &lt;span class="str"&gt;')) ? Convert.ToDateTime(reader[&amp;quot;'&lt;/span&gt; || column_name || &lt;span class="str"&gt;'&amp;quot;]) : (DateTime?)null,'&lt;/span&gt;, &lt;span class="str"&gt;'VARCHAR2'&lt;/span&gt;, &lt;span class="str"&gt;'reader[&amp;quot;'&lt;/span&gt; || column_name || &lt;span class="str"&gt;'&amp;quot;] as String,'&lt;/span&gt;, &lt;span class="str"&gt;'CHAR'&lt;/span&gt;, &lt;span class="str"&gt;'Convert.ToChar(reader[&amp;quot;'&lt;/span&gt; || column_name || &lt;span class="str"&gt;'&amp;quot;]),'&lt;/span&gt; )&lt;br /&gt;&lt;span class="kwrd"&gt;from&lt;/span&gt; user_tab_columns&lt;br /&gt;&lt;span class="kwrd"&gt;where&lt;/span&gt; table_name = &lt;span class="str"&gt;'{Your Table Name}'&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;order&lt;/span&gt; &lt;span class="kwrd"&gt;by&lt;/span&gt; column_id&lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;  &lt;br /&gt;-- Get / Set &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;select &lt;span class="str"&gt;'public '&lt;/span&gt; || decode(data_type, &lt;span class="str"&gt;'NUMBER'&lt;/span&gt;, &lt;span class="str"&gt;'int'&lt;/span&gt;|| decode(nullable, &lt;span class="str"&gt;'Y'&lt;/span&gt;,&lt;span class="str"&gt;'?'&lt;/span&gt;) , &lt;span class="str"&gt;'DATE'&lt;/span&gt;, &lt;span class="str"&gt;'DateTime'&lt;/span&gt;|| decode(nullable, &lt;span class="str"&gt;'Y'&lt;/span&gt;,&lt;span class="str"&gt;'?'&lt;/span&gt;) , &lt;span class="str"&gt;'VARCHAR2'&lt;/span&gt;, &lt;span class="str"&gt;'string'&lt;/span&gt;, &lt;span class="str"&gt;'CHAR'&lt;/span&gt;, &lt;span class="str"&gt;'char'&lt;/span&gt;|| decode(nullable, &lt;span class="str"&gt;'Y'&lt;/span&gt;,&lt;span class="str"&gt;'?'&lt;/span&gt;) ) || &lt;span class="str"&gt;' '&lt;/span&gt; || replace(initcap(column_name), &lt;span class="str"&gt;'_'&lt;/span&gt;) || &lt;span class="str"&gt;' { get; set; }'&lt;/span&gt;&lt;br /&gt;from user_tab_columns&lt;br /&gt;&lt;span class="kwrd"&gt;where&lt;/span&gt; table_name = &lt;span class="str"&gt;'{Your Table Name}'&lt;/span&gt;&lt;br /&gt;order by column_id;&lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now keep in mind this was designed to run against an Oracle database, however it can be converted to your DB of choice with some tweaks here and there (Don't quote me on this as I am no DBA by any means ;), but &amp;quot;It should probably work&amp;quot;).&amp;#160; &lt;br /&gt;So what happens when this is run against the DB? &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;When you run the Reader script your output will look something like this when run against the USER_TAB_COLUMNS table in Oracle:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;TableName = reader[&lt;span class="str"&gt;&amp;quot;TABLE_NAME&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; String,&lt;br /&gt;ColumnName = reader[&lt;span class="str"&gt;&amp;quot;COLUMN_NAME&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; String,&lt;br /&gt;DataType = reader[&lt;span class="str"&gt;&amp;quot;DATA_TYPE&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; String,&lt;br /&gt;DataTypeMod = reader[&lt;span class="str"&gt;&amp;quot;DATA_TYPE_MOD&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; String,&lt;br /&gt;DataTypeOwner = reader[&lt;span class="str"&gt;&amp;quot;DATA_TYPE_OWNER&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; String,&lt;br /&gt;DataLength = Convert.ToInt32(reader[&lt;span class="str"&gt;&amp;quot;DATA_LENGTH&amp;quot;&lt;/span&gt;]),&lt;br /&gt;DataPrecision = Convert.ToInt32(reader[&lt;span class="str"&gt;&amp;quot;DATA_PRECISION&amp;quot;&lt;/span&gt;]),&lt;br /&gt;DataScale = Convert.ToInt32(reader[&lt;span class="str"&gt;&amp;quot;DATA_SCALE&amp;quot;&lt;/span&gt;]),&lt;br /&gt;Nullable = reader[&lt;span class="str"&gt;&amp;quot;NULLABLE&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; String,&lt;br /&gt;ColumnId = Convert.ToInt32(reader[&lt;span class="str"&gt;&amp;quot;COLUMN_ID&amp;quot;&lt;/span&gt;]),&lt;br /&gt;DefaultLength = Convert.ToInt32(reader[&lt;span class="str"&gt;&amp;quot;DEFAULT_LENGTH&amp;quot;&lt;/span&gt;]),&lt;br /&gt;NumDistinct = Convert.ToInt32(reader[&lt;span class="str"&gt;&amp;quot;NUM_DISTINCT&amp;quot;&lt;/span&gt;]),&lt;br /&gt;Density = Convert.ToInt32(reader[&lt;span class="str"&gt;&amp;quot;DENSITY&amp;quot;&lt;/span&gt;]),&lt;br /&gt;NumNulls = Convert.ToInt32(reader[&lt;span class="str"&gt;&amp;quot;NUM_NULLS&amp;quot;&lt;/span&gt;]),&lt;br /&gt;NumBuckets = Convert.ToInt32(reader[&lt;span class="str"&gt;&amp;quot;NUM_BUCKETS&amp;quot;&lt;/span&gt;]),&lt;br /&gt;LastAnalyzed = (!reader.IsDBNull(18)) ? Convert.ToDateTime(reader[&lt;span class="str"&gt;&amp;quot;LAST_ANALYZED&amp;quot;&lt;/span&gt;]) : (DateTime?)&lt;span class="kwrd"&gt;null&lt;/span&gt;,&lt;br /&gt;SampleSize = Convert.ToInt32(reader[&lt;span class="str"&gt;&amp;quot;SAMPLE_SIZE&amp;quot;&lt;/span&gt;]),&lt;br /&gt;CharacterSetName = reader[&lt;span class="str"&gt;&amp;quot;CHARACTER_SET_NAME&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; String,&lt;br /&gt;CharColDeclLength = Convert.ToInt32(reader[&lt;span class="str"&gt;&amp;quot;CHAR_COL_DECL_LENGTH&amp;quot;&lt;/span&gt;]),&lt;br /&gt;GlobalStats = reader[&lt;span class="str"&gt;&amp;quot;GLOBAL_STATS&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; String,&lt;br /&gt;UserStats = reader[&lt;span class="str"&gt;&amp;quot;USER_STATS&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; String,&lt;br /&gt;AvgColLen = Convert.ToInt32(reader[&lt;span class="str"&gt;&amp;quot;AVG_COL_LEN&amp;quot;&lt;/span&gt;]),&lt;br /&gt;CharLength = Convert.ToInt32(reader[&lt;span class="str"&gt;&amp;quot;CHAR_LENGTH&amp;quot;&lt;/span&gt;]),&lt;br /&gt;CharUsed = reader[&lt;span class="str"&gt;&amp;quot;CHAR_USED&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; String,&lt;br /&gt;V80FmtImage = reader[&lt;span class="str"&gt;&amp;quot;V80_FMT_IMAGE&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; String,&lt;br /&gt;DataUpgraded = reader[&lt;span class="str"&gt;&amp;quot;DATA_UPGRADED&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; String,&lt;br /&gt;Histogram = reader[&lt;span class="str"&gt;&amp;quot;HISTOGRAM&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; String,&lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Notice how the script writes C# code for you ready to be put to work.&amp;#160; Take a look at LastAnalyzed, its smart enough to handle the tertiary code as well! Now let's see what the property script will output for the same table: &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; TableName { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ColumnName { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; DataType { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; DataTypeMod { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; DataTypeOwner { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; DataLength { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;? DataPrecision { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;? DataScale { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Nullable { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;? ColumnId { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;? DefaultLength { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt;  DataDefault { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;? NumDistinct { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt;  LowValue { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt;  HighValue { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;? Density { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;? NumNulls { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;? NumBuckets { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; DateTime? LastAnalyzed { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;? SampleSize { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; CharacterSetName { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;? CharColDeclLength { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; GlobalStats { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; UserStats { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;? AvgColLen { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;? CharLength { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; CharUsed { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; V80FmtImage { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; DataUpgraded { get; set; }&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Histogram { get; set; }&lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;And there you have it folks, a nicely generated set of properties and readers to populate the properties based on your tables columns/names.&amp;#160; Many thanks to &lt;a href="http://www.woodcp.com/" target="_blank"&gt;Todd Wood&lt;/a&gt; for these great scripts.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-767712350066474311?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/767712350066474311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=767712350066474311' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/767712350066474311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/767712350066474311'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2010/05/using-sql-to-generate-c-properties.html' title='Using Sql to generate C# properties'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-2095473898413854281</id><published>2010-01-14T21:05:00.001-08:00</published><updated>2010-01-14T21:15:36.519-08:00</updated><title type='text'>Set an ActiveX as Trusted and make calls to Javascript functions</title><content type='html'>&lt;p&gt;There comes a time when you need to write an ActiveX for reasons that really don't matter in this post but you know those times.&amp;#160; I personally try to avoid them due to their &amp;quot;Windows Only Support&amp;quot; but in a recent project where we had to integrate a java web based application with an application I wrote in C# that was a Winforms application the need was eminent.&amp;#160; We needed a way to fire up the winforms application from the web, pass it some parameters, and when it closes notify the page as well as give the page some data the user entered.&amp;#160; Well getting a web page to open a windows application is pretty simple however we needed much more than just opening the applciation and forgetting about it.&amp;#160; A problem we were facing was how are we going to: &lt;/p&gt;  &lt;p&gt;1. Notify the calling page when the form closes    &lt;br /&gt;2. Return user entered data back into the page &lt;/p&gt;  &lt;p&gt;The client has a policy on their in-house applications that they only support IE.&amp;#160; So we knew from that we could build an ActiveX and not worry about other browsers.&amp;#160; I mean hey, IE works very well with ActiveX and &lt;a href="http://support.mozilla.com/en-US/kb/ActiveX"&gt;FireFox&lt;/a&gt; not so much.&amp;#160; We needed the code to notify the page via javascript because a postback was not allowed for this application.&amp;#160; It appeared the java web app uses a redirect similar to the way Server.Transfer works in ASP.NET in which the Url stays on the base directory.&amp;#160; If a postback was fired then the user would be taken back to their dashboard and lose what they had entered.&amp;#160; So the idea to write an ActiveX was decided as the approach we would take.&amp;#160; We still needed to know if it was possible to make a call to a Javascript function from an ActiveX.&amp;#160; After much research I found a solution using the IOleClientSite Interface.&amp;#160; This interface allows you to get the container the ActiveX is hosted in.&amp;#160; Then using the IHTMLDocument2 interface we can gain access to the DOM. &lt;/p&gt;  &lt;p&gt;Here is an example:    &lt;br /&gt;&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;/// &amp;lt;summary&amp;gt;&lt;br /&gt;/// Calls the JScript within the current DOM this activeX is placed in.&lt;br /&gt;/// &amp;lt;/summary&amp;gt;&lt;br /&gt;/// &amp;lt;param name=&amp;quot;key&amp;quot;&amp;gt;The key.&amp;lt;/param&amp;gt;&lt;br /&gt;private void CallJScript(string key)&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        // Get a handle on the current Page&lt;br /&gt;        Type typeIOleObject = this.GetType().GetInterface(&amp;quot;IOleObject&amp;quot;, true); &lt;br /&gt;&lt;br /&gt;        // Get the ClientSite&lt;br /&gt;        object oleClientSite = typeIOleObject.InvokeMember(&amp;quot;GetClientSite&amp;quot;,&lt;br /&gt;        BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public,&lt;br /&gt;        null, this, null); &lt;br /&gt;&lt;br /&gt;        // Obtain the container&lt;br /&gt;        IOleClientSite oleClientSite2 = oleClientSite as IOleClientSite;&lt;br /&gt;        IOleContainer pOleContainer;&lt;br /&gt;        oleClientSite2.GetContainer(out pOleContainer); &lt;br /&gt;&lt;br /&gt;        IHTMLDocument2 pDoc1 = (IHTMLDocument2)pOleContainer; &lt;br /&gt;&lt;br /&gt;        // Gain access to its DOM&lt;br /&gt;        object script = pDoc1.Script; &lt;br /&gt;&lt;br /&gt;        // Create the arguments that will be passed&lt;br /&gt;        // as parameters to the javascript function&lt;br /&gt;        object[] args = new object[1];&lt;br /&gt;        args[0] = key; &lt;br /&gt;&lt;br /&gt;        // Invoke the script&lt;br /&gt;        script.GetType().InvokeMember(&amp;quot;YourJavaScriptFunction&amp;quot;, BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, script, args);&lt;br /&gt;    }&lt;br /&gt;    catch &lt;br /&gt;    {&lt;br /&gt;       // TODO: Log Message&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This seemed simple enough until we put the ActiveX on the page and discovered it wasn't working.&amp;#160; I was so confused because from everything I had read this is how you do it.&amp;#160; After more research and debugging I discovered the ActiveX didn't have permission to access the DOM; it was being denied by IE.&amp;#160; So once again more research on how to get access to the ActiveX because setting the site as Trusted wasn't enough.&amp;#160; I came across another site (I wish I could find it again to display here) which led me in the right direction on how to get this working.&amp;#160; You have to create an interface named IObjectSafety which will let IE know the ActiveX is safe.&amp;#160; To make this work you create an enum that is Serializable and ComVisible like so: &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;[Serializable, ComVisible(true)]&lt;br /&gt;public enum ObjectSafetyOptions&lt;br /&gt;{&lt;br /&gt;    INTERFACESAFE_FOR_UNTRUSTED_CALLER = 0x00000001,&lt;br /&gt;    INTERFACESAFE_FOR_UNTRUSTED_DATA = 0x00000002,&lt;br /&gt;    INTERFACE_USES_DISPEX = 0x00000004,&lt;br /&gt;    INTERFACE_USES_SECURITY_MANAGER = 0x00000008&lt;br /&gt;};&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Then you need to create an Interface called IObjectSafety like so: &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;/// &amp;lt;summary&amp;gt; &lt;br /&gt;/// IObjectSafety lets IE know this ActiveX is safe &lt;br /&gt;/// &amp;lt;/summary&amp;gt; &lt;br /&gt;[ComImport(), Guid(&amp;quot;CB5BDC81-93C1-11CF-8F20-00805F2CD064&amp;quot;)] &lt;br /&gt;[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] &lt;br /&gt;public interface IObjectSafety &lt;br /&gt;{ &lt;br /&gt;    [PreserveSig] &lt;br /&gt;    long GetInterfaceSafetyOptions(ref Guid iid, out int pdwSupportedOptions, out int pdwEnabledOptions); &lt;br /&gt;&lt;br /&gt;    [PreserveSig] &lt;br /&gt;    long SetInterfaceSafetyOptions(ref Guid iid, int dwOptionSetMask, int dwEnabledOptions); &lt;br /&gt;};&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160; &lt;br /&gt;And then you create your control (I used UserControl) which will be used to talk between the Page and the Windows Form.&amp;#160; &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;[ClassInterface(ClassInterfaceType.AutoDual),&lt;br /&gt;ComSourceInterfaces(typeof(ControlEvents))]&lt;br /&gt;[Guid(&amp;quot;F7A01F7B-C6B8-4076-9313-A976EE45C472&amp;quot;)]&lt;br /&gt;[ComVisible(true)]&lt;br /&gt;public partial class MyClass : UserControl, IObjectSafety&lt;br /&gt;{&lt;br /&gt;   ...&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The IObjectSafety member was implemented as: &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;#region IObjectSafety Members&lt;br /&gt;private ObjectSafetyOptions m_options =&lt;br /&gt;    ObjectSafetyOptions.INTERFACESAFE_FOR_UNTRUSTED_CALLER |&lt;br /&gt;    ObjectSafetyOptions.INTERFACESAFE_FOR_UNTRUSTED_DATA; &lt;br /&gt;&lt;br /&gt;/// &amp;lt;summary&amp;gt;&lt;br /&gt;/// Gets the interface safety options.&lt;br /&gt;/// &amp;lt;/summary&amp;gt;&lt;br /&gt;/// &amp;lt;param name=&amp;quot;iid&amp;quot;&amp;gt;The iid.&amp;lt;/param&amp;gt;&lt;br /&gt;/// &amp;lt;param name=&amp;quot;pdwSupportedOptions&amp;quot;&amp;gt;The PDW supported options.&amp;lt;/param&amp;gt;&lt;br /&gt;/// &amp;lt;param name=&amp;quot;pdwEnabledOptions&amp;quot;&amp;gt;The PDW enabled options.&amp;lt;/param&amp;gt;&lt;br /&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;br /&gt;public long GetInterfaceSafetyOptions(ref Guid iid, out int pdwSupportedOptions, out int pdwEnabledOptions)&lt;br /&gt;{&lt;br /&gt;    pdwSupportedOptions = (int)m_options;&lt;br /&gt;    pdwEnabledOptions = (int)m_options;&lt;br /&gt;    return 0;&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;/// &amp;lt;summary&amp;gt;&lt;br /&gt;/// Sets the interface safety options.&lt;br /&gt;/// &amp;lt;/summary&amp;gt;&lt;br /&gt;/// &amp;lt;param name=&amp;quot;iid&amp;quot;&amp;gt;The iid.&amp;lt;/param&amp;gt;&lt;br /&gt;/// &amp;lt;param name=&amp;quot;dwOptionSetMask&amp;quot;&amp;gt;The option set mask.&amp;lt;/param&amp;gt;&lt;br /&gt;/// &amp;lt;param name=&amp;quot;dwEnabledOptions&amp;quot;&amp;gt;The enabled options.&amp;lt;/param&amp;gt;&lt;br /&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;br /&gt;public long SetInterfaceSafetyOptions(ref Guid iid, int dwOptionSetMask, int dwEnabledOptions)&lt;br /&gt;{&lt;br /&gt;    return 0;&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;#endregion&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160; &lt;br /&gt;This is all it took to make the ActiveX have the permission it needed to gain access to the DOM and make DOM calls.&amp;#160; The use of the IObjectSafety makes an ActiveX that was once &amp;quot;untrusted&amp;quot; become &amp;quot;trusted&amp;quot;.&amp;#160; I hope this helps you out and saves you the time I spent trying to get this working on our project.&amp;#160; As always, Happy Coding.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-2095473898413854281?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/2095473898413854281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=2095473898413854281' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/2095473898413854281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/2095473898413854281'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2010/01/set-activex-as-trusted-as-well-as-call.html' title='Set an ActiveX as Trusted and make calls to Javascript functions'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-1902309678469682564</id><published>2010-01-13T17:14:00.001-08:00</published><updated>2010-01-13T17:28:11.857-08:00</updated><title type='text'>My personal experience with Alienware PC Maker</title><content type='html'>&lt;p&gt;&amp;#160;&amp;#160;&amp;#160; Well on March 26th 2009 I purchased a Laptop from Alienware which I was very excited about after reading about the high performance components they use in their laptops.&amp;#160; I got my Laptop and quickly opened it and was ready to conquer my development tasks… well probably not quite like that but you get the point.&amp;#160; All was going great, I was installing Visual Studio 2008 and got that done; then went on to install DevExpress but before I got a chance to install it the laptop froze up.&amp;#160; The screen stayed on the way I left it and the cursor would not move.&amp;#160; I immediately called Technical Support since these things shouldn’t be happening and I happened to have purchased the extended warranty.&amp;#160; Technical Support had me reboot, which consisted of holding the power button down for 3-5 seconds.&amp;#160; Then they asked me to download a third-party program (SpeedFan) so we could check if the PC was getting hot while a memory check was run using both chips installed.&amp;#160; Then we ran a Video Card test and monitored the PC heat.&amp;#160; All seemed to be doing well until we tested Memory using a single chip at a time and some hiccups happened.&amp;#160; First attempt froze the machine and subsequent attempts seemed to be fine.&amp;#160; We could not figure out why the PC was freezing.&amp;#160; So we gave up and went on thinking it must be drivers or something.&amp;#160; I updated the drivers to the latest versions and even flashed the bios with a new upgrade that was available.&amp;#160; The PC kept freezing about once a week, then once a day and I was getting flustered.&amp;#160; I called Support again and once again we ran a memory check (Extensive Check) on what I now have installed Windows 7.&amp;#160; No results found, the memory passed.&amp;#160; So then we ran a chkdisk with the options to repair bad clusters checked and of course no issues with the exception of 2 bad clusters which windows reports it fixed.&amp;#160; After hours with a Technician and no idea why this pc is freezing he puts me on hold and another guy gets on the line.&amp;#160; The new guy gets on just to tell me that because I upgraded to Windows 7 my warranty is no longer going to support the problem I am experiencing with my laptop and that if I want to upgrade my support a charge will be required.&amp;#160; I asked if I paid this upgrade fee could they guarantee I would get the laptop fixed since of course it has had this problem since day 1 and I could go about my business.&amp;#160; I was told that they could not guarantee it would be fixed but they would try.&amp;#160; So basically what it boils down to is the following:&lt;/p&gt;  &lt;p&gt;1. Paid for extended support – Not any good to me now since I upgraded to Windows 7   &lt;br /&gt;2. They want to charge me more – Cannot guarantee it will be fixed    &lt;br /&gt;3. I’m stuck with a laptop that keeps freezing and has been literally the day I got it&lt;/p&gt;  &lt;p&gt;I was furious, I asked the guy if they test their equipment before sending it to the customer, he exclaimed they only test that it installed the OS and not for any other issues (Hardware or Software).&amp;#160; All in all I have learned a valuable lesson, I for one will not purchase extended warranties again on PC’s and I am done with Alienware products.&amp;#160; Not to say your experience will not be an enjoyable one but for me it has been a nightmare.&amp;#160; If you too have had a bad experience with Alienware I would like to hear from you and your experience.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-1902309678469682564?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/1902309678469682564/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=1902309678469682564' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/1902309678469682564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/1902309678469682564'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2010/01/my-personal-experience-with-alienware.html' title='My personal experience with Alienware PC Maker'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-4364497187617340370</id><published>2009-12-09T21:20:00.001-08:00</published><updated>2009-12-09T21:20:42.496-08:00</updated><title type='text'>Leaping into BDD</title><content type='html'>&lt;p&gt;As this title says Leaping into BDD I have plunged in to learn about and use BDD.&amp;#160; My experience with it is new and I don’t claim to know everything about BDD.&amp;#160; With this said if you have some more insight or explanations you want to indulge us with please don’t hesitate to broaden our knowledge by sharing yours.&amp;#160; &lt;/p&gt;  &lt;p&gt;We have all heard of Test Driven Development (&lt;a href="http://en.wikipedia.org/wiki/Test-driven_development" target="_blank"&gt;TDD&lt;/a&gt;) and many of us have used it.&amp;#160; I’m going to tell you about a newer type of development out that in my opinion produces a much easier flow.&amp;#160; The new development is called Behavior Driven Development or &lt;a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development" target="_blank"&gt;BDD&lt;/a&gt;.&amp;#160; BDD is exactly as it is named, it specifies your code from a behavioral approach.&amp;#160; By the time we start to code we know what we want the project to do because we have already thought this out by now.&amp;#160; So using BDD we can write specifics to guide our code.&amp;#160; As an example, lets say we are writing a notepad application.&lt;/p&gt;  &lt;p&gt;Our specifics may look something like this:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font color="#008040"&gt;Open Text File for Editing        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; - File Open Dialog with Filters         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; - Content of file is extracted and placed onto Rich Text Box         &lt;br /&gt;Save Changes         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; - Collect text and save back to opened file         &lt;br /&gt;Close Notepad         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; - Check for changes made         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - if changes prompt user         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; - Cleanup code         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; - Close application&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;These specifications are pretty straight forward; we are thinking like a human and how a human would use our application.&amp;#160; In these scenarios we would have the option to open a file; OK, after the file is opened what do we do? Well according to our specs we can save the file, and we can close the application.&amp;#160; During a close we are showing that our application should check for changes and prompt the user if any exist.&amp;#160; Handle our cleanup of code and resources, then close the application.&amp;#160; Pretty straight forward right?&lt;/p&gt;  &lt;p&gt;To get started using BDD you must first get the following:&lt;/p&gt;  &lt;p&gt;- &lt;a href="http://github.com/machine/machine.specifications" target="_blank"&gt;MSpec (Machine.Specifications)&lt;/a&gt;     &lt;br /&gt;- &lt;a href="http://www.testdriven.net/" target="_blank"&gt;TestDriven.Net&lt;/a&gt; Personal/Professional (Not Required but good for running your test)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Once you have downloaded MSpec and unzipped, you will have something like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_NzIAbPNs_0E/SyCFEtwUQ2I/AAAAAAAAAzo/L-5alo02JIE/s1600-h/MSpecDir4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="MSpecDir" border="0" alt="MSpecDir" src="http://lh5.ggpht.com/_NzIAbPNs_0E/SyCFFtRmm7I/AAAAAAAAAzs/0gpO9Pxa1VY/MSpecDir_thumb2.png?imgmax=800" width="641" height="393" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Double click on the build batch file to run the compiler against the code and output the assemblies we need.    &lt;br /&gt;&lt;strong&gt;Note: You may receive errors on Resharper if you don’t have that installed, don’t worry about those.&amp;#160; You may also have to open the solution in Source and manually compile.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Lets get started by opening Visual Studio, I’m going to create a class called BDD to hold our properties.&amp;#160; But first before I do that I need to know my specifications, lets do that:&lt;/p&gt;  &lt;p&gt;&lt;font color="#008040"&gt;BooleanProp is true      &lt;br /&gt;- DoubleProp must be greater than 0       &lt;br /&gt;- IntegerProp must be 0       &lt;br /&gt;BooleanProp is false       &lt;br /&gt;- DoubleProp must be 0       &lt;br /&gt;- IntegerProp must be greater than 0&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;So I know I will have 3 properties, BooleanProp, IntegerProp, and DoubleProp.&amp;#160; First context I am saying if the BooleanProp is set to true then DoubleProp must be greater than zero and IntegerProp must be zero.&amp;#160; With this said, lets create a class with these properties.&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;public class BDD&lt;br /&gt;{&lt;br /&gt;    private int _IntegerProp;&lt;br /&gt;    public int IntegerProp&lt;br /&gt;    {&lt;br /&gt;        get { return _IntegerProp; }&lt;br /&gt;        set&lt;br /&gt;        {&lt;br /&gt;            _IntegerProp = value;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private double _DoubleProp;&lt;br /&gt;    public double DoubleProp&lt;br /&gt;    {&lt;br /&gt;        get { return _DoubleProp; }&lt;br /&gt;        set&lt;br /&gt;        {&lt;br /&gt;            _DoubleProp = value;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private bool _BooleanProp;&lt;br /&gt;    public bool BooleanProp&lt;br /&gt;    {&lt;br /&gt;        get { return _BooleanProp; }&lt;br /&gt;        set&lt;br /&gt;        {&lt;br /&gt;            _BooleanProp = value;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now that I have my class I’m going to write out the specifications in code.&amp;#160; I start by created a class, ill call it BDDSpecifications.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;using Machine.Specifications;&lt;br /&gt;&lt;br /&gt;public class BDDSpecification&lt;br /&gt;{&lt;br /&gt;    /*&lt;br /&gt;     * BooleanProp is true&lt;br /&gt;     * - DoubleProp must be greater than 0&lt;br /&gt;     * - IntegerProp must be 0&lt;br /&gt;     * BooleanProp is false&lt;br /&gt;     * - DoubleProp must be 0&lt;br /&gt;     * - IntegerProp must be greater than 0&lt;br /&gt;     * &lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;    [Subject(&amp;quot;BooleanProp is true&amp;quot;)]&lt;br /&gt;    public class When_BooleanProp_is_true : BDDClass&lt;br /&gt;    {&lt;br /&gt;        Because of = () =&amp;gt;&lt;br /&gt;            {&lt;br /&gt;                testClass.BooleanProp = true;&lt;br /&gt;            };&lt;br /&gt;&lt;br /&gt;        It should_have_doubleProp_GreaterThanZero = () =&amp;gt;&lt;br /&gt;            {&lt;br /&gt;                testClass.DoubleProp.ShouldBeGreaterThan(0);&lt;br /&gt;            };&lt;br /&gt;&lt;br /&gt;        It should_have_integerProp_equal_zero = () =&amp;gt;&lt;br /&gt;            {&lt;br /&gt;                testClass.IntegerProp.ShouldEqual(0);&lt;br /&gt;            };&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    [Subject(&amp;quot;BooleanProp is false&amp;quot;)]&lt;br /&gt;    public class When_BooleanProp_is_false : BDDClass&lt;br /&gt;    {&lt;br /&gt;        Because of = () =&amp;gt;&lt;br /&gt;        {&lt;br /&gt;            testClass.BooleanProp = false;&lt;br /&gt;        };&lt;br /&gt;&lt;br /&gt;        It should_have_doubleProp_equal_zero = () =&amp;gt;&lt;br /&gt;        {&lt;br /&gt;            testClass.DoubleProp.ShouldEqual(0);&lt;br /&gt;        };&lt;br /&gt;&lt;br /&gt;        It should_have_integerProp_GreaterThanZero = () =&amp;gt;&lt;br /&gt;        {&lt;br /&gt;            testClass.IntegerProp.ShouldBeGreaterThan(0);&lt;br /&gt;        };&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public abstract class BDDClass&lt;br /&gt;    {&lt;br /&gt;        protected static BDD testClass;&lt;br /&gt;        Establish context = () =&amp;gt;&lt;br /&gt;            {&lt;br /&gt;                testClass = new BDD();&lt;br /&gt;            };&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Here you can see my specifications in code.&amp;#160; I have an abstract class, this is not required but prevents me from having to create the BDD class for each test.&amp;#160; Notice my classes inherit the BDDClass.&amp;#160; Looking at the code you might be a little nervous, don’t be.&amp;#160; The code is actually very simple,&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Because of Something, It should have/do this, It should have/do that, etc, etc, etc.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;If you did not install the TestDrive.Net, no problem.&amp;#160; When you compiled the source for MSpec an executable was generated called mspec in the build output.&amp;#160; Open your Tools-&amp;gt;External Tools, click on Add.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Parameters:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Title: Add a title &lt;br /&gt;  &lt;br /&gt;Command: The path to the mspec.exe file &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;Arguments: $(TargetName)$(TargetExt) --html $(ProjectDir)Reports\report.html&amp;#160;&amp;#160; &lt;br /&gt;&lt;em&gt;(Note: By adding the –-html “Report Path” an html file will be created for you with the results.&amp;#160; The html part is not required.)&lt;/em&gt; &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;Initial Directory: $(BinDir)&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://lh4.ggpht.com/_NzIAbPNs_0E/SyCFGNOXbuI/AAAAAAAAAzw/hQilNM3SWVA/s1600-h/image%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_NzIAbPNs_0E/SyCFG7Ss9_I/AAAAAAAAAz0/oJoaT-ROyr8/image_thumb%5B1%5D.png?imgmax=800" width="414" height="404" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now that you have your specifications all laid out, lets run this.&amp;#160; I'm going to run using the MSpec option. &lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;My Results: &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_NzIAbPNs_0E/SyCFH9F7woI/AAAAAAAAAz4/LF4TbfHfqhs/s1600-h/image%5B7%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_NzIAbPNs_0E/SyCFI5DBruI/AAAAAAAAAz8/0k1Lwi7ABho/image_thumb%5B3%5D.png?imgmax=800" width="502" height="448" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I have 2 that failed which I expected.&amp;#160; To make these pass I need to make some changes.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;public class When_BooleanProp_is_true : BDDClass&lt;br /&gt;        {&lt;br /&gt;            Because of = () =&amp;gt;&lt;br /&gt;              {&lt;br /&gt;                 testClass.BooleanProp = true;&lt;br /&gt;                 testClass.IntegerProp = 0;&lt;br /&gt;                 testClass.DoubleProp = 2;&lt;br /&gt;              };&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;I made a simple change to both classes and got the following results: &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_NzIAbPNs_0E/SyCFJhLZbVI/AAAAAAAAA0E/wT8Q1HwMxIc/s1600-h/image%5B12%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_NzIAbPNs_0E/SyCFKV06XHI/AAAAAAAAA0I/dpq7cAG2WFk/image_thumb%5B6%5D.png?imgmax=800" width="563" height="503" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;All specifications passed!! The report generated is a nice addition that can be printed and handed over to your PM.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Happy Coding…&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-4364497187617340370?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/4364497187617340370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=4364497187617340370' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/4364497187617340370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/4364497187617340370'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2009/12/leaping-into-bdd.html' title='Leaping into BDD'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_NzIAbPNs_0E/SyCFFtRmm7I/AAAAAAAAAzs/0gpO9Pxa1VY/s72-c/MSpecDir_thumb2.png?imgmax=800' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-4804709848811518910</id><published>2009-11-03T15:47:00.001-08:00</published><updated>2009-11-03T15:47:26.210-08:00</updated><title type='text'>Downloading a PDF from Stream using XAF</title><content type='html'>At times you need to deliver PDF content or any content for that matter and the option to save the streams to a file and download are not always ideal. If your an XAF user and need to accomplish such a task here is how to do it. As we know downloading from a Stream is handled using an IHttpHandler along with an ashx file used to direct the user for downloading. To get started, first create an IHttpHandler. Set the IsReusable to false.   &lt;pre class="brush: csharp;"&gt;public bool IsReusable&lt;br /&gt;{&lt;br /&gt;   get { return false; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In the ProcessRequest do the following:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;&lt;br /&gt;public void ProcessRequest(HttpContext context)&lt;br /&gt;{&lt;br /&gt;    context.Response.ContentType = &amp;quot;application/pdf&amp;quot;;&lt;br /&gt;    DevExpress.Xpo.IDataLayer dataLayer = XpoDefault.GetDataLayer(WebConfigurationManager.ConnectionStrings[&amp;quot;ConnectionString&amp;quot;].ConnectionString, DevExpress.Xpo.DB.AutoCreateOption.SchemaAlreadyExists);&lt;br /&gt;    using (DevExpress.Xpo.Session session = new DevExpress.Xpo.Session(dataLayer, null))&lt;br /&gt;    {     &lt;br /&gt;        DataObject myDatasource = session.FindObject&lt;DataObject&gt;(new BinaryOperator(&amp;quot;Oid&amp;quot;, new Guid(context.Request.Params[&amp;quot;oid&amp;quot;])));&lt;br /&gt;        context.Response.AddHeader(&amp;quot;Content-Disposition&amp;quot;, &amp;quot;attachment; filename=MyPDFName.pdf&amp;quot;);&lt;br /&gt;        context.Response.BinaryWrite(myDatasource.PDFBlogField); // byte[]&lt;br /&gt;        context.Response.End();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now that you have your handler done, lets get the ASHX file using it.&lt;br /&gt;&lt;br /&gt;Create a Text File in your Project.Web project and rename it to PDFStream.ashx (Or whatever you want to name it), then add the following: (Replace Class with your NameSpace and class name)&lt;br /&gt;Note: I usually create a Custom folder to keep track of these pages since they are not part of XAF themselves&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;&lt;br /&gt;&amp;lt;%@ WebHandler Language=&amp;quot;C#&amp;quot; Class=&amp;quot;Project.Web.Module.Handlers.MyPDFHandler&amp;quot; %&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This points your ashx file to the handler which will take care of passing the stream to your user.&lt;br /&gt;&lt;br /&gt;When you have that ready, the next step is to create the Controller that will call this file.&lt;br /&gt;&lt;br /&gt;In your Project.Web.Module project, add a controller.  Set the TargetObjectType in the constructor to your class type which this will be used for.  Add a SimpleAction to your controller and set the TargetObjectType for the action.  Subscribe to the Execute event and add the following:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;&lt;br /&gt;private void btnShowPDF_Execute(object sender, SimpleActionExecuteEventArgs e)&lt;br /&gt;{&lt;br /&gt;    if (View.CurrentObject != null)&lt;br /&gt;    {&lt;br /&gt;        WebApplication.Redirect(String.Format(&amp;quot;~/Custom/PDFStream.ashx?oid={0}&amp;quot;, ((DataObject)View.CurrentObject).Oid));&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And thats it, your action will direct the user to the ashx page which will return a file attachment to the user.  Don't worry, the user will not be directed away from the current page, and the best part is you dont have to write files to the disk on your server.  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-4804709848811518910?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/4804709848811518910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=4804709848811518910' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/4804709848811518910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/4804709848811518910'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2009/11/downloading-pdf-from-stream-using-xaf.html' title='Downloading a PDF from Stream using XAF'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-2607772976628075491</id><published>2009-08-27T16:15:00.001-07:00</published><updated>2009-08-28T06:14:53.248-07:00</updated><title type='text'></title><content type='html'>&lt;div class="snippetPost"&gt;The Need for Cloning an Object&lt;br /&gt;&lt;span class="post-labels" id="labels-4533541343623662846"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;I am working on a project in XAF and came into the need of cloning an object but needed to exclude certain properties.&amp;#160; I looked into the CloneHelper but it didn’t do what I needed.&amp;#160; So I wrote a simple method to handle this requirement.&amp;#160; A few things to know, any properties that are readonly do not need to be included in the exclusion.&amp;#160; Also the Oid property (is readonly) does not need to be excluded.&amp;#160; So to get this working, copy the code:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;public static T CloneObject&amp;lt;T&amp;gt;(T sourceObj, T destObj, params string[] excludeProperties)&lt;br /&gt;{&lt;br /&gt;     // Get the properties of the Source Object&lt;br /&gt;     PropertyInfo[] propCollection = sourceObj.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);&lt;br /&gt;            &lt;br /&gt;     foreach (PropertyInfo pInfo in propCollection)&lt;br /&gt;     {&lt;br /&gt;         // Exclude any properties from the exclude list&lt;br /&gt;         if (Array.Find&amp;lt;string&amp;gt;(excludeProperties, val =&amp;gt; val.Equals(pInfo.Name)) == null &amp;&amp; !pInfo.IsDefined(typeof(NonCloneableAttribute), false))&lt;br /&gt;         {&lt;br /&gt;             PropertyInfo tmpProp = destObj.GetType().GetProperty(pInfo.Name);&lt;br /&gt;             if (tmpProp.CanWrite)&lt;br /&gt;                tmpProp.SetValue(destObj, pInfo.GetValue(sourceObj, null), null);&lt;br /&gt;         }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    return destObj;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;To use this method, simply create the object that will become the cloned object and pass the source like so:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;public static MyClonedObject CloneLineItem(DevExpress.Xpo.Session session, MyClonedObject sourceLineItem, params string[] excludeProperties)&lt;br /&gt;{&lt;br /&gt;     MyClonedObject clonedLineItem = new MyClonedObject(session);&lt;br /&gt;     return CloneObject&amp;lt;MyClonedObject&amp;gt;(sourceLineItem, clonedLineItem, excludeProperties);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Create a simple method like above and pass something like:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;MyClonedObject clone = CloneLineItem(this.Session, this, &amp;quot;Parent&amp;quot;, &amp;quot;Total&amp;quot;, &amp;quot;Payments&amp;quot;);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;In this example the properties Payments, Total, and Parent will be ignored when cloned.&amp;#160; I could have also just called it without any exclusions like so:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;MyClonedObject clone = CloneLineItem(this.Session, this);&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;If this helps you out let me know…&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Updated: Added support for the NonCloneableAttribute attribute.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Happy Coding!!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-2607772976628075491?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/2607772976628075491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=2607772976628075491' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/2607772976628075491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/2607772976628075491'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2009/08/need-for-cloning-object.html' title=''/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-4533541343623662846</id><published>2009-06-29T08:20:00.001-07:00</published><updated>2009-06-29T08:20:22.023-07:00</updated><title type='text'>Using a bit column to hold 30+ Checkbox values</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Sometimes your asked to design an application that will contain ‘X’ number of checkboxes.&amp;#160; The DBA is a hardball and tells you no way am I creating 30 columns for your checkboxes, ill create one and you figure it out.&amp;#160; What a punk but lets see what we can do about this.&amp;#160; We could do one of two things, we could have the DBA create a vertical approach where we store the value of each checkbox in its own row, or we can have the DBA create a bit column and we bit flag this baby.&amp;#160; Well being the title of this article has “bit column”, you know what I’m going to talk about.&amp;#160; That’s right, we are creating a bit column.&amp;#160; Just a tad bit about bit flags since we are not really focused on explaining them in this article is that they are powers of 2.&amp;#160; Meaning our values stored as enums will increment to the power of 2 starting with the value 1.&lt;/p&gt;  &lt;p&gt;Example:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;public enum CheckBoxValues&lt;br /&gt;{&lt;br /&gt;   first = 1,&lt;br /&gt;   second = 2,&lt;br /&gt;   third = 4,&lt;br /&gt;   fourth = 8,&lt;br /&gt;   fifth = 16,&lt;br /&gt;   sixth = 32,&lt;br /&gt;   seven = 64,&lt;br /&gt;   eight = 128,&lt;br /&gt;   nine = 256&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So here we show only 9 values, you however would continue on down the path of 30 as per this title.&amp;#160; But for clarity we will keep this simple.&amp;#160; Seeing that our values of the enum go from 1-256 does not mean your values will be stored in the db this way.&amp;#160; These are flag values using the power of 2, our db values will be the int value of the enum.&amp;#160; So “first” int value is 1 and “nine” int value is 9.&amp;#160; Now that we have that clear lets move on.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Ok, so we now have a bit column called “CheckedValues”, sounds good to me.&amp;#160; We need to store all our check box values into this one column.&amp;#160; The way we handle this is we treat the checkbox checked value as its enum value.&amp;#160; So for example we would have a check box called chkFirst and its checked value would be 1, chkNine would have a checked value of 9 and so on.&amp;#160; The checked values must match or be handled as the enum value (such as (int)CheckBoxValues.third will return 3).&amp;#160; This is important because we need to sum these values up.&amp;#160; So assume we are done and have all our checkboxes in place.&amp;#160; We are now ready to store/retrieve these values.&amp;#160; When the save button is hit, your code will then iterate through the checked check boxes and sum up their values.&amp;#160; So lets say first, second, and fourth are checked then our value would be 7 that gets stored in the database (1+2+4 = 7).&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Setting the checkbox check state from the db value is just as easy.&amp;#160; Create a simple method like so:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;private bool IsChecked(int dbValue, int enumValue)&lt;br /&gt;{&lt;br /&gt;    return ((dbValue &amp;amp; enumValue) == enumValue);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Then you would simply handle the checked value like:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;chkFirst.Checked = IsChecked(7, (int)CheckBoxValues.first);&lt;br /&gt;chkSecond.Checked = IsChecked(7, (int)CheckBoxValues.second);&lt;br /&gt;chkThrid.Checked = IsChecked(7, (int)CheckBoxValues.third);&lt;br /&gt;chkFourth.Checked = IsChecked(7, (int)CheckBoxValues.fourth);&lt;br /&gt;...&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I am passing 7 since that is what the DB Value is in our example.&amp;#160; How is this working? Well its actually quite simple.&amp;#160; We are getting the BitAnd value of the enum and checking if its turned on in our db value.&amp;#160; So what is happening in the backend is something like this.&amp;#160; The binary value of 7 is 0111.&amp;#160; The IsChecked method is comparing this value to the passed enum flag value.&amp;#160; So a check looks something like this for second: 0111 &amp;amp; 0010 == 0010.&amp;#160; It passes because the 1 &amp;amp; 0 = 0 and 1 &amp;amp; 1 = 1.&amp;#160; So 0111 &amp;amp; 0010 does in fact = 0010 because starting from right to left we see 1 &amp;amp; 0 = 0, 1 &amp;amp; 1 = 1, 1 &amp;amp; 0 = 0, 0 &amp;amp; 0 = 0, total that up and we get 0010 (Remember I went right to left, so do the same totaling).&amp;#160; So that tells us this flag is on so check the checkbox.&amp;#160; The value 7 would check our 1, 2, and 4 enum values.&amp;#160; The exact ones we checked.&amp;#160; If the db value is 5 then first and fourth would be checked and so on.&amp;#160; This is a 32 bit column so naturally you could only store 32 bits of values in it but 30 checkboxes would easily fit in just one column.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Hope this helps you out there.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-4533541343623662846?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/4533541343623662846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=4533541343623662846' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/4533541343623662846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/4533541343623662846'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2009/06/using-bit-column-to-hold-30-checkbox.html' title='Using a bit column to hold 30+ Checkbox values'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-7261094860332190280</id><published>2009-06-18T19:46:00.001-07:00</published><updated>2009-06-18T19:46:48.388-07:00</updated><title type='text'>Shrink those Urls</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Those using twitter know about the benefits of shrinking a url to reduce character count, a tweet is limited to 140 characters so each letter matters.&amp;#160; Being a tweeter myself I tend to use tinyurl like most people out there.&amp;#160; It is the most popular for shrinking urls on twitter today.&amp;#160; &lt;/p&gt;  &lt;p&gt;What if you wanted to not only shrink your urls but also track data about the urls you shrink.&amp;#160; Data such as where the person that clicked your links location is; or how many times they have clicked the link perhaps to show another colleague.&amp;#160; A nice solution that I found out there written by Andy Meadows is &lt;a href="http://www.budurl.com"&gt;www.budurl.com&lt;/a&gt;.&amp;#160; This site is well laid out and tracks some very useful information.&amp;#160; I noticed AMD is one of their customers so I assume I am not alone in liking the service.&amp;#160; &lt;/p&gt;  &lt;p&gt;A video is located on their home page which shows us some of the features, you can see it here:&lt;/p&gt; &lt;object width="400" height="311"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1719651&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=1719651&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="311"&gt;&lt;/embed&gt;&lt;/object&gt;  &lt;p&gt;&lt;a href="http://vimeo.com/1719651"&gt;BudURL Demo&lt;/a&gt; from &lt;a href="http://vimeo.com/user746079"&gt;Andy Meadows&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This is one of many great sites out there that shrink our urls to save space.&amp;#160; The benefit to budurl.com is the addition of the marketing data collected that can assist your business in understanding who and where is viewing your site and how many times they have visited.&amp;#160; They have an enterprise version which allows you to use what ever url domain you want which is also very cool.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-7261094860332190280?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/7261094860332190280/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=7261094860332190280' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/7261094860332190280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/7261094860332190280'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2009/06/shrink-those-urls.html' title='Shrink those Urls'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-8475961925498767698</id><published>2009-06-09T19:23:00.001-07:00</published><updated>2009-06-09T19:23:26.173-07:00</updated><title type='text'>Windows 7 RC Experience Thus Far</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I have been using Windows 7 now for about 1 month or so and I must say I really like it.&amp;#160; I was once on Vista and never more after seeing the light of an OS that does not slow me down.&amp;#160; On another note, the system I installed Windows 7 on is my new Alienware Laptop which has also been doing very well after the upgrade.&amp;#160; I have experienced some freezing of the system twice now, albeit that is better than how it was with Vista which was becoming a 3-5 time a day experience.&amp;#160; I haven’t really done much with the XP theme on individual applications nor have I dove into the VM of Windows 7 but I am enjoying the user experience I get with this OS and plan to upgrade the other 3 boxes with it when it comes out, or not.&amp;#160; I still haven’t decided what to do with my older machines.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-8475961925498767698?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/8475961925498767698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=8475961925498767698' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/8475961925498767698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/8475961925498767698'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2009/06/windows-7-rc-experience-thus-far.html' title='Windows 7 RC Experience Thus Far'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-6938901926516548593</id><published>2009-06-08T20:25:00.001-07:00</published><updated>2009-06-09T06:38:41.634-07:00</updated><title type='text'>XAF Custom Rule for Conditionally Required Properties</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;For those of you using DevExpress XAF (eXpressApp) you may have come across the need for making a Domain Object property conditionally required.&amp;#160; For Example, lets say you have a Domain Object with 3 properties (FirstName, LastName, and Phone) and you want Phone to be required only if FirstName and LastName are not null. How do you do it in XAF? Well I have a solution for you.&amp;#160; Simply download the source and apply the RuleConditionalIsRequiredAttribute to your properties like so:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;[DefaultClassOptions]&lt;br /&gt;    public class TestRule : BaseObject&lt;br /&gt;    {&lt;br /&gt;        public TestRule(Session session) : base(session) { }&lt;br /&gt;&lt;br /&gt;        ...&lt;br /&gt;&lt;br /&gt;        private string phone;&lt;br /&gt;        [RuleConditionalIsRequired(&amp;quot;Phone is Required&amp;quot;, DefaultContexts.Save, &amp;quot;!String.IsNullOrEmpty(FirstName) &amp;amp;&amp;amp; !String.IsNullOrEmpty(LastName)&amp;quot;, &amp;quot;Phone is required when First Name and Last Name are added.&amp;quot;)]&lt;br /&gt;        public string Phone&lt;br /&gt;        {&lt;br /&gt;            get&lt;br /&gt;            {&lt;br /&gt;                return phone;&lt;br /&gt;            }&lt;br /&gt;            set&lt;br /&gt;            {&lt;br /&gt;                SetPropertyValue(&amp;quot;Phone&amp;quot;, ref phone, value);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;  &lt;br /&gt;As you can see you are writing C# code as the condition, I haven't tested in VB but since its using lambda expressions to compile this condition I'm sure it will work (I hope at least for VB coders).&amp;#160; It works great in my C# applications.&amp;#160; Your condition has to return bool and can only be used for properties.&amp;#160; The method CheckCondition will build a lambda expression and execute it against your class instance.&amp;#160; If the condition returns true then this property is required, otherwise it is not required.&amp;#160; The lambda expression class was developed by Microsoft and distributed with Visual Studio 2008 as a Sample application on using LAMDBA Expressions.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now when we run this we get the following error: &lt;a href="http://lh6.ggpht.com/_NzIAbPNs_0E/Si3WPKMI3dI/AAAAAAAAAwI/ghUG1hgJxm4/s1600-h/ValidationError%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ValidationError" border="0" alt="ValidationError" src="http://lh5.ggpht.com/_NzIAbPNs_0E/Si3WQN3LJFI/AAAAAAAAAwM/k71am4ovzwU/ValidationError_thumb%5B2%5D.png?imgmax=800" width="737" height="562" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The Full Source is attached. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I hope this helps someone.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt; Happy Coding!!! &lt;a href="http://tinyurl.com/m5y89f"&gt;Download Source Here&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-6938901926516548593?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/6938901926516548593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=6938901926516548593' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6938901926516548593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6938901926516548593'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2009/06/xaf-custom-rule-for-conditionally.html' title='XAF Custom Rule for Conditionally Required Properties'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_NzIAbPNs_0E/Si3WQN3LJFI/AAAAAAAAAwM/k71am4ovzwU/s72-c/ValidationError_thumb%5B2%5D.png?imgmax=800' height='72' width='72'/><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-6977737732036033857</id><published>2009-05-03T19:08:00.001-07:00</published><updated>2009-05-03T19:13:33.197-07:00</updated><title type='text'>Alienware Laptop Purchase</title><content type='html'>&lt;p&gt;Well I got my new laptop, I’ve had it about 3 weeks now and unfortunately its completely frozen up on me about 7 times.&amp;#160; I have made a call to support and they thought maybe the memory was not seated correctly so we went through the routine of stress testing the system checking each memory slot individually.&amp;#160; Nothing came of it, the system only froze a couple of times but not consistently while testing.&amp;#160; Well sadly its still freezing up on me.&amp;#160; I hope the next call is more productive and we get this thing running as it should be.&amp;#160; Don’t get me wrong, this machine is a champ while its running, I would like to keep it running; not asking too much.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-6977737732036033857?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/6977737732036033857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=6977737732036033857' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6977737732036033857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6977737732036033857'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2009/05/alienware-laptop-purchase.html' title='Alienware Laptop Purchase'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-3398966547530646552</id><published>2009-04-30T17:16:00.001-07:00</published><updated>2009-04-30T17:57:30.654-07:00</updated><title type='text'>ASP.NET DIY Intellesence</title><content type='html'>&lt;p&gt;As a time killer I decided to figure out a way to incorporate &lt;a href="http://en.wikipedia.org/wiki/IntelliSense" target="_blank"&gt;intellesence&lt;/a&gt; into an ASP.NET application.&amp;#160; Note this is something I worked on for a few hours without time to refactor; there could also be better ways to accomplish this.&amp;#160; I used &lt;a href="http://www.jquery.com" target="_blank"&gt;jQuery&lt;/a&gt; to handle all my javascript needs and just your basic .NET standard TextBox and ListBox. &lt;/p&gt;  &lt;h4&gt;What exactly does this do?&lt;/h4&gt;  &lt;p&gt;Well first of all I must instill again that this is basic; you can take this code and modify it to fit your needs.&amp;#160; This simply renders your basic &lt;a href="http://en.wikipedia.org/wiki/IntelliSense" target="_blank"&gt;intellesence&lt;/a&gt; from a populated listbox.&amp;#160; Being that it is not complete, if someone would like to take the reigns and send me the code changes to re-publish that would be great too.&amp;#160; My email is gary.l.coxjr at gmail dot com.&lt;/p&gt;  &lt;p&gt;Current Known Problems: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Intellesence is not showing below the text &lt;/li&gt;    &lt;li&gt;Intellesence only displays when the OemPeriod is pressed ‘.’ (would be nice to be able to press “Ctrl”+”Shift”+”Space”) &lt;/li&gt;    &lt;li&gt;Select from list as you type is not perfect (Doesn’t always find the right item) &lt;/li&gt;    &lt;li&gt;Double-Click on listbox does not post to textbox &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Please keep in mind this is &lt;strong&gt;NOT&lt;/strong&gt; production code and shall not be used as such.&amp;#160; You may use this at your own risk.&lt;/p&gt;  &lt;h4&gt;What can be done to make this more useful?&lt;/h4&gt;  &lt;p&gt;Since the intellesence works off the listbox, any ListItems you load in there will be displayed when a period is pressed.&amp;#160; Whatever is selected in the listbox when you hit “Space” or “Enter” is what will be entered after the period in the textbox.&amp;#160; If you populate it with a list of object properties, like in my example of class Person, when a user types Person and then hits the period they will be presented with the pre-populated properties that can be selected.&lt;/p&gt;  &lt;p&gt;The Javascript can be found in AspxIntellesence.js file located in ~/JS directory.&lt;/p&gt;  &lt;p&gt;Here is what we see:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_NzIAbPNs_0E/Sfo_Pv4uAQI/AAAAAAAAAwA/8V5Jf8O5jnw/s1600-h/Intellesence%5B7%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Intellesence" border="0" alt="Intellesence" src="http://lh5.ggpht.com/_NzIAbPNs_0E/Sfo_QAc2s7I/AAAAAAAAAwE/d9AjAAH3Lzs/Intellesence_thumb%5B3%5D.png?imgmax=800" width="446" height="266" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Notice I started to type “S” and the intellesence moved to StreetAddress.&amp;#160; If I had pressed the space bar then you would get Person.StreetAddress as the javascript would handle this.&lt;/p&gt;  &lt;h4&gt;What is this useful for anyway?&lt;/h4&gt;  &lt;p&gt;Well I think it could be very useful if your designing a template builder that allows your users to design custom email messages, or campaigns.&amp;#160; This type of tool would allow your customer to build the template and from your backend code process it from a given business object.&amp;#160; Take my example, assume I had a class named Person and the above template was processed.&amp;#160; I could send personalized emails to a select group that may look like:&lt;/p&gt;  &lt;p&gt;Welcome Gary Cox,    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; We have your current street listed as 123 Some Street.&lt;/p&gt;  &lt;p&gt;Simply by parsing out the [object property] and replacing with its value of the current instance.&lt;/p&gt;  &lt;p&gt;As always, I hope this helps someone.&amp;#160; Happy Coding!!!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.quadrictech.com/Downloads/Intellesense.zip"&gt;Download Source Code&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-3398966547530646552?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/3398966547530646552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=3398966547530646552' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/3398966547530646552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/3398966547530646552'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2009/04/aspnet-diy-intellesence.html' title='ASP.NET DIY Intellesence'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_NzIAbPNs_0E/Sfo_QAc2s7I/AAAAAAAAAwE/d9AjAAH3Lzs/s72-c/Intellesence_thumb%5B3%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-6315338255187068383</id><published>2009-04-22T19:27:00.001-07:00</published><updated>2009-04-22T19:48:22.134-07:00</updated><title type='text'>A Hidden Gem when it comes to string separation</title><content type='html'>&lt;p&gt;Most developers based on code I have seen separate strings like so:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;for (int i=0; i&amp;lt;someData.Count; i++)&lt;br /&gt;  myStringBuilder.AppendFormat(&amp;quot;{0},&amp;quot;, someData[i]);&lt;/pre&gt;&lt;br /&gt;Then after constructing this string they need to remove the last separator &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;myStringBuilder = myStringBuilder.Remove(myStringBuilder.Length-1, 1);&lt;/pre&gt;&lt;br /&gt;I too have used this concept.  However, there is another way to do this that a lot of people didn’t even know existed. The String.Join class; it takes 2 params, the separator and the array. &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;ArrayList&amp;lt;String&amp;gt; myList = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt;for (int i=0; i&amp;lt;someData.Count; i++)&lt;br /&gt;   myList.Add(someData[i]);&lt;br /&gt;return String.Join(&amp;quot;,&amp;quot;, myList.ToArray());&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This would return a string separated by a comma such as “Text,MoreText,EvenMore,AndLast”  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-6315338255187068383?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/6315338255187068383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=6315338255187068383' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6315338255187068383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6315338255187068383'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2009/04/hidden-gem-when-it-comes-to-string.html' title='A Hidden Gem when it comes to string separation'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-6110411876889157517</id><published>2009-04-20T19:21:00.001-07:00</published><updated>2009-04-20T19:29:56.186-07:00</updated><title type='text'>Going to twitter</title><content type='html'>&lt;p&gt;Well I jumped on the band wagon and started using twitter.&amp;#160; I must say I really like it; firing off a quick text message type snippets of what you need and someone out there responds.&amp;#160; It’s very easy to use and didn’t take me long to understand the lingo.&amp;#160; When you want to send a tweet to someone you simply place a ‘@’ and their name, for example I am @GaryLCoxJr.&amp;#160; See you out there on twitter :)&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-6110411876889157517?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/6110411876889157517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=6110411876889157517' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6110411876889157517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6110411876889157517'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2009/04/going-to-twitter.html' title='Going to twitter'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-6414612046827710014</id><published>2009-04-17T11:48:00.001-07:00</published><updated>2009-04-17T11:48:49.663-07:00</updated><title type='text'></title><content type='html'>&lt;h2&gt;Fade Form on Move or Resize&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;    I had a project where we display a form to a user and perform a certain task.  Well the user wanted to be able to fade the form when they move it or resize it so they can see the underlying (Main) form.&amp;nbsp; This is simple but thought since my blog has been out of date for some time now I should add something to it.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;To get started, add the following to your form that you want to handle the fade or add to your constant class:&lt;/p&gt;&lt;p&gt;// Called when a Resize or Move loop has ended&lt;br /&gt;const int WM_EXITSIZEMOVE = 0x0232;&lt;br /&gt;&lt;br /&gt;// Called at the beginning of a Resize Move loop&lt;br /&gt;const int WM_ENTERSIZEMOVE = 0x0231;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Next, override the WndProc method of your form like and handle the fade of your choice:&lt;/p&gt;&lt;p&gt;protected override void WndProc(ref Message m)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Check if user is/isn't dragging the form&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch (m.Msg)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case WM_ENTERSIZEMOVE:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Form is being Moved or Resized, set opacity&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Opacity = 0.65;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case WM_EXITSIZEMOVE:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Form is done moving/resizing, set opacity back to 100%&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Opacity = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; base.WndProc(ref m);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;And thats it, when you move or resize the form the opacity will drop to 65%.&amp;nbsp; Once the resizing or moving is complete the form will return to 100% opacity.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-6414612046827710014?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/6414612046827710014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=6414612046827710014' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6414612046827710014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6414612046827710014'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2009/04/fade-form-on-move-or-resize-i-had.html' title=''/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-7539434862979891353</id><published>2009-04-17T07:31:00.000-07:00</published><updated>2009-04-17T08:12:13.884-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Xml'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><title type='text'></title><content type='html'> &lt;h2&gt;Load an Xml File into a Class Collection using LINQ&lt;/h2&gt;  &lt;br /&gt;&lt;p&gt;Work a lot with Xml using the C# language? You will know that to load an Xml&lt;br /&gt;file it can be quite extensive at times depending on how deep your requirements&lt;br /&gt;send you. I personally prefer to work with classes that are populated with the&lt;br /&gt;data from the Xml and bind my controls to such. I have put together a simple&lt;br /&gt;example of loading data from an xml and building a collection of a given class.&lt;br /&gt;Then binding a combobox to this list.&lt;br /&gt;&lt;/p&gt;  &lt;br /&gt;&lt;div&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;Here is my Xml file:&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&lt;?&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;xml&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;version&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color: red;"&gt;encoding&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;utf-8&lt;/span&gt;"&lt;span style="color: blue;"&gt; ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageTypes&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;  &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageType&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;name&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;SUB&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;CP&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Customer Plan&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;FF&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt; Contact&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;OC&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Other Contact&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;MD&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Medical/Dental&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;LG&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Legal&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;OT&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Other&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;  &lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageType&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;  &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageType&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;name&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;FSU&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;FP&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Family Plan&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;FF&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt; Contact&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;OC&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Other Contact&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;MD&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Medical/Dental&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;LG&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Legal&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;OT&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Other&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;  &lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageType&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageTypes&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;Here is my StageTypeItem Class I will use to store the Text and Value for a combobox:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;public&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;StageTypeItem&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;    {&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        &lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: gray;"&gt;&lt;summary&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        &lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; Initializes a new instance of the StageTypeItem class.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        &lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: gray;"&gt;&lt;/summary&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        &lt;span style="color: blue;"&gt;public&lt;/span&gt; StageTypeItem()&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        {&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        }&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        &lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; dataValue;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; DataValue&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        {&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;            &lt;span style="color: blue;"&gt;get&lt;/span&gt; { &lt;span style="color: blue;"&gt;return&lt;/span&gt; dataValue; }&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;            &lt;span style="color: blue;"&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;            {&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;                dataValue = &lt;span style="color: blue;"&gt;value&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;            }&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        }&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        &lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; dataText;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; DataText&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        {&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;            &lt;span style="color: blue;"&gt;get&lt;/span&gt; { &lt;span style="color: blue;"&gt;return&lt;/span&gt; dataText; }&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;            &lt;span style="color: blue;"&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;            {&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;                dataText = &lt;span style="color: blue;"&gt;value&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;            }&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        }&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;    }&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;Here is the code to build the list:&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;public&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&lt;&lt;span style="color: rgb(43, 145, 175);"&gt;StageTypeItem&lt;/span&gt;&gt; LoadStageType(&lt;span style="color: blue;"&gt;string&lt;/span&gt; stageType)&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        {&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;            &lt;span style="color: rgb(43, 145, 175);"&gt;XDocument&lt;/span&gt; doc = &lt;span style="color: rgb(43, 145, 175);"&gt;XDocument&lt;/span&gt;.Parse(Properties.&lt;span style="color: rgb(43, 145, 175);"&gt;Resources&lt;/span&gt;.StageTypes, &lt;span style="color: rgb(43, 145, 175);"&gt;LoadOptions&lt;/span&gt;.None);&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;            &lt;span style="color: blue;"&gt;var&lt;/span&gt; stageTypes = &lt;span style="color: blue;"&gt;from&lt;/span&gt; st &lt;span style="color: blue;"&gt;in&lt;/span&gt; doc.Descendants(&lt;span style="color: rgb(163, 21, 21);"&gt;"StageType"&lt;/span&gt;).Descendants(&lt;span style="color: rgb(163, 21, 21);"&gt;"StageItem"&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;                             &lt;span style="color: blue;"&gt;where&lt;/span&gt; st.Parent.Attribute(&lt;span style="color: rgb(163, 21, 21);"&gt;"name"&lt;/span&gt;).Value == stageType&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;                             &lt;span style="color: blue;"&gt;select&lt;/span&gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;StageTypeItem&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;                             {&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;                                 DataText = st.Value,&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;                                 DataValue = st.Attribute(&lt;span style="color: rgb(163, 21, 21);"&gt;"value"&lt;/span&gt;).Value&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;                             };&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;           &lt;span style="color: blue;"&gt;return&lt;/span&gt; stageTypes.ToList&lt;&lt;span style="color: rgb(43, 145, 175);"&gt;StageTypeItem&lt;/span&gt;&gt;();&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;        }&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;So I have a Root of StageType, with children StageItem in the Xml.  I want to load the values where StageType name = passed parameter stageType.  So assume I pass “SUB” in Xml I want the SUB children (StageItem only) to be returned:&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageType&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;name&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;SUB&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;CP&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Customer Plan&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;FF&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Contact&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;OC&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Other Contact&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;MD&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Medical/Dental&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;LG&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Legal&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;value&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;OT&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;Other&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;StageItem&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;  &lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;StageType&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;Here I am saying load all Descendants of StageItem:&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;var&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; stageTypes = &lt;span style="color: blue;"&gt;from&lt;/span&gt; st &lt;span style="color: blue;"&gt;in&lt;/span&gt; doc.Descendants(&lt;span style="color: rgb(163, 21, 21);"&gt;"StageType"&lt;/span&gt;).Descendants(&lt;span style="color: rgb(163, 21, 21);"&gt;"StageItem"&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;But then I say, only StageItem where its parent has the name “SUB”, remember stageType is the parameter and I passed “SUB”&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;where&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; st.Parent.Attribute(&lt;span style="color: rgb(163, 21, 21);"&gt;"name"&lt;/span&gt;).Value == stageType&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;This part creates a class of type StageTypeItem and I populate it from the Xml values:&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;select&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;StageTypeItem&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;    DataText = st.Value, // the value of the Element, example first one is “Customer Plan”&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;    DataValue = st.Attribute(&lt;span style="color: rgb(163, 21, 21);"&gt;"value"&lt;/span&gt;).Value // The Attribute named value (Case Sensitive) in the first case is “CP”&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;};&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;And then I return a list:&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;return&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; stageTypes.ToList&lt;&lt;span style="color: rgb(43, 145, 175);"&gt;StageTypeItem&lt;/span&gt;&gt;();&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Now I can bind a combobox to this list:&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;ComboBox cbo = new ComboBox();&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;cbo.DataSource = LoadStageType(“SUB”);&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;cbo.DisplayMember = “DataText”; // StageTypeItem.DataText&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;cbo.ValueMember = “DataValue”;  // StageTypeItem.DataValue&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;    &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Happy Coding!!!&lt;/span&gt;&lt;/div&gt;     &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-7539434862979891353?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/7539434862979891353/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=7539434862979891353' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/7539434862979891353'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/7539434862979891353'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2009/04/load-xml-file-into-class-collection.html' title=''/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-3074451233964758987</id><published>2008-09-12T18:02:00.001-07:00</published><updated>2008-09-12T18:04:06.392-07:00</updated><title type='text'>Migrating from ASP to ASP.NET</title><content type='html'>&lt;p&gt;My Team and I have been migrating an ASP page over to ASP.NET for around 2 weeks now.&amp;#160; The site we are moving is very large and will require us to keep most of the ASP pages intact and slowly move them all over in an Agile approach.&amp;#160; The pages the client wanted us to leave in ASP were mainly the Banner or Header page, and the Left Navigation page of pages that would be with or should I say embedded into our ASP.NET pages.&amp;#160; So we had to embed those pages into our Master Page.&amp;#160; The standard #import from ASP did the job however we started noticing that in IE our buttons were not triggering a postback, yet in FireFox it was working.&amp;#160; Wow!!, all this time we were running FireFox and all was well, now we were struggling with a common browser that is not working.&amp;#160; I spent 2 days testing and analyzing, keep in mind we did not have access to the code of the Banner file.&amp;#160; We finally got access and discovered that the Banner section was importing a Search page of which had a Form on the page.&amp;#160; Voala, we figured it out.&amp;#160; You cannot nest forms in ASP.NET.&amp;#160; So in IE the Postback was completely ignored.&amp;#160; However in FireFox we knew nothing of a problem.&amp;#160; Just another one of those events that can make your head turn.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-3074451233964758987?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/3074451233964758987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=3074451233964758987' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/3074451233964758987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/3074451233964758987'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2008/09/migrating-from-asp-to-aspnet.html' title='Migrating from ASP to ASP.NET'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-489244348419517814</id><published>2008-04-13T15:46:00.001-07:00</published><updated>2008-04-13T15:46:54.517-07:00</updated><title type='text'>Our dog Skateboards</title><content type='html'>&lt;p&gt;The kids and I went outside so they could ride the skateboard.&amp;#160; Our dog happened to be watching and decided to skate on her own.&amp;#160; Here she is:&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:56b3bc12-95cb-44dd-842e-7e6ba5de290b" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;div&gt;&lt;object width="425" height="350"&gt;&lt;param name="movie" value="http://www.youtube.com/v/tBhtTOOZaYQ"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/tBhtTOOZaYQ" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-489244348419517814?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/489244348419517814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=489244348419517814' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/489244348419517814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/489244348419517814'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2008/04/our-dog-skateboards.html' title='Our dog Skateboards'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-4943202077722756671</id><published>2008-02-21T09:28:00.001-08:00</published><updated>2008-02-21T09:28:57.895-08:00</updated><title type='text'>Relocating back to Texas</title><content type='html'>&lt;p&gt;This weekend my family and I will be relocating to Texas.&amp;#160; Los Angeles has been quite the experience and I sure will miss it here.&amp;#160; If only a home were affordable we would stay.&amp;#160; I'm off to experience the world of contracting with the State of Texas writing tablet applications.&amp;#160; I'm a bit nervous about contracting but at the same time a little excited.&amp;#160; It's something new and will be full of new learning experiences.&amp;#160; I will try to get more articles up in the near future, I have been a bit lazy about writing them and want to get more content up.&amp;#160; Well as Willie Nelson would say, &amp;quot;On the Road Again&amp;quot;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-4943202077722756671?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/4943202077722756671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=4943202077722756671' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/4943202077722756671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/4943202077722756671'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2008/02/relocating-back-to-texas.html' title='Relocating back to Texas'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-1064976115114765122</id><published>2008-02-15T16:26:00.000-08:00</published><updated>2008-02-15T17:15:03.486-08:00</updated><title type='text'></title><content type='html'>&lt;span style="font-weight: bold; color: rgb(153, 0, 0);font-size:130%;" &gt;Field or Property?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A coworker asked me a simple question that I really just didn't know. What is faster, a field or a property? I know a property has the get and set, but I thought since the property was pointing to a field that it would be equally comparable. So being geeks we put the question to the test. Created a simple console application with a field "A" and a property "B" and bench marked 100 repetitions.&lt;br /&gt;&lt;br /&gt;static string A = "";&lt;br /&gt;&lt;br /&gt;static string _B = "";&lt;br /&gt;property static string B&lt;br /&gt;{&lt;br /&gt;get {return _B;}&lt;br /&gt;set {_B = value;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Then within the main method we create a StopWatch from System.Diagnostics and ran the following loops:&lt;br /&gt;&lt;br /&gt;StopWatch stopWatch = new StopWatch();&lt;br /&gt;&lt;br /&gt;stopWatch.Start();&lt;br /&gt;for(int j=0; j&lt;100; j++) A=A;&lt;br /&gt;stopWatch.Stop();&lt;br /&gt;Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Field A took {0} mil.", stopWatch.ElapsedTime.TotalMilliseconds);&lt;br /&gt;&lt;br /&gt;stopWatch.Start();&lt;br /&gt;for (int i=0; i&lt;100; i++) B=B;&lt;br /&gt;stopWatch.Stop();&lt;br /&gt;Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Property B took {0} mil.", stopWatch.ElapsedTime.TotalMilliseconds);&lt;br /&gt;&lt;br /&gt;Output:&lt;br /&gt;Field A took 0.0025 mil.&lt;br /&gt;Property B took 0.4457 mil.&lt;br /&gt;&lt;br /&gt;The biggest shocker to me was that a field is 99% faster than the property. Now I know there is the getter and setter but I had no idea it had that much of an impact over a field. I hope that after someone reads this their not going to go out and change their code from using properties to using fields. The point of this entry was not to remove properties but to understand the question at hand. Remember private fields do not serialize to xml if your class is marked as serializable so don't run out and change anything. A few milliseconds difference is not enough to make me go out and change an application unless its an intense gaming app in which case we want the fastest processing possible. Properties are awesome and we all should be using them. This test was a great experiment in knowing that if a property is only being used to store a value and your class is not serializable then it doesn't hurt to use a field instead of the property for a very small unrecognized performance gain. But all in all I still love properties and intend to continue using them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-1064976115114765122?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/1064976115114765122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=1064976115114765122' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/1064976115114765122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/1064976115114765122'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2008/02/field-or-property-coworker-asked-me.html' title=''/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-4952070684819973303</id><published>2007-12-18T14:54:00.000-08:00</published><updated>2007-12-18T14:56:53.739-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Reporting'/><title type='text'></title><content type='html'>&lt;span style="color: rgb(51, 204, 0);font-size:180%;" &gt;SQL Server Reporting with Expressions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I wanted to talk about Expressions within the SQL Text of the Dataset in SQL Reporting.  Since I don't see any blogs or posts in google on the subject I thought I would shed some light to help you out.  Have you ever been tasked with a report that had say 4 filters? Instinctively you would write your SQL and have this massive un-maintainable Where statement that was full of OR clauses right? It may look something like &lt;span style="color: rgb(102, 102, 102);"&gt;SELECT * FROM TableA WHERE (@StartDate IS NULL AND @EndDate IS NULL AND @Parameter1 = '-1' AND @Parameter2 = 'All') OR (...) &lt;span style="color: rgb(0, 0, 0);"&gt;which is normal if you didn't know that you could build this sql statement using Expressions.  Once this Where clause is done after you have thought out every scenario the user may choose you are left with 100 lines of sql code.  Now this may be an over exaggeration but you get the point.  To start this off correctly, the best method to begin with is your Select statement.  Add your select then execute it.  This will have SQL Reporting automatically add the fields for you.  Then take your select statement and change it like so (Using same example):&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;= "SELECT * FROM TableA"&lt;br /&gt;&amp;amp; "WHERE 1=1"&lt;br /&gt;&amp;amp; IIF(IsNothing(Parameters!StartDate.Value), "", " AND StartDate &amp;gt;= '" &amp;amp; Parameters!StartDate.Value &amp;amp; "'')&lt;br /&gt;&amp;amp; IIF(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;IsNothing(Parameters!EndDate.Value), "", " AND EndDate &amp;lt;= '" &amp;amp; Parameters!EndDate.Value &amp;amp; "'')&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;&amp;amp; IIF(Parameters!Parameter1.Value = "-1", "", " AND Parameter1 = '" &amp;amp; Parameters!Parameter1.Value &amp;amp; "'")&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;&amp;amp; IIF(Parameters!Parameter2.Value = "All", "", " AND Parameter2 = '" &amp;amp; Parameters!Parameter2.Value &amp;amp; "'")&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As you can see we are starting off our Where clause to be 1=1 just to alleviate complication, then based on the values of our parameters we are injecting our filters into the where clause.  Using this technique you have covered all your scenarios and are now ready to move on.&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-4952070684819973303?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/4952070684819973303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=4952070684819973303' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/4952070684819973303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/4952070684819973303'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/12/sql-server-reporting-with-expressions-i.html' title=''/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-3649058268593237057</id><published>2007-09-07T17:27:00.001-07:00</published><updated>2007-09-07T17:27:22.008-07:00</updated><title type='text'>Sea Gull Eats Trash</title><content type='html'>&lt;embed src="http://www.youtube.com/v/yu2xg__GooE" width="425" height="350" type="application/x-shockwave-flash"&gt; &lt;/embed&gt; &lt;p&gt;While eating at a restaurant in San Diego, CA we noticed a bird hopping into the trash, removing a takeout box and open it.&amp;nbsp; As we continued watching we noticed the bird was smart enough to open the box and eat the contents.&amp;nbsp; Notice the trash all over the street, yeah busted on tape.&amp;nbsp; Sorry for the bad resolution I used a Treo Phone to record this crime in progress.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-3649058268593237057?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/3649058268593237057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=3649058268593237057' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/3649058268593237057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/3649058268593237057'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/09/sea-gull-eats-trash.html' title='Sea Gull Eats Trash'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-8819578924705631602</id><published>2007-08-09T10:26:00.001-07:00</published><updated>2007-08-09T10:27:49.986-07:00</updated><title type='text'>Vista Pre-SP1 Release from Scott Hanselman's blog</title><content type='html'>&lt;p&gt;Scott wrote an article on a Pre-SP1 update for Vista users.&amp;nbsp; This patch made my wifes pc respond much better after installing the Performance Update.&amp;nbsp; Not sure if its the computerized "Placebo Effect"&amp;nbsp;or what but it sure seems faster.&amp;nbsp; Anyway I wanted to share this with you.&amp;nbsp; &lt;/p&gt; &lt;p&gt;The link is &lt;a title="http://www.hanselman.com/blog/VistaPreSP1PerformanceAndReliabilityFixes.aspx" href="http://www.hanselman.com/blog/VistaPreSP1PerformanceAndReliabilityFixes.aspx"&gt;http://www.hanselman.com&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-8819578924705631602?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/8819578924705631602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=8819578924705631602' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/8819578924705631602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/8819578924705631602'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/08/vista-pre-sp1-release-from-scott.html' title='Vista Pre-SP1 Release from Scott Hanselman&amp;#39;s blog'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-6976816361719522058</id><published>2007-08-08T20:30:00.001-07:00</published><updated>2007-08-08T20:30:12.753-07:00</updated><title type='text'>The Market is looking UP</title><content type='html'>Finally a day when we can look at our stock and smile.&amp;nbsp; This summer was a drag in the market but it's soon coming to an end.&amp;nbsp; A great story of what happened to me today.&amp;nbsp; I bought this stock FCSX for $52 and change, when it was only 23 cents up today.&amp;nbsp; The stock in just a few hours went up nearly 3 dollars so I sold it.&amp;nbsp; Literally like a minute after I sold it and I'm not exaggerating it dropped $5 in about 2 minutes.&amp;nbsp; Had I went to get a drink or something I would have been out a few hundred dollars.&amp;nbsp; What a day... &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-6976816361719522058?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/6976816361719522058/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=6976816361719522058' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6976816361719522058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6976816361719522058'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/08/market-is-looking-up.html' title='The Market is looking UP'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-3300068732403213240</id><published>2007-08-03T23:07:00.001-07:00</published><updated>2007-08-03T23:12:14.153-07:00</updated><title type='text'>A little extra for everyone</title><content type='html'>&lt;p&gt; &lt;p&gt;Ever try to bust a beer bottle with your bare hands only blowing the bottom of the bottle out.&amp;nbsp; I did it here in this clip so you can see how it is done.&lt;br /&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; No beer was waisted in the making of this movie.  Water is the liquid used.&lt;/p&gt; &lt;/p&gt; &lt;p&gt;&lt;embed src="http://www.youtube.com/v/JgZJaJphKOE" width="425" height="350" type="application/x-shockwave-flash" wmode="transparent"&gt;&lt;/embed&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-3300068732403213240?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/3300068732403213240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=3300068732403213240' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/3300068732403213240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/3300068732403213240'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/08/little-extra-for-everyone.html' title='A little extra for everyone'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-7321448761039341635</id><published>2007-08-03T22:23:00.001-07:00</published><updated>2007-08-03T23:34:40.212-07:00</updated><title type='text'>The Ultimate Grid for ASP.NET</title><content type='html'>All of&amp;nbsp;you ASP.NET developers out there I have a grid of choice for you.&amp;nbsp; After using &lt;a href="http://www.devexpress.com/Products/NET/WebForms/ASPxGridView/" target="_blank"&gt;DevExpress's&lt;/a&gt; ASP.NET Grid Control I am sold.&amp;nbsp; This grid does it all and with little effort.&amp;nbsp; If your looking for a grid component either web or winforms I highly recommend this product.&amp;nbsp; Its the next best thing since automobiles... :)&amp;nbsp; And no I don't get any handouts from any the companies products I recommend.&amp;nbsp; I&amp;nbsp;inform you on great tools I use daily&amp;nbsp;and hope they make your life as easy as they have made mine.  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-7321448761039341635?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/7321448761039341635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=7321448761039341635' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/7321448761039341635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/7321448761039341635'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/08/ultimate-grid-for-aspnet.html' title='The Ultimate Grid for ASP.NET'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-7007424170415764595</id><published>2007-08-03T21:52:00.001-07:00</published><updated>2007-08-03T22:05:56.196-07:00</updated><title type='text'>Raising the bar for E-commerce Solutions</title><content type='html'>&lt;p&gt;Imagine your e-commerce site out of the box with a nice customizable theme suitable to fit your sites needs.&amp;nbsp; Now imagine that same site with the capability to drag and drop a shopping cart, a price module, a user account module, or a payment gateway to name a few&amp;nbsp;without writing a line of code onto your live site and it working.&amp;nbsp; Take all this and throw in a QA process that allows you to funnel your site changes through a flow of sign-offs before it can be published as a live change with the ability to save as a draft until the final sign-off.&amp;nbsp; Now take a strong back-end with a built-in CMS that gives you full control of your e-commerce site without having to write a line of code.&amp;nbsp; And finally, throw in an IS layer that communicates with Microsoft Dynamics and you have &lt;a href="http://www.mediachase.com" target="_blank"&gt;Mediachase's&lt;/a&gt; ECF 5.0.&amp;nbsp;&amp;nbsp;&lt;a href="http://www.mediachase.com" target="_blank"&gt;Mediachase&lt;/a&gt; is the&amp;nbsp;leader of e-commerce solutions for the .NET Framework.&amp;nbsp;&amp;nbsp;This release is not yet available and is&amp;nbsp;scheduled for&amp;nbsp;the beginning of next year 2008.&amp;nbsp; This will be a must have&amp;nbsp;if you want&amp;nbsp;a stable e-commerce site up and running that you can&amp;nbsp;trust and depend on today as well as tomorrow.&amp;nbsp; &lt;/p&gt; &lt;script src="http://www.google-analytics.com/urchin.js" type="text/javascript"&gt;&lt;br /&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt;&lt;br /&gt;_uacct = "UA-952668-2";&lt;br /&gt;urchinTracker();&lt;br /&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-7007424170415764595?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/7007424170415764595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=7007424170415764595' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/7007424170415764595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/7007424170415764595'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/08/raising-bar-for-e-commerce-solutions.html' title='Raising the bar for E-commerce Solutions'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-3315754883466148611</id><published>2007-08-03T21:28:00.001-07:00</published><updated>2007-08-03T22:03:20.414-07:00</updated><title type='text'>Stock Market Goes down yet again</title><content type='html'>Another day with the market down on behalf of our friendly mortgages and banks.&amp;nbsp; With the anticipation of VMWare going into IPO August 14th 2007 the best buy is of course the parent company of which will receive a lot of attention EMC.&amp;nbsp; EMC owns around 93% of VMWare with the backing of Cisco and Intel.&amp;nbsp; The suspense to make some good money soon is about to materialize.&amp;nbsp; Happy Trading!! &lt;p&gt;&lt;script src="http://www.google-analytics.com/urchin.js" type="text/javascript"&gt;&lt;br /&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt;&lt;br /&gt;_uacct = "UA-952668-2";&lt;br /&gt;urchinTracker();&lt;br /&gt;&lt;/script&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-3315754883466148611?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/3315754883466148611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=3315754883466148611' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/3315754883466148611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/3315754883466148611'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/08/stock-market-goes-down-yet-again.html' title='Stock Market Goes down yet again'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-7779769111676241728</id><published>2007-07-26T12:48:00.001-07:00</published><updated>2007-08-03T22:58:00.156-07:00</updated><title type='text'>Using our Task we built earlier</title><content type='html'>&lt;table style="width: 403px; height: 448px" cellspacing="0" cellpadding="2" border="0" unselectable="on"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td valign="top" width="400"&gt; &lt;p&gt;Using our Task we built in Automating your Team Builds with Team Foundation Server we are now going to configure it within the build project file. To start off we need to reference the compiled dll.&lt;/p&gt;&lt;pre class="csharpcode"&gt;&amp;lt;UsingTask TaskName=&lt;span class="str"&gt;"Microsoft.Sdc.Tasks.File.Execute"&lt;/span&gt;&lt;br&gt;AssemblyFile=&lt;span class="str"&gt;"C:\TaskBuilds\Microsoft.Sdc.Tasks.dll"&lt;/span&gt; /&amp;gt;&lt;br&gt;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;Lets say after the source is compiled you are now ready to execute an external application you wrote to configure an Web Site or something using the compiled output code you could do something like this:&lt;/p&gt;&lt;br&gt;&lt;br&gt;&lt;pre class="csharpcode"&gt;&amp;lt;Target Name=&lt;span class="str"&gt;"AfterCompile"&lt;/span&gt;&amp;gt;&lt;br&gt;&amp;lt;File.Execute TreatErrorsAsWarnings=&lt;span class="str"&gt;"true"&lt;/span&gt;&lt;br&gt;File=&lt;span class="str"&gt;"C:\MyFilePath\myfile.exe"&lt;/span&gt;&lt;br&gt;CommandLineArgs=&lt;span class="str"&gt;"-ws $(BinariesRoot)"&lt;/span&gt; /&amp;gt;&lt;br&gt;&amp;lt;/Target&amp;gt;&lt;/pre&gt;&lt;pre class="csharpcode"&gt;Here the MSBUILD engine will call your File.Execute method&lt;br&gt;after it has finished compiling the solution.&lt;/pre&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-7779769111676241728?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/7779769111676241728/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=7779769111676241728' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/7779769111676241728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/7779769111676241728'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/07/configuring-your-customized-task-within.html' title='Using our Task we built earlier'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-1152187048444097333</id><published>2007-07-26T12:47:00.001-07:00</published><updated>2007-08-03T22:58:46.029-07:00</updated><title type='text'>Automating your builds in TFS</title><content type='html'>&lt;p&gt;In development we consistently try to find ways to make our processes faster and more useful. As for deployment and test builds, Team Foundation Server has made it easy to automate your builds by use of Tasks performed within a build project. Developers can build classes implementing the &lt;a href="http://msbuildtasks.tigris.org/" target="_blank"&gt;Microsoft.Sdc.Tasks.TaskBase&lt;/a&gt; class (derived from Microsoft.Build.Utilities.Task) which has an overrided method named InternalExecute. As a short example to the powerful uses of this class I will demonstrate writing your own class that will handle executing an external application. &lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;In this demonstration I will be using Micsoft.Sdc.Tasks source project to add my class. &lt;/p&gt; &lt;p&gt;&lt;/p&gt;First we need to create a class, I am doing so in the File folder as this pertains to files and System.IO. I will name this class Execute. Add the basic namespaces we will need:  &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;br&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Xml;&lt;br&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Globalization;&lt;br&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.IO;&lt;br&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.Build.Framework;&lt;br&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections;&lt;br&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Diagnostics;&lt;/pre&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Execute : TaskBase&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br&gt;&lt;pre class="csharpcode"&gt;We might want to add a property that allows us to&lt;br&gt;specify if an error occurs to treat it as a warning and move on.&lt;/pre&gt;&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span class="rem"&gt;/// If TRUE any errors will be logged as warnings&lt;/span&gt;&lt;br&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; TreatErrorsAsWarnings&lt;br&gt;{&lt;br&gt;get { &lt;span class="kwrd"&gt;return&lt;/span&gt; treatErrorsAsWarnings; }&lt;br&gt;set { treatErrorsAsWarnings = &lt;span class="kwrd"&gt;value&lt;/span&gt;; }&lt;br&gt;}&lt;/pre&gt;&lt;pre class="csharpcode"&gt;And of course we need Command Line Arguments:&lt;/pre&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; _CommandLineArgs;&lt;br&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; CommandLineArgs&lt;br&gt;{&lt;br&gt;get&lt;br&gt;{&lt;br&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; _CommandLineArgs;&lt;br&gt;}&lt;br&gt;set&lt;br&gt;{&lt;br&gt;_CommandLineArgs = &lt;span class="kwrd"&gt;value&lt;/span&gt;;&lt;br&gt;}&lt;br&gt;}&lt;/pre&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; ITaskItem file;&lt;br&gt;&lt;br&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span class="rem"&gt;/// The file to be Executed&lt;/span&gt;&lt;br&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span class="rem"&gt;/// &amp;lt;value&amp;gt;An ITaskItem of file&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;br&gt;[Required]&lt;br&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; ITaskItem File&lt;br&gt;{&lt;br&gt;get { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;.file; }&lt;br&gt;set { &lt;span class="kwrd"&gt;this&lt;/span&gt;.file = &lt;span class="kwrd"&gt;value&lt;/span&gt;; }&lt;br&gt;}&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br&gt;&lt;pre class="csharpcode"&gt;Now we need to override the Internal Execute method&lt;br&gt;so our code is called from the MSBUILD.&lt;/pre&gt;&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span class="rem"&gt;/// Performs the action of this task.&lt;/span&gt;&lt;br&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; InternalExecute()&lt;br&gt;{&lt;br&gt;&lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;br&gt;{&lt;br&gt;   &lt;span class="kwrd"&gt;if&lt;/span&gt; (System.IO.File.Exists(File.ItemSpec))&lt;br&gt;   {&lt;br&gt;       &lt;span class="rem"&gt;// Display the File we are about to execute&lt;/span&gt;&lt;br&gt;       &lt;span class="kwrd"&gt;base&lt;/span&gt;.Log.LogMessage(&lt;span class="str"&gt;"Executing File - "&lt;/span&gt; +&lt;br&gt;File.ItemSpec + &lt;span class="str"&gt;"\rCommand Line Args - "&lt;/span&gt;+CommandLineArgs);&lt;br&gt;      &lt;span class="rem"&gt;// Setup our startup information&lt;/span&gt;&lt;br&gt;       ProcessStartInfo psi = &lt;span class="kwrd"&gt;new&lt;/span&gt; ProcessStartInfo();&lt;br&gt;       &lt;span class="kwrd"&gt;string&lt;/span&gt;[] args = CommandLineArgs.Split(&lt;span class="str"&gt;' '&lt;/span&gt;);&lt;br&gt;&lt;br&gt;       &lt;span class="rem"&gt;// Retrieve the arguments&lt;/span&gt;&lt;br&gt;       &lt;span class="kwrd"&gt;if&lt;/span&gt; (args.Length &amp;gt; 0)&lt;br&gt;       {&lt;br&gt;           args[0] = &lt;span class="str"&gt;"\""&lt;/span&gt; + args[0] + &lt;span class="str"&gt;"\""&lt;/span&gt;;&lt;br&gt;           &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt; str &lt;span class="kwrd"&gt;in&lt;/span&gt; args)&lt;br&gt;           {&lt;br&gt;               CommandLineArgs = str + &lt;span class="str"&gt;" "&lt;/span&gt;;&lt;br&gt;           }&lt;br&gt;&lt;br&gt;            CommandLineArgs = CommandLineArgs.TrimEnd(&lt;span class="str"&gt;' '&lt;/span&gt;);&lt;br&gt;       }&lt;br&gt;       &lt;span class="rem"&gt;// Execute&lt;/span&gt;&lt;br&gt;       psi.FileName = File.ItemSpec;&lt;br&gt;       psi.Arguments = CommandLineArgs;&lt;br&gt;       Process.Start(psi);&lt;br&gt;   }&lt;br&gt;   &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br&gt;   {&lt;br&gt;       &lt;span class="kwrd"&gt;if&lt;/span&gt; (!TreatErrorsAsWarnings)&lt;br&gt;           &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt;&lt;br&gt;FileNotFoundException(&lt;span class="str"&gt;"File does not exists - "&lt;/span&gt; + File.ItemSpec);&lt;br&gt;       &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br&gt;           &lt;span class="kwrd"&gt;base&lt;/span&gt;.Log.LogWarning(&lt;span class="str"&gt;"File does not exists - "&lt;/span&gt; +&lt;br&gt;File.ItemSpec);&lt;br&gt;   }&lt;br&gt; &lt;br&gt;}&lt;br&gt;&lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)&lt;br&gt;{&lt;br&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (TreatErrorsAsWarnings)&lt;br&gt;   {&lt;br&gt;        Utilities.RethrowUnlessFileIO(ex);&lt;br&gt;   }&lt;/pre&gt;&lt;pre class="csharpcode"&gt;&lt;br&gt;&lt;span class="kwrd"&gt;         this&lt;/span&gt;.LogError(File, ex);         &lt;/pre&gt;&lt;pre class="csharpcode"&gt;    }&lt;br&gt;}&lt;/pre&gt;&lt;pre class="csharpcode"&gt;&lt;p&gt;Now we have a class we can use to execute external files within&lt;br&gt;our team build. Notice the CommandLineArgs is expecting the&lt;br&gt;argument to be separated using the standard spacing (CHAR 32).&lt;br&gt;You can customize this to use commas or semicolons if you like.&lt;br&gt;Compile the Microsoft.Sdc.Tasks project and copy the dll to your team&lt;br&gt;server in the location you are keeping your automated build files.&lt;br&gt;To configure look out for Configuring your Customized Task in this blog.&lt;/p&gt;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-1152187048444097333?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/1152187048444097333/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=1152187048444097333' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/1152187048444097333'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/1152187048444097333'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/07/automating-your-team-builds-with-team.html' title='Automating your builds in TFS'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-5962409797420599608</id><published>2007-04-08T16:24:00.001-07:00</published><updated>2007-04-08T16:24:37.626-07:00</updated><title type='text'>Happy Easter</title><content type='html'>&lt;p&gt;Today is the day Christ has risen according to scripture.&amp;nbsp; I just wanted to post a very happy and blessed Easter to all.&amp;nbsp; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-5962409797420599608?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/5962409797420599608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=5962409797420599608' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/5962409797420599608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/5962409797420599608'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/04/happy-easter.html' title='Happy Easter'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-936241597892203836</id><published>2007-04-06T12:01:00.001-07:00</published><updated>2007-04-06T12:21:29.428-07:00</updated><title type='text'>Programming for Microsoft Dynamics (Navision)</title><content type='html'>&lt;div class="Section1"&gt; &lt;p class="MsoNormal" style="background: #f7f0e9; margin-bottom: 0pt; line-height: 16.8pt"&gt;&lt;span style="font-size: 12pt; color: #4b6320; font-family: 'Helvetica','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;Navision as we all know is very powerful with a very robust architecture.&amp;nbsp; The application allows you to add, edit, and design your own table and forms as well as reports.&amp;nbsp; The only problem is connecting to dynamics with your own application and retrieving data from it.&amp;nbsp; &lt;a href="http://www.westerncomputer.com/" target="_blank"&gt;&lt;b&gt;Western Computer&lt;/b&gt;&lt;/a&gt; an Oxnard, CA based company developed their admiral program named Fusion which breaks the barriers of connecting to Navision from within your .NET applications.&amp;nbsp; The company wrote a client they called the &lt;span class="SpellE"&gt;QueryLanguage&lt;/span&gt; to communicate with Fusion and push or pull data to Navision.&amp;nbsp; An example code snippet would look like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="background: #f7f0e9; margin-bottom: 0pt; line-height: 16.8pt"&gt;&lt;span style="font-size: 12pt; color: #4b6320; font-family: 'Helvetica','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 12pt; color: #4b6320; font-family: 'Helvetica','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt; &lt;span style="color: #2b91af"&gt;DataSet&lt;/span&gt; GetProfessionalAffiliations()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataSet&lt;/span&gt; ds &lt;span style="color: red"&gt;=&lt;/span&gt; &lt;span style="color: blue"&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;span style="color: #2b91af"&gt;QueryGroup&lt;/span&gt; queryGroup &lt;span style="color: red"&gt;=&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;QueryGroup&lt;/span&gt;(&lt;span style="color: blue"&gt;true&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;span style="color: #2b91af"&gt;Query&lt;/span&gt; query &lt;span style="color: red"&gt;=&lt;/span&gt; queryGroup&lt;span style="color: red"&gt;.&lt;/span&gt;NewQuery(&lt;span style="color: green"&gt;"ProAffiliation"&lt;/span&gt;, &lt;span style="color: green"&gt;"Professional Affiliation"&lt;/span&gt;, WesternComputer&lt;span style="color: red"&gt;.&lt;/span&gt;Fusion&lt;span style="color: red"&gt;.&lt;/span&gt;QueryLanguage&lt;span style="color: red"&gt;.&lt;/span&gt;&lt;span style="color: #2b91af"&gt;CommandType&lt;/span&gt;&lt;span style="color: red"&gt;.&lt;/span&gt;Select);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;#region&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt; Set Columns&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;query&lt;span style="color: red"&gt;.&lt;/span&gt;Columns&lt;span style="color: red"&gt;.&lt;/span&gt;Add(&lt;span style="color: green"&gt;"Code"&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;query&lt;span style="color: red"&gt;.&lt;/span&gt;Columns&lt;span style="color: red"&gt;.&lt;/span&gt;Add(&lt;span style="color: green"&gt;"Description"&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;#endregion&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;// Execute query&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;ds &lt;span style="color: red"&gt;=&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;&lt;span style="color: red"&gt;.&lt;/span&gt;Gateway&lt;span style="color: red"&gt;.&lt;/span&gt;ExecuteXmlToDataSet(queryGroup&lt;span style="color: red"&gt;.&lt;/span&gt;ToXml());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;// Check for Errors&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; strMessage &lt;span style="color: red"&gt;=&lt;/span&gt; &lt;span style="color: green"&gt;""&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;&lt;span style="color: red"&gt;.&lt;/span&gt;HasErrors(ds, &lt;span style="color: blue"&gt;out&lt;/span&gt; strMessage))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Exception&lt;/span&gt;(strMessage);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; ds;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="background: #f7f0e9; margin-bottom: 0pt; line-height: 16.8pt"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; color: #4b6320; font-family: 'Helvetica','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br&gt; &lt;p class="MsoNormal" style="background: #f7f0e9; margin-bottom: 5.25pt; line-height: 16.8pt"&gt;&lt;span style="font-size: 12pt; color: #4b6320; font-family: 'Helvetica','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;This simple query would go out to the &lt;span class="SpellE"&gt;FusionGateway&lt;/span&gt; (Web Service) and pull down the Professional Affiliation table records with the Code and Description Columns.&amp;nbsp;&amp;nbsp;If any errors occurred&amp;nbsp;in your query or on the&amp;nbsp;Navision side a table is returned with &lt;span class="SpellE"&gt;TableName&lt;/span&gt; &lt;span class="SpellE"&gt;Query#Error&lt;/span&gt;.&amp;nbsp; This table will hold all errors that occurred&amp;nbsp;so you can display them to the end user.&amp;nbsp; The best part, the error messages returned are the same error messages you are already accustomed to seeing in Navision.&amp;nbsp; They are Navision Error Messages.&amp;nbsp; The learning curve on this product is very low as it took &lt;span class="GramE"&gt;myself&lt;/span&gt; 2 weeks to get my first application for&amp;nbsp;Navision up&amp;nbsp;and running on a Mobile&amp;nbsp;Q device.&amp;nbsp; There are other features this provides such as &lt;span class="SpellE"&gt;StoredProcedure&lt;/span&gt; which will query a function written in Navision and return the result.&amp;nbsp; If you work with Navision then Fusion is a must have.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-936241597892203836?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/936241597892203836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=936241597892203836' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/936241597892203836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/936241597892203836'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/04/programming-for-microsoft-dynamics.html' title='Programming for Microsoft Dynamics (Navision)'/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-2175111369656604782</id><published>2007-03-09T16:20:00.000-08:00</published><updated>2007-03-09T16:36:15.292-08:00</updated><title type='text'></title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Implementing a Double Buffer&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;I recently had a project with the Motorola Q pulling data from a web service and displaying it in a graphical skin.  I ran into a problem with flickering when painting the new changes using GDI+.  To overcome this problem I set a Bitmap class up and painted to it then used the device graphics to paint the final image to the screen instead of painting to the screen directly.  To accomplish this simply create the back image like so:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Bitmap _backBuffer = null;&lt;br /&gt;&lt;br /&gt;private void Paint(object sender, PaintEventArgs e)&lt;br /&gt;{&lt;br /&gt;   if (_backBuffer == null)&lt;br /&gt;        _backBuffer = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;  using (Graphics g = Graphics.FromImage(_backBuffer))&lt;br /&gt;{&lt;br /&gt;g.Clear(Color.White);&lt;br /&gt;&lt;br /&gt;// Do your stuff here like paint the back image and any text&lt;br /&gt;g.DrawImage(MyImage, 0, 0);&lt;br /&gt;g.DrawString("My Text", myFont, new SolidBrush(Color.Blue), myRectangleF);&lt;br /&gt;}&lt;br /&gt;} finally&lt;br /&gt;{&lt;br /&gt;e.Graphics.DrawImage(_backBuffer, 0, 0);&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;This will prevent the flicker and load images nicely.  Also note when you make changes to the underlying dataset or collection or what ever you are using to hold the data you intend to paint make sure you call Invalidate to get the screen to paint again with the new changes.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-2175111369656604782?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/2175111369656604782/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=2175111369656604782' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/2175111369656604782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/2175111369656604782'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/03/implementing-double-buffer-i-recently.html' title=''/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-5085064227528167713</id><published>2007-02-13T22:21:00.000-08:00</published><updated>2007-02-13T22:24:57.546-08:00</updated><title type='text'></title><content type='html'>&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Coderush&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;One more note before closing tonight, if your not using Coderush or Refactor Pro!, get it now!!!&lt;br /&gt;These two combined will make your daily coding so much faster.  I use these everyday and when I work on someones box that doesnt have them, I feel like I have a handycap.  Mark Miller is the creator of this magnificant product formerly Eagle Software which I believe he now works for DevExpress which owns the product today.  Either way, get to DevExpress.com and purchase this fantastic product as it will make your coding fly...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-5085064227528167713?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/5085064227528167713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=5085064227528167713' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/5085064227528167713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/5085064227528167713'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/02/coderush-one-more-note-before-closing.html' title=''/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-6551618059531191669</id><published>2007-02-13T22:16:00.000-08:00</published><updated>2007-02-13T22:18:49.087-08:00</updated><title type='text'></title><content type='html'>&lt;strong&gt;Nice one Jason&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;After reading Jasons blog at &lt;a href="http://jasonf-blog.blogspot.com"&gt;http://jasonf-blog.blogspot.com&lt;/a&gt; I came across an interesting article to myself being a former WoW player as well as Star Craft (Brood War).  This type of mistake probably cost someone their job.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://jasonf-blog.blogspot.com/2007/01/wow-someone-messed-up.html"&gt;http://jasonf-blog.blogspot.com/2007/01/wow-someone-messed-up.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-6551618059531191669?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/6551618059531191669/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=6551618059531191669' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6551618059531191669'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/6551618059531191669'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/02/nice-one-jason-after-reading-jasons.html' title=''/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-2713777090239556608</id><published>2007-02-13T21:42:00.000-08:00</published><updated>2007-02-13T22:01:36.986-08:00</updated><title type='text'></title><content type='html'>&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Serial Port Usage&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;I had a project assigned to me reading information from a scanner and taking the information retrieved and converting the bytes to base64 and passing the base64 to a decoder which could take a USPS barcode in PDF-417 or DataMatrix and parse out its information into human readable information of all information contained within the barcode using an IBI Dictionary.  I cannot demonstrate all parts of the project but I would like to demonstrate gathering information from a port and converting it to base64.  This is rather simple and probably elementary for most developers.  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;First of all, you must create a serial port like so:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;SerialPort port = null;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;On Load of Form, or constructor do the following:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;port = new SerialPort(Port, 9600, Parity.None, 8, StopBits.One);&lt;br /&gt;port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;string Base64Scan = string.Empty;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;void port_DataReceived(object sender, SerialDataReceivedEventArgs e)        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;{            &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;byte[] buffer = new byte[port.BytesToRead];           &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;port.Read(buffer, 0, port.BytesToRead);       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;// Convert to Base64&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Base64Scan = Convert.ToBase64String(buffer);         &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;This is it, now some would say why even bother with such a simple blog.  The reason, I ran into a problem in the first phase of reading the information into a string using&lt;br /&gt;port.ReadExisting(); which caused a problem because the .NET encodation caused the results to be wrong.  When char 255 or FF was recieved, it was converted to char 63 or 3F.  By reading the bytes directly, the correct results were returned.  Hopefully this will help others that fall into this problem.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-2713777090239556608?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/2713777090239556608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=2713777090239556608' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/2713777090239556608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/2713777090239556608'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/02/serial-port-usage-i-had-project.html' title=''/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-3995241370118109207</id><published>2007-02-05T10:57:00.000-08:00</published><updated>2007-02-05T11:00:48.771-08:00</updated><title type='text'></title><content type='html'>Here is a snippet I put together on using UserName token with Web Services3.&lt;br /&gt;&lt;br /&gt;MyWebService myService = new MyWebService();&lt;br /&gt;// Create the policy&lt;br /&gt;Microsoft.Web.Services3.Design.Policy policy = new Microsoft.Web.Services3.Design.Policy();&lt;br /&gt;policy.Assertions.Add(new Microsoft.Web.Services3.Design.UsernameOverTransportAssertion());&lt;br /&gt;myService .SetPolicy(policy);&lt;br /&gt;myService.Url = &lt;a href="http://whatever%20the%20url%20is/"&gt;http://whatever the url is&lt;/a&gt;;&lt;br /&gt;UsernameToken token = new UsernameToken(username, password, PasswordOption.SendPlainText);&lt;br /&gt;ISecurityTokenManager securityTokenManager = SecurityTokenManager.GetSecurityTokenManagerByTokenType(WSTrust.TokenTypes.UsernameToken);&lt;br /&gt;securityTokenManager.CacheSecurityToken(token);&lt;br /&gt;myService.SetClientCredential(token);&lt;br /&gt;// If your service needs Credentials for connection pass something like this&lt;br /&gt;if (CredentialUserName.Length &gt; 0)&lt;br /&gt;{&lt;br /&gt;       System.Net.NetworkCredential cred = null;&lt;br /&gt;       // User Credentials&lt;br /&gt;       if (CredentialDomain.Trim().Length == 0)&lt;br /&gt;       cred = new System.Net.NetworkCredential(CredentialUserName, CredentialPassword);&lt;br /&gt;       else&lt;br /&gt;       cred = new System.Net.NetworkCredential(CredentialUserName, CredentialPassword,  CredentialDomain);&lt;br /&gt;      System.Net.CredentialCache credCache = new System.Net.CredentialCache();&lt;br /&gt;      credCache.Add(new Uri(myService.Url), "Basic", cred);&lt;br /&gt;      if (CredentialDomain.Trim().Length &gt; 0)&lt;br /&gt;      credCache.Add(new Uri(myService.Url), "Digest", cred);&lt;br /&gt;      credCache.Add(new Uri(myService.Url), "Negotiate", cred);&lt;br /&gt;      myService.Credentials = credCache;&lt;br /&gt;}&lt;br /&gt;// Now do your stuff&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-3995241370118109207?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/3995241370118109207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=3995241370118109207' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/3995241370118109207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/3995241370118109207'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2007/02/here-is-snippet-i-put-together-on-using.html' title=''/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-5719497375152961484</id><published>2006-11-29T15:52:00.000-08:00</published><updated>2006-11-29T16:13:04.122-08:00</updated><title type='text'></title><content type='html'>&lt;strong&gt;&lt;span style="font-size:130%;"&gt;The Commerce Market is on the rise&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;As eCommerce continues to grow with more and more users making online purchases many stores are due for an overhaul. We all know there are tons of commerce products out there and for .NET developers as well. For a strong product with &lt;a href="http://www.mediachase.com/documentation/ecfv4doc/ecf4_app_architecture.pdf" target="_blank"&gt;great architecture&lt;/a&gt; check out Mediachase's ECF product at &lt;a href="http://www.mediachase.com/ecf/overview.aspx" target="_blank"&gt;http://www.mediachase.com/ecf/overview.aspx&lt;/a&gt;. The ECF is designed on the .NET 2.0 framework and can be integrated within Dot Net Nuke. There is a &lt;a href="http://www.mediachase.com/ecf/galleryexamples.aspx" target="_blank"&gt;gallery section&lt;/a&gt; displaying the types of stores customers have created using the eCommerce Framework. The product is a three-tier application with SOA technology allowing companies to connect their stores to other systems.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-5719497375152961484?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/5719497375152961484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=5719497375152961484' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/5719497375152961484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/5719497375152961484'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2006/11/commerce-market-is-on-rise-as-ecommerce.html' title=''/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33814941.post-116379248794048995</id><published>2006-11-17T10:47:00.000-08:00</published><updated>2006-11-17T14:43:39.866-08:00</updated><title type='text'></title><content type='html'>&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Calculating the Expected Time Left in a Process&lt;/span&gt;&lt;span style="font-size:180%;"&gt; &lt;/span&gt;&lt;span style="font-size:130%;"&gt;In C#&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;At times we need to write a lengthy process that needs to keep the user informed of how much longer it will be running. You may be parsing a large file, uploading one or more files to an ftp site what ever the case the user needs to know the status. Not knowing what is happening in the process could lead the user to click cancel, terminate the process, or whatever one does when they think the application is locked up when in fact it is not.&lt;br /&gt;&lt;br /&gt;Calculating the remaining time left is actually pretty simple, lets take file upload as an example:&lt;br /&gt;&lt;br /&gt;Note: I'm not going to focus too much on the process of getting the byte counts and setting progress etc, this post is designed more on the calculation itself.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;First create a&lt;/span&gt; &lt;span style="color:#3366ff;"&gt;DateTime &lt;/span&gt;&lt;span style="color:#000000;"&gt;variable to hold our start time. (I will use &lt;span style="color:#6600cc;"&gt;&lt;span style="color:#3333ff;"&gt;blue&lt;/span&gt; &lt;/span&gt;to signify code)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;DateTime startedTime = DateTime.Now;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;Next, we need to keep track of the current progress, this is normally handled using a delegate and event allowing a thread to inform the app it is progressing.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It could look something like so:&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;public delegate void ProgressChanged(int CurrByte, int MaxByte);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;public event ProgressChanged OnProgressChanged;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;(Some Class)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;int MaxByte = GetByteCount(ourProcessedFile);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;(Some Loop uploading the file)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;CurrByte = stream.Read(byte[], 0, length);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;... do something&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;// Thread informs app of change&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;if (OnProgressChanged != null)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;OnProgressChanged(CurrByte, MaxByte);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;Ok so the thread has reported a change in progress, we must now calculate how much more time this is going to take. Remember at the start of the process we stored the &lt;span style="color:#3333ff;"&gt;DateTime&lt;/span&gt;&lt;span style="color:#000000;"&gt; which we are going to use in our calculation.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;First, Get how many seconds it has been&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;// Get Elapsed Time&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;TimeSpan timeSpan = DateTime.Now - startedTime;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;int intHours = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;int intMinutes = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;int intSeconds = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;int EstimatedTime = 0; // Holds total time in seconds&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;int ByteProcessTime = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;// Calculate how many bytes we are processing per second&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;ByteProcessTime = Convert.ToInt32(CurrByte / timeSpan.TotalSeconds);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;// Calculate how many seconds are remaining&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;EstimatedTime = Convert.ToInt32((MaxByte - CurrByte) / ByteProcessTime);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;EstimatedTime is excluding the bytes already processed (MaxByte - CurrByte) and dividing the total of remaining bytes by the number of bytes we can process a second. This results in the total time remaining in seconds. Now we need to make this more user friendly by covnerting this to Hours, Minutes, Seconds.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;// Get breakdown&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;if (EstimatedTime &gt; 60) // greater than 60 seconds&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;intMinutes = Convert.ToInt32(EstimatedTime / 60); // total minutes&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;intSeconds = Convert.ToInt32(EstimatedTime % 60); // additional seconds&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;if (intMinutes &gt; 60) // get hours&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;intHours = Convert.ToInt32(intMinutes / 60); // total hours&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;intMinutes = Convert.ToInt32(intMinutes % 60); // remaining minutes&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;} else&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;intSeconds = EstimatedTime; // less than a minute left&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;// Now format this for user display&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;string TimeFrameRemaining = string.Format("Estimated Time Remaining: {0:#0}:{1:#0}:{2:#0}", intHours, intMinutes, intSeconds);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;br /&gt;This sums it up, I started with minutes because it is easier to calculate minutes from seconds and hours from minutes. Using (%) to get the modulus of the remaining digits for complete accuracy of time left.&lt;br /&gt;&lt;span style="font-size:130%;color:#3333ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;script src="http://www.google-analytics.com/urchin.js" type="text/javascript"&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;_uacct = "UA-952668-1";&lt;br /&gt;urchinTracker();&lt;br /&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33814941-116379248794048995?l=garylcoxjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garylcoxjr.blogspot.com/feeds/116379248794048995/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33814941&amp;postID=116379248794048995' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/116379248794048995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33814941/posts/default/116379248794048995'/><link rel='alternate' type='text/html' href='http://garylcoxjr.blogspot.com/2006/11/calculating-expected-time-left-in.html' title=''/><author><name>Gary Cox</name><uri>http://www.blogger.com/profile/03577665333445043665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='http://3.bp.blogspot.com/_NzIAbPNs_0E/SoVayCDfotI/AAAAAAAAAxs/h2RW4pzAxo4/S220/n1456459651_4848.jpg'/></author><thr:total>0</thr:total></entry></feed>
