<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" version="2.0">
  <channel>
    <title>Jim Zimmerman - ASP.NET, MVC, Ajax and ORM</title>
    <link>http://www.jimzimmerman.com/blog/</link>
    <description>Web Development Jornal</description>
    <language>en-us</language>
    <copyright>Jim Zimmerman</copyright>
    <lastBuildDate>Fri, 10 Jul 2009 04:38:52 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.9.6264.0</generator>
    <managingEditor>jim@jimzimmerman.com</managingEditor>
    <webMaster>jim@jimzimmerman.com</webMaster>
    <geo:lat>28.143377</geo:lat><geo:long>-82.590545</geo:long><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/JimZimmerman" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
      <trackback:ping>http://www.jimzimmerman.com/blog/Trackback.aspx?guid=75241bbd-f11c-4209-bca7-5a7f288a6a7f</trackback:ping>
      <pingback:server>http://www.jimzimmerman.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jimzimmerman.com/blog/PermaLink,guid,75241bbd-f11c-4209-bca7-5a7f288a6a7f.aspx</pingback:target>
      <dc:creator>Jim Zimmerman</dc:creator>
      <wfw:comment>http://www.jimzimmerman.com/blog/CommentView,guid,75241bbd-f11c-4209-bca7-5a7f288a6a7f.aspx</wfw:comment>
      <wfw:commentRss>http://www.jimzimmerman.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=75241bbd-f11c-4209-bca7-5a7f288a6a7f</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>IEnumerable Extension Method for AutoMapper</title>
      <guid isPermaLink="false">http://www.jimzimmerman.com/blog/PermaLink,guid,75241bbd-f11c-4209-bca7-5a7f288a6a7f.aspx</guid>
      <link>http://www.jimzimmerman.com/blog/2009/07/10/IEnumerable+Extension+Method+For+AutoMapper.aspx</link>
      <pubDate>Fri, 10 Jul 2009 04:38:52 GMT</pubDate>
      <description>&lt;p&gt;
I have been using &lt;a href="http://code.google.com/p/automapperhome/"&gt;AutoMapper&lt;/a&gt; for
a few projects lately and just love its power and ease of use. My projects have become
not only simpler to manage, but easier to do the right thing. What I mean by right
thing, is creating ViewModels and Domain objects in my ASP.NET MVC projects. Although
it seems like extra work to create multiple classes that seem to do what seems like
the same thing, down the road it is a much better way to do things because of maintainability
of views and domain logic not interfering. I am not going to get into the reason you
would do this, but you can find out more &lt;a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/06/29/how-we-do-mvc-view-models.aspx"&gt;here&lt;/a&gt;.
Jimmy Bogard has a great article here as to why ViewModels are so important.
&lt;/p&gt;
&lt;p&gt;
Sometimes when you do not want to have to create your maps ahead of time, it can be
useful to use an extension method on IEnumerable which will work with IQueryable and
any other Interface that implements IEnumerable . 
&lt;/p&gt;
&lt;p&gt;
An example is to map a complex query to a complex domain model. For instance, lets
say I want to do a complicated db query using linq:
&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;q = &lt;span style="color: blue"&gt;from &lt;/span&gt;c &lt;span style="color: blue"&gt;in &lt;/span&gt;db.Customers &lt;span style="color: blue"&gt;select
new &lt;/span&gt;{ c.CompanyName, c.ContactName, Orders = (&lt;span style="color: blue"&gt;from &lt;/span&gt;order &lt;span style="color: blue"&gt;in &lt;/span&gt;db.Orders &lt;span style="color: blue"&gt;where &lt;/span&gt;order.CustomerID
== c.CustomerID &lt;span style="color: blue"&gt;select &lt;/span&gt;order) }; &lt;span style="color: #2b91af"&gt;AutoMapperHelper&lt;/span&gt;&lt;&lt;span style="color: #2b91af"&gt;.TryCreateMapOrder&gt;, &lt;span style="color: #2b91af"&gt;MyOrder&lt;/span&gt;&gt;(); &lt;span style="color: blue"&gt;var &lt;/span&gt;&lt;&lt;span style="color: #2b91af"&gt;a
= q.ToModelListComplexCustomer&gt;&gt;();&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; 
&lt;p&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;And here is the ComplexCustomer class
that AutoMapper maps to:
&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ComplexCustomer &lt;/span&gt;{ &lt;span style="color: blue"&gt;public
string &lt;/span&gt;CompanyName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;;
} &lt;span style="color: blue"&gt;public string &lt;/span&gt;ContactName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;;
} &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&lt;&lt;span style="color: #2b91af"&gt;MyOrder&gt;&gt;
Orders { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;;
} }&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; 
&lt;p&gt;
Notice the extension Method: ToModelList&lt;T&gt;
(). This will execute the query to a list then automap it dynamically to the anonymous
type or a defined type. 
&lt;/p&gt;
&lt;p&gt;
Here are the extension methods:
&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public static class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IEnumerableExtensions &lt;/span&gt;{ &lt;span style="color: blue"&gt;public
static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IList&lt;/span&gt;
&lt;TDestination&gt;
ToModelList&lt;TDestination&gt;
(&lt;span style="color: blue"&gt;this &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IEnumerable &lt;/span&gt;query)
{ &lt;span style="color: blue"&gt;try &lt;/span&gt;{ &lt;span style="color: blue"&gt;var &lt;/span&gt;output
= &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;
&lt;TDestination&gt;
(); &lt;span style="color: blue"&gt;var &lt;/span&gt;sourceType = query.GetType().GetGenericArguments()[0]; &lt;span style="color: blue"&gt;var &lt;/span&gt;destType
= output.GetType().GetGenericArguments()[0]; &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: blue"&gt;var &lt;/span&gt;src &lt;span style="color: blue"&gt;in &lt;/span&gt;query)
{ &lt;span style="color: blue"&gt;var &lt;/span&gt;mySrc = &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.DynamicMap(src,
sourceType, destType); output.Add(&lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.DynamicMap&lt;TDestination&gt;
(mySrc)); } &lt;span style="color: blue"&gt;return &lt;/span&gt;output; } &lt;span style="color: blue"&gt;catch &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Exception &lt;/span&gt;ex)
{ &lt;span style="color: blue"&gt;throw &lt;/span&gt;ex; } }&lt;br&gt;
&lt;span style="color: blue"&gt; public static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IList&lt;/span&gt;
&lt;TDestination&gt;&lt;TSource, TDestination&gt;
ToModelList(&lt;span style="color: blue"&gt;this &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;
&lt;TSource&gt;
query) { &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;
&lt;TDestination&gt;
output = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;
&lt;TDestination&gt;
(); &lt;span style="color: #2b91af"&gt;AutoMapperHelper&lt;/span&gt;&lt;TSource, TDestination&gt;.TryCreateMap(); &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: blue"&gt;var &lt;/span&gt;src &lt;span style="color: blue"&gt;in &lt;/span&gt;query.ToList())
{ output.Add(&lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;&lt;TSource, TDestination&gt;.Map(src));
} &lt;span style="color: blue"&gt;return &lt;/span&gt;output; } 
&lt;br&gt;
}
&lt;/pre&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue"&gt; public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;AutoMapperHelper &lt;/span&gt;{ &lt;span style="color: blue"&gt;public
static bool &lt;/span&gt;&lt;TSource, TDestination&gt;TryCreateMap() { &lt;span style="color: blue"&gt;var &lt;/span&gt;tm
= &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;&lt;TSource, TDestination&gt;.FindTypeMapFor(); &lt;span style="color: blue"&gt;if &lt;/span&gt;(tm
== &lt;span style="color: blue"&gt;null&lt;/span&gt;) { &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;&lt;TSource, TDestination&gt;.CreateMap(); &lt;span style="color: blue"&gt;return
true&lt;/span&gt;; } &lt;span style="color: blue"&gt;return false&lt;/span&gt;; } 
&lt;br&gt;
} &lt;/pre&gt;
&gt; 
&lt;p&gt;
There are two ways to use this extension, one is to tell the extension both the source
and destination generic classes or just pass in the destination and it will use dynamic
mapping to figure out what the source is. Notice that there also is a AutoMapperHelper
class which helps to find out if the map you want is already in memory since AutoMapper
stores the maps statically. We found that by not doing this it created a performance
issue.
&lt;/p&gt;
&lt;p&gt;
All in all, we are loving AutoMapper and I hope that others find this extension very
useful. I have already used it with SubSonic 3, EF 4 and Action Filter Atrributes
in an ASP.NET MVC Project.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.jimzimmerman.com/blog/aggbug.ashx?id=75241bbd-f11c-4209-bca7-5a7f288a6a7f" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=n53Qpn_BWtE:CVXebkEboto:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=n53Qpn_BWtE:CVXebkEboto:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=n53Qpn_BWtE:CVXebkEboto:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=n53Qpn_BWtE:CVXebkEboto:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?i=n53Qpn_BWtE:CVXebkEboto:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.jimzimmerman.com/blog/CommentView,guid,75241bbd-f11c-4209-bca7-5a7f288a6a7f.aspx</comments>
      <category>ASP.NET MVC;ORM;AutoMapper</category>
    </item>
    <item>
      <trackback:ping>http://www.jimzimmerman.com/blog/Trackback.aspx?guid=30684462-528b-43a2-b61b-6abb8af24a69</trackback:ping>
      <pingback:server>http://www.jimzimmerman.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jimzimmerman.com/blog/PermaLink,guid,30684462-528b-43a2-b61b-6abb8af24a69.aspx</pingback:target>
      <dc:creator>Jim Zimmerman</dc:creator>
      <wfw:comment>http://www.jimzimmerman.com/blog/CommentView,guid,30684462-528b-43a2-b61b-6abb8af24a69.aspx</wfw:comment>
      <wfw:commentRss>http://www.jimzimmerman.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=30684462-528b-43a2-b61b-6abb8af24a69</wfw:commentRss>
      <slash:comments>1</slash:comments>
      
      <title>Entity Framework and Creating a Reusable Abstraction</title>
      <guid isPermaLink="false">http://www.jimzimmerman.com/blog/PermaLink,guid,30684462-528b-43a2-b61b-6abb8af24a69.aspx</guid>
      <link>http://www.jimzimmerman.com/blog/2009/05/18/Entity+Framework+And+Creating+A+Reusable+Abstraction.aspx</link>
      <pubDate>Mon, 18 May 2009 00:39:27 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
I am currently working on an open source project called &lt;a href="http://mycodecamp.codeplex.com/" target="_blank"&gt;MyCodeCamp&lt;/a&gt; with &lt;a href="http://www.lostechies.com/blogs/sean_chambers/" target="_blank"&gt;Sean&#xD;
Chambers&lt;/a&gt;, &lt;a href="http://twitter.com/fabiousa7" target="_blank"&gt;Fabio Honigmann&lt;/a&gt;,&#xD;
and &lt;a href="http://estebanfg.blogspot.com/" target="_blank"&gt;Esteban Garcia&lt;/a&gt;. &#xD;
We decided to use ASP.NET MVC and Entity Framework (EF).  Although I use &lt;a href="http://code.google.com/p/subsonicproject/downloads/list" target="_blank"&gt;SubSonic&#xD;
2.2&lt;/a&gt; and 3 beta at work, I thought this might be a good time to learn other ORM&#xD;
type frameworks for comparison. I have used &lt;a href="http://msdn.microsoft.com/en-us/library/bb425822.aspx" target="_blank"&gt;LINQ&#xD;
To SQL&lt;/a&gt; and &lt;a href="https://www.hibernate.org/343.html" target="_blank"&gt;NHibernate&lt;/a&gt; a&#xD;
little also, but am not an expert by any means.  And since we want this project&#xD;
to be accessible to as many as possible, we thought Entity Framework would be a good&#xD;
choice seeing as Linq2Sql is getting folded into Entity Framework anyway.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
So, I don’t really know how most people use EF, but coming from working on SubSonic&#xD;
3, I have some habits that I would like to keep, particularly, using a Repository&amp;lt;T&amp;gt;&#xD;
like pattern.  After looking at all the code and classes I would have to write&#xD;
if I did the traditional, IClassRepository and ClassRepository, I decided to make&#xD;
Repository&amp;lt;T&amp;gt; work kind of like it does in SubSonic 3 with SubSonicRepository&amp;lt;T&amp;gt;. &#xD;
This was not as easy as I thought.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
First problem is when you want to update the model, you need to open up the .edmx&#xD;
file in the designer which sometimes does not open and you have to reboot Visual Studio. &#xD;
And if you make major changes to your data model, you are better off deleting the&#xD;
file and recreating it.  Now I don’t think that would go over to well if you&#xD;
actually used it to do your mappings of data to entity models, but I am not using&#xD;
Entity Framework that way.  I think it was their intention to use it more of&#xD;
as a mapper, but I think I have found a much easier and scalable way of mapping data&#xD;
to domain objects by using &lt;a href="http://automapper.codeplex.com/" target="_blank"&gt;AutoMapper&lt;/a&gt;. &#xD;
We use AutoMapper at work with SubSonic 3 and we just love it.  I won’t go into&#xD;
everything it does, but it is by far the best project out there for mapping objects&#xD;
to other objects.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
So here is an example of how I am getting an entity object, then mapping it to a domain&#xD;
object.&#xD;
&lt;/p&gt;&#xD;
        &lt;pre class="code"&gt;&#xD;
          &lt;span style="color: blue"&gt;public class &lt;/span&gt;&#xD;
          &lt;span style="color: #2b91af"&gt;Repository&lt;/span&gt;&amp;lt;T&amp;gt;&#xD;
: &lt;span style="color: #2b91af"&gt;IRepository&lt;/span&gt;&amp;lt;T&amp;gt; { &lt;span style="color: blue"&gt;private &lt;/span&gt;MyCodeCamp.Data.&lt;span style="color: #2b91af"&gt;MyCodeCampEntities &lt;/span&gt;context; &lt;span style="color: blue"&gt;public &lt;/span&gt;Repository()&#xD;
{ context = &lt;span style="color: blue"&gt;new &lt;/span&gt;MyCodeCamp.Data.&lt;span style="color: #2b91af"&gt;MyCodeCampEntities&lt;/span&gt;();&#xD;
} &lt;span style="color: blue"&gt;public &lt;/span&gt;T GetById(&lt;span style="color: #2b91af"&gt;Int32 &lt;/span&gt;id)&#xD;
{ &lt;span style="color: blue"&gt;var &lt;/span&gt;tableName = &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(T).Name; &lt;span style="color: blue"&gt;var &lt;/span&gt;key&#xD;
= &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;EntityKey&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"MyCodeCampEntities." &lt;/span&gt;+&#xD;
tableName, &lt;span style="color: #a31515"&gt;"Id"&lt;/span&gt;, id); &lt;span style="color: blue"&gt;var &lt;/span&gt;r&#xD;
= (T)context.GetObjectByKey(key); &lt;span style="color: blue"&gt;return &lt;/span&gt;r; } }&lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
Notice, since I am using T, I need to use reflection to get the Entity Name, or table&#xD;
name.  Then this data returns to a BaseService&amp;lt;TModel, T&amp;gt;&#xD;
&lt;/p&gt;&#xD;
        &lt;a href="http://11011.net/software/vspaste"&gt;&#xD;
        &lt;/a&gt;&#xD;
        &lt;pre class="code"&gt;&#xD;
          &lt;span style="color: blue"&gt;using &lt;/span&gt;System; &lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic; &lt;span style="color: blue"&gt;using &lt;/span&gt;System.Linq; &lt;span style="color: blue"&gt;using &lt;/span&gt;System.Text; &lt;span style="color: blue"&gt;using &lt;/span&gt;AutoMapper; &lt;span style="color: blue"&gt;using &lt;/span&gt;MyCodeCamp.Data; &lt;span style="color: blue"&gt;namespace &lt;/span&gt;MyCodeCamp.Domain.Services&#xD;
{ &lt;span style="color: blue"&gt;public abstract class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;BaseService&lt;/span&gt;&amp;lt;TModel,&#xD;
T&amp;gt; &lt;span style="color: blue"&gt;where &lt;/span&gt;TModel : &lt;span style="color: blue"&gt;new&lt;/span&gt;() &lt;span style="color: blue"&gt;where &lt;/span&gt;T&#xD;
: &lt;span style="color: blue"&gt;new&lt;/span&gt;() { &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Repository&lt;/span&gt;&amp;lt;T&amp;gt;&#xD;
_repo; &lt;span style="color: blue"&gt;protected &lt;/span&gt;BaseService() { _repo = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Repository&lt;/span&gt;&amp;lt;T&amp;gt;(); &lt;span style="color: green"&gt;//&#xD;
Cache maps &lt;/span&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;tm = &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.FindTypeMapFor&amp;lt;T,&#xD;
TModel&amp;gt;(); &lt;span style="color: blue"&gt;if &lt;/span&gt;(tm == &lt;span style="color: blue"&gt;null&lt;/span&gt;)&#xD;
{ &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.CreateMap&amp;lt;T, TModel&amp;gt;(); } tm = &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.FindTypeMapFor&amp;lt;TModel,&#xD;
T&amp;gt;(); &lt;span style="color: blue"&gt;if &lt;/span&gt;(tm == &lt;span style="color: blue"&gt;null&lt;/span&gt;)&#xD;
{ &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.CreateMap&amp;lt;TModel, T&amp;gt;(); } } &lt;span style="color: blue"&gt;public&#xD;
virtual &lt;/span&gt;TModel GetById(&lt;span style="color: #2b91af"&gt;Int32 &lt;/span&gt;id) { &lt;span style="color: blue"&gt;var &lt;/span&gt;item&#xD;
= _repo.GetById(id); &lt;span style="color: blue"&gt;var &lt;/span&gt;model = Map(item); &lt;span style="color: blue"&gt;return &lt;/span&gt;model;&#xD;
} &lt;span style="color: blue"&gt;public virtual &lt;/span&gt;TModel Map(T d) { &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.Map&amp;lt;T,&#xD;
TModel&amp;gt;(d); } } }&lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
Now for the service that derives form the BaseService:&#xD;
&lt;/p&gt;&#xD;
        &lt;pre class="code"&gt;&#xD;
          &lt;span style="color: blue"&gt;public class &lt;/span&gt;&#xD;
          &lt;span style="color: #2b91af"&gt;VenueService &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;BaseService&lt;/span&gt;&amp;lt;Model.&lt;span style="color: #2b91af"&gt;Venue&lt;/span&gt;,&#xD;
Data.&lt;span style="color: #2b91af"&gt;Venue&lt;/span&gt;&amp;gt; { &lt;span style="color: blue"&gt;public &lt;/span&gt;VenueService()&#xD;
{ } &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;Model.&lt;span style="color: #2b91af"&gt;Venue&lt;/span&gt;&amp;gt;&#xD;
GetByCity(&lt;span style="color: blue"&gt;string &lt;/span&gt;city) { &lt;span style="color: blue"&gt;var &lt;/span&gt;result&#xD;
= _repo.Find(v =&amp;gt; v.City == city); &lt;span style="color: blue"&gt;var &lt;/span&gt;venues&#xD;
= result.ToList(); &lt;span style="color: blue"&gt;var &lt;/span&gt;venueModels = Map(venues); &lt;span style="color: blue"&gt;return &lt;/span&gt;venueModels;&#xD;
} }&lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://11011.net/software/vspaste"&gt;&#xD;
          &lt;/a&gt;As you can see the Code is very clean&#xD;
and simple to read.  What is nice about going down this road with the AutoMapper&#xD;
is that mapping is completely automated and I don’t have to remap anything if I change&#xD;
properties or add them to the data model.  All I need to do is make sure the&#xD;
Property is on the domain model, then it will get mapped.  Also it will map by&#xD;
convention also, so if you have a Complex type as a property, like, Venue.Room.Name&#xD;
it would automatically map to a flattened dto like Venue.RoomName.  There are&#xD;
a ton of other conventions also, but you should go download AutoMapper and look at&#xD;
the tests to see all of the possibilities.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The next big issue I ran into was that the data was not getting updated when I would&#xD;
pass a detached object to the EF context.  Since I was creating the object that&#xD;
needed to get passed in outside of the ObjectContext scope, I needed to get the EF&#xD;
ObjectStateManager to recognize that the Entity Object had changed and to persist&#xD;
it.  I again had to use a little bit of reflection, but after I understood how&#xD;
EF handled things, it made more sense.  It was quite frustrating for a few hours&#xD;
trying to figure out why EF was not persisting updates and only inserts.  As&#xD;
you can see with the code below I needed to get the value of the Entity Key and the&#xD;
hydrate the entity object so that the ObjectStateManager knew that the data had been&#xD;
changed.&#xD;
&lt;/p&gt;&#xD;
        &lt;pre class="code"&gt;&#xD;
          &lt;span style="color: blue"&gt;public int &lt;/span&gt;Update(T o) { &lt;span style="color: blue"&gt;var &lt;/span&gt;tableName&#xD;
= &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(T).Name; &lt;span style="color: green"&gt;// Need&#xD;
to get object out of ObjectStateManager, then set it so the dbcontext knows to persist&#xD;
changes &lt;/span&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;Id = GetPrimaryKeyValue(o); T&#xD;
currentObject = GetById(Id); currentObject = o; context.ApplyPropertyChanges(tableName,&#xD;
currentObject); &lt;span style="color: blue"&gt;return &lt;/span&gt;context.SaveChanges(); } &lt;span style="color: blue"&gt;private&#xD;
int &lt;/span&gt;GetPrimaryKeyValue(T o) { &lt;span style="color: blue"&gt;int &lt;/span&gt;Id = 0; &lt;span style="color: blue"&gt;var &lt;/span&gt;properties&#xD;
= &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(T).GetProperties(); &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;PropertyInfo &lt;/span&gt;p &lt;span style="color: blue"&gt;in &lt;/span&gt;properties)&#xD;
{ &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: blue"&gt;string&lt;/span&gt;.Compare(p.Name, &lt;span style="color: #a31515"&gt;"Id"&lt;/span&gt;, &lt;span style="color: blue"&gt;true&lt;/span&gt;)&#xD;
== 0) { &lt;span style="color: blue"&gt;var &lt;/span&gt;r = p.GetValue(o, &lt;span style="color: blue"&gt;null&lt;/span&gt;).ToString();&#xD;
Id = &lt;span style="color: blue"&gt;int&lt;/span&gt;.Parse(r); &lt;span style="color: blue"&gt;break&lt;/span&gt;;&#xD;
} } &lt;span style="color: blue"&gt;return &lt;/span&gt;Id; }&lt;/pre&gt;&#xD;
All in all, I don’t mind EF for the Data Access Mapping, and the way it is currently&#xD;
abstracted in our project, it could easily be switched out for Linq To Sql, Subsonic,&#xD;
or any other ORM that uses LINQ to access its data.  I think the best way to&#xD;
use Data Mapping technologies in the future is control your own mapping by using tools&#xD;
such as AutoMapper so that you are not locked in to one way of getting your data out&#xD;
of your database.  &lt;img width="0" height="0" src="http://www.jimzimmerman.com/blog/aggbug.ashx?id=30684462-528b-43a2-b61b-6abb8af24a69"&gt;&lt;/img&gt;&lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=8PxD-nDxE0Q:pDmZHAZsX8s:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=8PxD-nDxE0Q:pDmZHAZsX8s:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=8PxD-nDxE0Q:pDmZHAZsX8s:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=8PxD-nDxE0Q:pDmZHAZsX8s:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?i=8PxD-nDxE0Q:pDmZHAZsX8s:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.jimzimmerman.com/blog/CommentView,guid,30684462-528b-43a2-b61b-6abb8af24a69.aspx</comments>
      <category>Code Camp;Entity Framework;ORM</category>
    </item>
    <item>
      <trackback:ping>http://www.jimzimmerman.com/blog/Trackback.aspx?guid=789af1a1-9fa7-4c15-91df-f22a49084c1d</trackback:ping>
      <pingback:server>http://www.jimzimmerman.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jimzimmerman.com/blog/PermaLink,guid,789af1a1-9fa7-4c15-91df-f22a49084c1d.aspx</pingback:target>
      <dc:creator>Jim Zimmerman</dc:creator>
      <wfw:comment>http://www.jimzimmerman.com/blog/CommentView,guid,789af1a1-9fa7-4c15-91df-f22a49084c1d.aspx</wfw:comment>
      <wfw:commentRss>http://www.jimzimmerman.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=789af1a1-9fa7-4c15-91df-f22a49084c1d</wfw:commentRss>
      
      <title>Modifying a compile asp.net assembly when no longer have source</title>
      <guid isPermaLink="false">http://www.jimzimmerman.com/blog/PermaLink,guid,789af1a1-9fa7-4c15-91df-f22a49084c1d.aspx</guid>
      <link>http://www.jimzimmerman.com/blog/2009/03/25/Modifying+A+Compile+Aspnet+Assembly+When+No+Longer+Have+Source.aspx</link>
      <pubDate>Wed, 25 Mar 2009 03:42:51 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
So while I was at the MVP Summit, an old client got a hold of me and said there was&#xD;
a weird error on the site when a user was trying to post something.  He sent&#xD;
me a screenshot and it said could not login as sa to sql server.  I remoted into&#xD;
the server where they had moved the application and looked in the web.config file&#xD;
and did not see any connection string that had sa as the user name.  So I was&#xD;
stumped.  I began to look at the stack trace and realized which assembly this&#xD;
was coming from.  This happened to be the only assembly which did not have the&#xD;
source code on the server.  I wrote the app over 6 years ago and the laptop the&#xD;
source was on had recently had a failed hard drive.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Anyway, it was a vb.net 1.1 app from visual studio 2003.  Yes I used to do a&#xD;
little VB. :)  So I realized that there must have been a connection string hard&#xD;
coded in the assembly where the stack trace was coming from.  Oh no!  How&#xD;
was i going to fix this without changing the sa password on their new host which was&#xD;
not really an option?  &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
First thing I did was download reflector &lt;a href="http://www.red-gate.com/products/reflector/" target="_blank"&gt;here&lt;/a&gt;.&#xD;
I opened the assembly and did see the hard code connection string.  Man what&#xD;
an idiot for doing that.  Don’t know why I did that at the time, but not a very&#xD;
smart move. So I was stuck.  How do I edit an assembly without having to export&#xD;
all the code from reflector, find visual studio 2003 and run it in a virtual, download&#xD;
the rest of the app and pray that I could get it to work.  Well i searched for&#xD;
modifying a .net assembly and found this: Reflexil - &lt;a href="http://sebastien.lebreton.free.fr/reflexil/" target="_blank"&gt;http://sebastien.lebreton.free.fr/reflexil/&lt;/a&gt; .&#xD;
It is a plug-in that works inside of reflector that allows the modification of the&#xD;
code in the assembly.  So i downloaded it opened the assembly, changed the connection&#xD;
string code and then saved it.  The .dll ended up being a third the size, but&#xD;
still worked after deploying it to the server.  I was shocked.  I just had&#xD;
edited a vb.net 1.1 assembly on a windows 7 laptop using reflector while in a session&#xD;
during the MVP summit.  Pretty cool I think.  Saved me a whole day of figuring&#xD;
out how to run visual studio 2003 and get that code compiled again.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.jimzimmerman.com/blog/aggbug.ashx?id=789af1a1-9fa7-4c15-91df-f22a49084c1d"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=XT_2635nRL8:qx8cFtcKLN0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=XT_2635nRL8:qx8cFtcKLN0:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=XT_2635nRL8:qx8cFtcKLN0:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=XT_2635nRL8:qx8cFtcKLN0:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?i=XT_2635nRL8:qx8cFtcKLN0:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.jimzimmerman.com/blog/CommentView,guid,789af1a1-9fa7-4c15-91df-f22a49084c1d.aspx</comments>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.jimzimmerman.com/blog/Trackback.aspx?guid=68861d34-52bc-43ca-92f5-2de4da946055</trackback:ping>
      <pingback:server>http://www.jimzimmerman.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jimzimmerman.com/blog/PermaLink,guid,68861d34-52bc-43ca-92f5-2de4da946055.aspx</pingback:target>
      <dc:creator>Jim Zimmerman</dc:creator>
      <wfw:comment>http://www.jimzimmerman.com/blog/CommentView,guid,68861d34-52bc-43ca-92f5-2de4da946055.aspx</wfw:comment>
      <wfw:commentRss>http://www.jimzimmerman.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=68861d34-52bc-43ca-92f5-2de4da946055</wfw:commentRss>
      <slash:comments>1</slash:comments>
      
      <title>Windows 7 and My 2 year old Laptop</title>
      <guid isPermaLink="false">http://www.jimzimmerman.com/blog/PermaLink,guid,68861d34-52bc-43ca-92f5-2de4da946055.aspx</guid>
      <link>http://www.jimzimmerman.com/blog/2009/02/24/Windows+7+And+My+2+Year+Old+Laptop.aspx</link>
      <pubDate>Tue, 24 Feb 2009 04:00:35 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
I have owned a Dell Inspiron 9400 for almost 2 years with Vista Ultimate and have&#xD;
enjoyed it for the most part.  I had some issues with wireless and getting the&#xD;
sluggish feeling after I had visual studio, 20 browser tabs open, iis 7, sql server,&#xD;
etc. all open at the same time.  Of course I thought, well i have a lot of stuff&#xD;
running at same time so of course it will be slower.  Well now with Windows 7&#xD;
I have not one wireless issue, speed is crazy faster and I  am still only using&#xD;
1 gb of ram of 2 gb available.  &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I am absolutely shocked a how much better I like my laptop.  I have a 8 Gb Vista&#xD;
64 desktop at home, so my laptop is always going to seem sluggish, but now I really&#xD;
like using my laptop.  I am not looking forward to having to wipe it again when&#xD;
the beta expires, but is well worth the joy i now get from my laptop.  &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://www.jimzimmerman.com/blog/content/binary/WindowsLiveWriter/Windows7andmy2yearoldlaptop_12EF0/Windows7DesktopSmall_2.jpg"&gt;&#xD;
            &lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Windows7DesktopSmall" border="0" alt="Windows7DesktopSmall" src="http://www.jimzimmerman.com/blog/content/binary/WindowsLiveWriter/Windows7andmy2yearoldlaptop_12EF0/Windows7DesktopSmall_thumb.jpg" width="244" height="154"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I love the new task bar and my favorites always being down there.  I can’t remember&#xD;
if I have even done a full reboot in a month.  Oh if you are going to try this&#xD;
at home, make sure to do a clean install.  &#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.jimzimmerman.com/blog/aggbug.ashx?id=68861d34-52bc-43ca-92f5-2de4da946055"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=4UyDta5aDU4:WlQSQlKgwUM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=4UyDta5aDU4:WlQSQlKgwUM:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=4UyDta5aDU4:WlQSQlKgwUM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=4UyDta5aDU4:WlQSQlKgwUM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?i=4UyDta5aDU4:WlQSQlKgwUM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.jimzimmerman.com/blog/CommentView,guid,68861d34-52bc-43ca-92f5-2de4da946055.aspx</comments>
      <category>Windows7</category>
    </item>
    <item>
      <trackback:ping>http://www.jimzimmerman.com/blog/Trackback.aspx?guid=3d7d763e-b8c5-4900-9139-1cdaadf88e70</trackback:ping>
      <pingback:server>http://www.jimzimmerman.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jimzimmerman.com/blog/PermaLink,guid,3d7d763e-b8c5-4900-9139-1cdaadf88e70.aspx</pingback:target>
      <dc:creator>Jim Zimmerman</dc:creator>
      <wfw:comment>http://www.jimzimmerman.com/blog/CommentView,guid,3d7d763e-b8c5-4900-9139-1cdaadf88e70.aspx</wfw:comment>
      <wfw:commentRss>http://www.jimzimmerman.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3d7d763e-b8c5-4900-9139-1cdaadf88e70</wfw:commentRss>
      
      <title>Enabling 301 redirects on IIS 7 on Windows server 2008</title>
      <guid isPermaLink="false">http://www.jimzimmerman.com/blog/PermaLink,guid,3d7d763e-b8c5-4900-9139-1cdaadf88e70.aspx</guid>
      <link>http://www.jimzimmerman.com/blog/2009/02/05/Enabling+301+Redirects+On+IIS+7+On+Windows+Server+2008.aspx</link>
      <pubDate>Thu, 05 Feb 2009 05:37:27 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
I was stumped the other day as to why i could not get a 301 redirect in from site.com&#xD;
to &lt;a href="http://www.site.com"&gt;www.site.com&lt;/a&gt; on IIS 7.  After much looking&#xD;
around I found out that you need to enable this feature in the server manager.  &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://www.jimzimmerman.com/blog/content/binary/WindowsLiveWriter/Enabling301redirectsonIIS7onWindowsserve_DEE8/image_2.png"&gt;&#xD;
            &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://www.jimzimmerman.com/blog/content/binary/WindowsLiveWriter/Enabling301redirectsonIIS7onWindowsserve_DEE8/image_thumb.png" width="694" height="263"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Then you need to go back to the IIS node that you want to enable 301 redirect for:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://www.jimzimmerman.com/blog/content/binary/WindowsLiveWriter/Enabling301redirectsonIIS7onWindowsserve_DEE8/image_4.png"&gt;&#xD;
            &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://www.jimzimmerman.com/blog/content/binary/WindowsLiveWriter/Enabling301redirectsonIIS7onWindowsserve_DEE8/image_thumb_1.png" width="659" height="374"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
And then set the values for your redirect:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://www.jimzimmerman.com/blog/content/binary/WindowsLiveWriter/Enabling301redirectsonIIS7onWindowsserve_DEE8/image_6.png"&gt;&#xD;
            &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://www.jimzimmerman.com/blog/content/binary/WindowsLiveWriter/Enabling301redirectsonIIS7onWindowsserve_DEE8/image_thumb_2.png" width="445" height="322"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
If you notice what is also cool is that it will redirect addresses relative to the&#xD;
domain and not just to the root (i.e &lt;a href="http://www.site.com/oldfile.htm"&gt;site.com/oldfile.htm&lt;/a&gt; will&#xD;
redirect to &lt;a href="http://www.site.com/oldfile.htm"&gt;www.site.com/oldfile.htm&lt;/a&gt;.  &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Hope this helps someone, cause it was not very intuitive for me to find out how to&#xD;
do it since the feature was not installed by default.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.jimzimmerman.com/blog/aggbug.ashx?id=3d7d763e-b8c5-4900-9139-1cdaadf88e70"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=M_PhVjqi08U:p9IQmrxNWEI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=M_PhVjqi08U:p9IQmrxNWEI:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=M_PhVjqi08U:p9IQmrxNWEI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=M_PhVjqi08U:p9IQmrxNWEI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?i=M_PhVjqi08U:p9IQmrxNWEI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.jimzimmerman.com/blog/CommentView,guid,3d7d763e-b8c5-4900-9139-1cdaadf88e70.aspx</comments>
      <category>IIS 7;Windows Server 2008</category>
    </item>
    <item>
      <trackback:ping>http://www.jimzimmerman.com/blog/Trackback.aspx?guid=2abed4ad-eb56-4857-be29-3fdc026aa95b</trackback:ping>
      <pingback:server>http://www.jimzimmerman.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jimzimmerman.com/blog/PermaLink,guid,2abed4ad-eb56-4857-be29-3fdc026aa95b.aspx</pingback:target>
      <dc:creator>Jim Zimmerman</dc:creator>
      <wfw:comment>http://www.jimzimmerman.com/blog/CommentView,guid,2abed4ad-eb56-4857-be29-3fdc026aa95b.aspx</wfw:comment>
      <wfw:commentRss>http://www.jimzimmerman.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=2abed4ad-eb56-4857-be29-3fdc026aa95b</wfw:commentRss>
      
      <title>ASP.NET MVC 1.0 Release Candidate Is Released</title>
      <guid isPermaLink="false">http://www.jimzimmerman.com/blog/PermaLink,guid,2abed4ad-eb56-4857-be29-3fdc026aa95b.aspx</guid>
      <link>http://www.jimzimmerman.com/blog/2009/01/28/ASPNET+MVC+10+Release+Candidate+Is+Released.aspx</link>
      <pubDate>Wed, 28 Jan 2009 03:31:47 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
Time to dig into the T4 template system (learn &lt;a href="http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx"&gt;here&lt;/a&gt;)&#xD;
in Visual Studio since they added a cool feature for generating scaffold controllers&#xD;
and views. Check out &lt;a href="http://weblogs.asp.net/scottgu/archive/2009/01/27/asp-net-mvc-1-0-release-candidate-now-available.aspx"&gt;ScottGu's&#xD;
Article&lt;/a&gt;, of course. I am thinking that this was influenced by the &lt;a href="http://blog.wekeroad.com/blog/subsonic-mvc-scaffold-addin/"&gt;SubSonic&#xD;
MVC Scaffold Addin&lt;/a&gt; from Rob Conery a little bit ago. I am so happy that we are&#xD;
going to have our own scaffold playground with built in tools. It is getting so much&#xD;
closer to how I really want to develop web apps. Woohoo! &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I know it has been a long time since i blogged, since before the holidays. Four kids&#xD;
is a little bit busier than I imagined, but all worth it. I am still trying to stay&#xD;
up late to learn more new things coming out in the web world, as I love the information&#xD;
overload. Much more to come soon I am sure! &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Just found this link. You will need this to check out the &lt;a href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=22359"&gt;MVC&#xD;
futures&lt;/a&gt; stuff that has Html.TextBoxFor(p =&amp;gt; p.PropteryName). &#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.jimzimmerman.com/blog/aggbug.ashx?id=2abed4ad-eb56-4857-be29-3fdc026aa95b"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=4wL77sn-bUQ:RTmbCQLEoH4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=4wL77sn-bUQ:RTmbCQLEoH4:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=4wL77sn-bUQ:RTmbCQLEoH4:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=4wL77sn-bUQ:RTmbCQLEoH4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?i=4wL77sn-bUQ:RTmbCQLEoH4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.jimzimmerman.com/blog/CommentView,guid,2abed4ad-eb56-4857-be29-3fdc026aa95b.aspx</comments>
      <category>ASP.NET;ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.jimzimmerman.com/blog/Trackback.aspx?guid=56e866cd-268f-4794-80f1-f9ece418eb33</trackback:ping>
      <pingback:server>http://www.jimzimmerman.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jimzimmerman.com/blog/PermaLink,guid,56e866cd-268f-4794-80f1-f9ece418eb33.aspx</pingback:target>
      <dc:creator>Jim Zimmerman</dc:creator>
      <wfw:comment>http://www.jimzimmerman.com/blog/CommentView,guid,56e866cd-268f-4794-80f1-f9ece418eb33.aspx</wfw:comment>
      <wfw:commentRss>http://www.jimzimmerman.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=56e866cd-268f-4794-80f1-f9ece418eb33</wfw:commentRss>
      <slash:comments>1</slash:comments>
      
      <title>How to speed up your ASP.NET Website</title>
      <guid isPermaLink="false">http://www.jimzimmerman.com/blog/PermaLink,guid,56e866cd-268f-4794-80f1-f9ece418eb33.aspx</guid>
      <link>http://www.jimzimmerman.com/blog/2008/12/10/How+To+Speed+Up+Your+ASPNET+Website.aspx</link>
      <pubDate>Wed, 10 Dec 2008 04:52:17 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
Recently we noticed that our site was a little sluggish.  Now of course when&#xD;
we started to look at why it was slow sometimes and not others, we opened up a huge&#xD;
can of worms.  Was it our code?  Was it our server?  Was it our proxy&#xD;
server?  Was it our database?  Was it our graphics?  Was it the JavaScript? &#xD;
Or was it just that the end user had a slow connection?  Well it was all of them.  &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Sometimes we forget that not everyone has FIOS.  We are very lucky to have a&#xD;
20 Mbps / 20 Mbps connection at work.  So first thing we did was to look at the&#xD;
size of our pages when downloading the html, CSS, images and JavaScript.  We&#xD;
were shocked at the size of the files.  The first eye opening fact was that our&#xD;
home page was 1.5 MB.  Whoa.  The best tool that we found to figure the&#xD;
details out was &lt;a href="http://developer.yahoo.com/yslow/"&gt;YSlow&lt;/a&gt;.  Here&#xD;
is a snippet from their site about what the tool does:&#xD;
&lt;/p&gt;&#xD;
        &lt;blockquote&gt;&#xD;
          &lt;p&gt;&#xD;
YSlow analyzes web pages and tells you why they're slow based on the &lt;a href="http://developer.yahoo.com/performance/index.html#rules"&gt;rules&#xD;
for high performance web sites&lt;/a&gt;. YSlow is a &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/5369"&gt;Firefox&#xD;
add-on&lt;/a&gt; integrated with the popular &lt;a href="http://www.getfirebug.com/"&gt;Firebug&lt;/a&gt; web&#xD;
development tool&#xD;
&lt;/p&gt;&#xD;
        &lt;/blockquote&gt;&#xD;
        &lt;p&gt;&#xD;
This tool saved us so much time figuring out what our issues were.  I highly&#xD;
suggest reading the rules.  Also you can listen to a recent podcast from DotNetRocks: &lt;a href="http://www.dotnetrocks.com/default.aspx?showNum=390"&gt;YSlow!&#xD;
Steve Souders finds Website Bottlenecks&lt;/a&gt;&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
So we began the process of optimizing the client.  The first thing you can do&#xD;
is to compress the JavaScript, CSS and html files on the server to reduce the file&#xD;
download size up to 75% on the client.  The way to do this in IIS6 is to enable&#xD;
GZip compression.  This is turned off by default which I think should actually&#xD;
be turned on by default.  Here is some info on how to enable it for specific&#xD;
file types.  Don't forget the .axd files if you use and Ajax in webforms. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/25d2170b-09c0-45fd-8da4-898cf9a7d568.mspx?mfr=true"&gt;Using&#xD;
HTTP Compression for Faster Downloads (IIS 6.0)&lt;/a&gt;&#xD;
        &lt;p&gt;&#xD;
So next on our list was minimizing the size of the images that we were using as backgrounds&#xD;
in CSS.  They are the first calls from the browser when loaded from CSS. &#xD;
Also moving JavaScript references to the bottom of the page helps.  The browser&#xD;
using a blocking request when loading JavaScript files, so if you have them at the&#xD;
top of the page, you will get a perceived load issue since the browser waits for that&#xD;
first.  The best thing to get out of optimizing for the client is the perceived&#xD;
load to the user which really makes the most difference.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
So after removing the client side issues we realized we had a database load issue&#xD;
on certain pages with many records.  Well we found out we ran into the famous&#xD;
ORM gotcha of way too many queries when using strictly the data objects with related&#xD;
foreign key objects.  For instance, by relating a member record to the aspnet&#xD;
user table and doing a foreach on the member and then checking to see their username&#xD;
on the aspnet user table, it will cause another db query to get that info for each&#xD;
user.  Sometimes when using the orm objects that are generated instead of writing&#xD;
a custom query to populate your own domain object, you can get into a lot of trouble.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Our website has many applications to it, some mvc and some using webforms.  We&#xD;
have noticed a significant speed increase on the mvc sites.  There is less code&#xD;
to render and there is no Viewstate so right away there is some performance increases.  &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I hope that this helps some other people figure out why their site is slow for some&#xD;
people some of the time.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.jimzimmerman.com/blog/aggbug.ashx?id=56e866cd-268f-4794-80f1-f9ece418eb33"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=NSIZ3HKSFmA:DpL1WksXKeU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=NSIZ3HKSFmA:DpL1WksXKeU:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=NSIZ3HKSFmA:DpL1WksXKeU:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=NSIZ3HKSFmA:DpL1WksXKeU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?i=NSIZ3HKSFmA:DpL1WksXKeU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.jimzimmerman.com/blog/CommentView,guid,56e866cd-268f-4794-80f1-f9ece418eb33.aspx</comments>
      <category>ASP.NET;ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.jimzimmerman.com/blog/Trackback.aspx?guid=e76aacf5-7766-46e1-aa82-391ad42c64f1</trackback:ping>
      <pingback:server>http://www.jimzimmerman.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jimzimmerman.com/blog/PermaLink,guid,e76aacf5-7766-46e1-aa82-391ad42c64f1.aspx</pingback:target>
      <dc:creator>Jim Zimmerman</dc:creator>
      <wfw:comment>http://www.jimzimmerman.com/blog/CommentView,guid,e76aacf5-7766-46e1-aa82-391ad42c64f1.aspx</wfw:comment>
      <wfw:commentRss>http://www.jimzimmerman.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=e76aacf5-7766-46e1-aa82-391ad42c64f1</wfw:commentRss>
      <slash:comments>1</slash:comments>
      
      <title>Missed PDC 2008? Go to MSDN Developer Conference</title>
      <guid isPermaLink="false">http://www.jimzimmerman.com/blog/PermaLink,guid,e76aacf5-7766-46e1-aa82-391ad42c64f1.aspx</guid>
      <link>http://www.jimzimmerman.com/blog/2008/11/10/Missed+PDC+2008+Go+To+MSDN+Developer+Conference.aspx</link>
      <pubDate>Mon, 10 Nov 2008 02:45:16 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
If you missed PDC 2008 in L.A this year, you can catch some sessions at the MSDN Developer&#xD;
Conference in Orlando on December 11, 2008. It's only $99, so I am sure the registrations&#xD;
will fill up fast.  Here is a blurb from their site about what it will cover:&#xD;
&lt;/p&gt;&#xD;
        &lt;blockquote&gt;&#xD;
          &lt;p&gt;&#xD;
            &lt;strong&gt;We’re bringing the PDC to you!&lt;/strong&gt; For just $99 you’ll get the best of&#xD;
the PDC in your own backyard and hear all of the exciting announcements around the &lt;strong&gt;Azure&#xD;
Services Platform&lt;/strong&gt; and &lt;strong&gt;Windows 7&lt;/strong&gt;. Other sessions include&#xD;
the latest developments in &lt;strong&gt;.NET, Silverlight, Surface, Parallel Programming,&#xD;
Live Mesh,&lt;/strong&gt; and more. &#xD;
&lt;/p&gt;&#xD;
          &lt;p&gt;&#xD;
            &lt;strong&gt;Register today&lt;/strong&gt; to stay current in an ever-competitive job market,&#xD;
enhance your skills and gain access to the next generation of tools and technology. &#xD;
&lt;/p&gt;&#xD;
          &lt;ol&gt;&#xD;
            &lt;li&gt;&#xD;
              &lt;strong&gt;Experience the Azure Services Platform&lt;/strong&gt;&#xD;
              &lt;br&gt;&#xD;
Create applications that seamlessly bridge PC, Web, and phone &#xD;
&lt;/li&gt;&#xD;
            &lt;li&gt;&#xD;
              &lt;strong&gt;Be among the first to see Windows 7&lt;/strong&gt;&#xD;
              &lt;br&gt;&#xD;
See the latest advances in Multi-Touch Application Development &#xD;
&lt;/li&gt;&#xD;
            &lt;li&gt;&#xD;
              &lt;strong&gt;Take your .NET skills to the next level&lt;/strong&gt;&#xD;
              &lt;br&gt;&#xD;
See sessions on WPF 4.0, Silverlight 2, ASP.NET 4.0, Parallel Programming, Live Mesh&#xD;
and more &#xD;
&lt;/li&gt;&#xD;
          &lt;/ol&gt;&#xD;
          &lt;p&gt;&#xD;
            &lt;strong&gt;The Cost? Just $99.&lt;/strong&gt;&#xD;
            &lt;br&gt;&#xD;
And, did we mention that attendees will get some cool giveaways?&#xD;
&lt;/p&gt;&#xD;
        &lt;/blockquote&gt;&#xD;
        &lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
For more information, here is a link to the site and registration page&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a title="http://www.msdndevcon.com/Pages/start.aspx" href="http://www.msdndevcon.com/Pages/start.aspx"&gt;http://www.msdndevcon.com/Pages/start.aspx&lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
See ya in Orlando!&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.jimzimmerman.com/blog/aggbug.ashx?id=e76aacf5-7766-46e1-aa82-391ad42c64f1"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=GWErjN3INfM:DpeiSiCVyPA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=GWErjN3INfM:DpeiSiCVyPA:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=GWErjN3INfM:DpeiSiCVyPA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=GWErjN3INfM:DpeiSiCVyPA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?i=GWErjN3INfM:DpeiSiCVyPA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.jimzimmerman.com/blog/CommentView,guid,e76aacf5-7766-46e1-aa82-391ad42c64f1.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.jimzimmerman.com/blog/Trackback.aspx?guid=b444b8a9-3a06-48be-993c-f37798d770ed</trackback:ping>
      <pingback:server>http://www.jimzimmerman.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jimzimmerman.com/blog/PermaLink,guid,b444b8a9-3a06-48be-993c-f37798d770ed.aspx</pingback:target>
      <dc:creator>Jim Zimmerman</dc:creator>
      <wfw:comment>http://www.jimzimmerman.com/blog/CommentView,guid,b444b8a9-3a06-48be-993c-f37798d770ed.aspx</wfw:comment>
      <wfw:commentRss>http://www.jimzimmerman.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b444b8a9-3a06-48be-993c-f37798d770ed</wfw:commentRss>
      
      <title>Scaffolding in an ASP.NET MVC App</title>
      <guid isPermaLink="false">http://www.jimzimmerman.com/blog/PermaLink,guid,b444b8a9-3a06-48be-993c-f37798d770ed.aspx</guid>
      <link>http://www.jimzimmerman.com/blog/2008/10/29/Scaffolding+In+An+ASPNET+MVC+App.aspx</link>
      <pubDate>Wed, 29 Oct 2008 04:10:43 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
So at work I had to create a simple admin for a few new features in our app and decided&#xD;
I would try out a few new technologies while I was at it to not only save some time,&#xD;
but to see what is out there now.  My heart was set on this being a simple MVC&#xD;
web app, but really wanted to try ASP.NET Dynamic Data also.  Well good news&#xD;
is that you can use Dynamic Data in MVC fairly cleanly and easily.  By adding&#xD;
a simple route to the global.asax.cs file you can easily have Dynamic Data working&#xD;
although it is web forms based:&#xD;
&lt;/p&gt;&#xD;
        &lt;pre class="code"&gt;&#xD;
          &lt;span style="color: rgb(43,145,175)"&gt;MetaModel&lt;/span&gt; model = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt;&lt;span style="color: rgb(43,145,175)"&gt;MetaModel&lt;/span&gt;();&#xD;
model.RegisterContext(&lt;span style="color: rgb(0,0,255)"&gt;typeof&lt;/span&gt;(MvcApplication1.Models.&lt;span style="color: rgb(43,145,175)"&gt;NorthwindDataContext&lt;/span&gt;), &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt;&lt;span style="color: rgb(43,145,175)"&gt;ContextConfiguration&lt;/span&gt;()&#xD;
{ ScaffoldAllTables = &lt;span style="color: rgb(0,0,255)"&gt;true&lt;/span&gt; }); routes.Add(&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt;&lt;span style="color: rgb(43,145,175)"&gt;DynamicDataRoute&lt;/span&gt;(&lt;span style="color: rgb(163,21,21)"&gt;"DD/{table}/{action}.aspx"&lt;/span&gt;)&#xD;
{ Constraints = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt;&lt;span style="color: rgb(43,145,175)"&gt;RouteValueDictionary&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; {&#xD;
action = &lt;span style="color: rgb(163,21,21)"&gt;"List|Details|Edit|Insert"&lt;/span&gt; }),&#xD;
Model = model });&lt;/pre&gt;&#xD;
        &lt;a href="http://11011.net/software/vspaste"&gt;&#xD;
        &lt;/a&gt;&#xD;
        &lt;font face="Courier New"&gt;&#xD;
        &lt;/font&gt;&#xD;
        &lt;a href="http://11011.net/software/vspaste"&gt;&#xD;
        &lt;/a&gt;&#xD;
        &lt;p&gt;&#xD;
Now this opened my eyes a little that you can easily create a hybrid web app of MVC&#xD;
and Web Forms.  Web Forms does have its advantages sometimes, especially when&#xD;
you start looking at existing tools and controls that you just need to work quickly&#xD;
and don't feel like reinventing the wheel.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
You can download a sample project of this working in an mvc app over at codeplex. &lt;a title="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14473" href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14473"&gt;http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14473&lt;/a&gt;&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
That same night I was playing with Dynamic Data, Rob Conery had just posted his prototype&#xD;
of a &lt;a href="http://blog.wekeroad.com/blog/subsonic-mvc-adding-updated-for-beta-1/"&gt;Subsonic&#xD;
MVC Add-in for Visual Studio&lt;/a&gt;.  I was pretty impressed with the code and views&#xD;
that it generated, and I think is a great start to seeing what is possible. &#xD;
Both samples took less that an hour to download and implement.  I ended up spending&#xD;
more time integrated security across the multiple web apps on different sub-domains&#xD;
than getting the scaffolds to work.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.jimzimmerman.com/blog/aggbug.ashx?id=b444b8a9-3a06-48be-993c-f37798d770ed"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=j5VEY8giVhE:kP1NU4O5zrA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=j5VEY8giVhE:kP1NU4O5zrA:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=j5VEY8giVhE:kP1NU4O5zrA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=j5VEY8giVhE:kP1NU4O5zrA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?i=j5VEY8giVhE:kP1NU4O5zrA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.jimzimmerman.com/blog/CommentView,guid,b444b8a9-3a06-48be-993c-f37798d770ed.aspx</comments>
      <category>ASP.NET MVC;Code Generation</category>
    </item>
    <item>
      <trackback:ping>http://www.jimzimmerman.com/blog/Trackback.aspx?guid=bc472c8e-02dd-4bc3-a77b-eea73786941a</trackback:ping>
      <pingback:server>http://www.jimzimmerman.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jimzimmerman.com/blog/PermaLink,guid,bc472c8e-02dd-4bc3-a77b-eea73786941a.aspx</pingback:target>
      <dc:creator>Jim Zimmerman</dc:creator>
      <wfw:comment>http://www.jimzimmerman.com/blog/CommentView,guid,bc472c8e-02dd-4bc3-a77b-eea73786941a.aspx</wfw:comment>
      <wfw:commentRss>http://www.jimzimmerman.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=bc472c8e-02dd-4bc3-a77b-eea73786941a</wfw:commentRss>
      
      <title>jQuery and Microsoft</title>
      <guid isPermaLink="false">http://www.jimzimmerman.com/blog/PermaLink,guid,bc472c8e-02dd-4bc3-a77b-eea73786941a.aspx</guid>
      <link>http://www.jimzimmerman.com/blog/2008/09/29/jQuery+And+Microsoft.aspx</link>
      <pubDate>Mon, 29 Sep 2008 00:57:19 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
I was always hoping this might happen.  Support from Microsoft along with distribution&#xD;
of jQuery with Visual Studio and ASP.NET MVC.  &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx"&gt;Scott&#xD;
Guthrie&lt;/a&gt; and &lt;a href="http://www.hanselman.com/blog/jQueryToShipWithASPNETMVCAndVisualStudio.aspx"&gt;Scott&#xD;
Hanselman&lt;/a&gt; along with &lt;a href="http://jquery.com/blog/2008/09/28/jquery-microsoft-nokia/"&gt;John&#xD;
Resig&lt;/a&gt; have some more detail in their posts.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I plan to update my post, &lt;a href="http://www.jimzimmerman.com/blog/2008/08/16/Ajax+Control+Toolkit+With+ASPNET+MVC.aspx"&gt;Ajax&#xD;
Control Toolkit and ASP.NET MVC&lt;/a&gt;, to use jQuery and the toolkit.  It is about&#xD;
using CSS selectors and the Ajax control Toolkit as an alternative way to use the&#xD;
toolkit in any web development platform.  I modified the Microsoft Ajax library&#xD;
to support CSS selectors, but it is a poor hack and would much prefer to use jQuery&#xD;
anyway.  I was trying to see if I could make it work with the Microsoft Ajax&#xD;
Library from their old preview version from last year.  I was wondering if they&#xD;
would try to reinvent the wheel.  I am glad they decided not to.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.jimzimmerman.com/blog/aggbug.ashx?id=bc472c8e-02dd-4bc3-a77b-eea73786941a"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=meTwsxD4t3k:ULdt6B0LpU0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=meTwsxD4t3k:ULdt6B0LpU0:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=meTwsxD4t3k:ULdt6B0LpU0:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JimZimmerman?a=meTwsxD4t3k:ULdt6B0LpU0:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JimZimmerman?i=meTwsxD4t3k:ULdt6B0LpU0:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.jimzimmerman.com/blog/CommentView,guid,bc472c8e-02dd-4bc3-a77b-eea73786941a.aspx</comments>
    </item>
  </channel>
</rss>
