<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Ricka on MVC &amp; Dynamic Data</title><link>http://blogs.msdn.com/rickandy/default.aspx</link><description>Interesting tidbits on MVC and Dynamic Data not found in MSDN.</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Session-less MVC Controller for MVC 2 / RC</title><link>http://blogs.msdn.com/rickandy/archive/2009/12/17/session-less-mvc-controller.aspx</link><pubDate>Thu, 17 Dec 2009 02:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9937993</guid><dc:creator>ricka0</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9937993.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9937993</wfw:commentRss><description>LiveJournal Tags: MVC , MVC 2 , session Why a session-less controller? You have a single client making multiple concurrent requests to the server. The default behavior is these requests will be serialized; with the session-less controller they execute...(&lt;a href="http://blogs.msdn.com/rickandy/archive/2009/12/17/session-less-mvc-controller.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9937993" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/rickandy/attachment/9937993.ashx" length="60048" type="application/x-zip-compressed" /></item><item><title>Using the BeginMethod/EndMethod pattern with MVC</title><link>http://blogs.msdn.com/rickandy/archive/2009/12/03/using-the-beginmethod-endmethod-pattern-with-mvc.aspx</link><pubDate>Thu, 03 Dec 2009 01:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9931722</guid><dc:creator>ricka0</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9931722.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9931722</wfw:commentRss><description>If your asynchronous action method calls a service which exposes methods using the BeginMethod() / EndMethod() pattern , your callback will be executed on a thread which is not under the control of ASP.NET. Some consequences of this are that HttpContext.Current...(&lt;a href="http://blogs.msdn.com/rickandy/archive/2009/12/03/using-the-beginmethod-endmethod-pattern-with-mvc.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9931722" width="1" height="1"&gt;</description></item><item><title>Should my database calls be Asynchronous?</title><link>http://blogs.msdn.com/rickandy/archive/2009/11/14/should-my-database-calls-be-asynchronous.aspx</link><pubDate>Sat, 14 Nov 2009 01:10:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9922356</guid><dc:creator>ricka0</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9922356.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9922356</wfw:commentRss><description>Long running/expensive database calls might seem like a natural candidate for asynchronous calls. In my MSDN article, Using an Asynchronous Controller in ASP.NET MVC , I go out of my way to avoid suggesting DB calls are good candidates. Conventional wisdom...(&lt;a href="http://blogs.msdn.com/rickandy/archive/2009/11/14/should-my-database-calls-be-asynchronous.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9922356" width="1" height="1"&gt;</description></item><item><title>Tips on getting your ASP.NET MVC questions answered quickly</title><link>http://blogs.msdn.com/rickandy/archive/2009/10/29/tips-on-getting-your-asp-net-mvc-questions-answered-quickly.aspx</link><pubDate>Thu, 29 Oct 2009 21:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9914951</guid><dc:creator>ricka0</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9914951.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9914951</wfw:commentRss><description>When you run into an issue or have a question about ASP.NET MVC the best place for it is the MVC Forum . When you write your question, there are a few simple things that you can do to make it easier for the ‘experts’ to answer (and hence to get an answer...(&lt;a href="http://blogs.msdn.com/rickandy/archive/2009/10/29/tips-on-getting-your-asp-net-mvc-questions-answered-quickly.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9914951" width="1" height="1"&gt;</description></item><item><title>MVC FAQ</title><link>http://blogs.msdn.com/rickandy/archive/2009/10/15/mvc-faq.aspx</link><pubDate>Thu, 15 Oct 2009 19:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9907816</guid><dc:creator>ricka0</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9907816.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9907816</wfw:commentRss><description>Please post corrections/submissions to the MVC Forum . Include MVC FAQ in the title. Post LINQ to SQL To SQL Questions here Post Entity Framework Questions here Q: How do I get started with MVC? Walkthrough: Creating a Basic MVC Project with Unit Tests...(&lt;a href="http://blogs.msdn.com/rickandy/archive/2009/10/15/mvc-faq.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9907816" width="1" height="1"&gt;</description></item><item><title>Client Side Validation for MVC 2 P2</title><link>http://blogs.msdn.com/rickandy/archive/2009/10/03/client-side-validation-for-mvc-2-p2.aspx</link><pubDate>Sat, 03 Oct 2009 02:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9902629</guid><dc:creator>ricka0</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9902629.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9902629</wfw:commentRss><description>MVC 2 Preview 1 added support for DataAnnotations . In my MSDN article How to: Validate Model Data Using DataAnnotations Attributes I covered the basics of validation. Preview 2 adds client validation with the addition of one line of code. The following...(&lt;a href="http://blogs.msdn.com/rickandy/archive/2009/10/03/client-side-validation-for-mvc-2-p2.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9902629" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/rickandy/attachment/9902629.ashx" length="30075" type="application/x-zip-compressed" /></item><item><title>DRY-ing out the MVC 2 Templated Helpers</title><link>http://blogs.msdn.com/rickandy/archive/2009/08/18/dry-ing-out-the-mvc-2-templated-helpers.aspx</link><pubDate>Tue, 18 Aug 2009 22:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9874659</guid><dc:creator>ricka0</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9874659.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9874659</wfw:commentRss><description>In my MSDN article Using Templated Helpers to Display Data , I show how they provide a very productive means of building a UI for data sets. The code below shows a typical use of the Display and Label helpers. &amp;lt; span style =" font-weight : bold ; "&amp;gt;...(&lt;a href="http://blogs.msdn.com/rickandy/archive/2009/08/18/dry-ing-out-the-mvc-2-templated-helpers.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9874659" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/rickandy/attachment/9874659.ashx" length="288124" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/rickandy/archive/tags/ASP.Net/default.aspx">ASP.Net</category><category domain="http://blogs.msdn.com/rickandy/archive/tags/MVC/default.aspx">MVC</category></item><item><title>Using DataAnnotations in MVC 2 - Catching up to Dynamic Data</title><link>http://blogs.msdn.com/rickandy/archive/2009/08/01/using-dataannotations-in-mvc-2-catching-up-to-dynamic-data.aspx</link><pubDate>Sat, 01 Aug 2009 10:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9847028</guid><dc:creator>ricka0</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9847028.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9847028</wfw:commentRss><description>DataAnnotations help you write robust validation and prevent the type of annoying error message shown above. Form submittal failure when a field doesn’t validate can be very frustrating - especially when there is no indication of the problematic property...(&lt;a href="http://blogs.msdn.com/rickandy/archive/2009/08/01/using-dataannotations-in-mvc-2-catching-up-to-dynamic-data.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9847028" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/rickandy/archive/tags/ASP.Net/default.aspx">ASP.Net</category><category domain="http://blogs.msdn.com/rickandy/archive/tags/MVC/default.aspx">MVC</category></item><item><title>New Templated Helpers Improve SoC</title><link>http://blogs.msdn.com/rickandy/archive/2009/07/24/new-templated-helpers-improve-soc.aspx</link><pubDate>Fri, 24 Jul 2009 04:08:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9847021</guid><dc:creator>ricka0</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9847021.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9847021</wfw:commentRss><description>SoC (from WikiPedia) In my MSDN article Walkthrough: Using Templated Helpers to Display Data I show how to annotate your data model to specify that a field should be rendered with a type-specific control. The download sample code also includes a control...(&lt;a href="http://blogs.msdn.com/rickandy/archive/2009/07/24/new-templated-helpers-improve-soc.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9847021" width="1" height="1"&gt;</description></item><item><title>Setting font attributes with UIHint in your Entity Partial Class</title><link>http://blogs.msdn.com/rickandy/archive/2009/06/02/setting-font-attributes-with-uihint-in-your-entity-partial-class.aspx</link><pubDate>Tue, 02 Jun 2009 17:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9686137</guid><dc:creator>ricka0</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9686137.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9686137</wfw:commentRss><description>I've written a simple Field Template ( RedBold.ascx ) that reads most font attributes and applies them to your field values. The new entity templates make it easy to apply font attributes to the field labels. The image below shows several font attributes...(&lt;a href="http://blogs.msdn.com/rickandy/archive/2009/06/02/setting-font-attributes-with-uihint-in-your-entity-partial-class.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9686137" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/rickandy/attachment/9686137.ashx" length="1514399" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/rickandy/archive/tags/Dynamic+Data/default.aspx">Dynamic Data</category></item><item><title>Dynamic Data FAQ</title><link>http://blogs.msdn.com/rickandy/archive/2009/01/08/dynamic-data-faq.aspx</link><pubDate>Thu, 08 Jan 2009 13:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9300193</guid><dc:creator>ricka0</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9300193.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9300193</wfw:commentRss><description>&lt;P&gt;&lt;STRONG&gt;&lt;FONT size=4&gt;Please post corrections/new submissions to the &lt;/FONT&gt;&lt;A href="http://forums.asp.net/1145.aspx" target=_blank&gt;&lt;FONT size=4&gt;Dynamic Data Forum&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=4&gt;. &lt;/FONT&gt;&lt;FONT size=2&gt;Put &lt;FONT color=#800000&gt;&lt;EM&gt;FAQ&lt;/EM&gt; &lt;EM&gt;Submission/Correction&lt;/EM&gt;&lt;/FONT&gt; in your title.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;See &lt;A href="http://blogs.msdn.com/davidebb/archive/2009/01/11/tips-on-getting-your-asp-net-dynamic-data-questions-answered-quickly.aspx" target=_blank&gt;Tips on getting your ASP.NET Dynamic Data questions answered quickly&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Post &lt;A href="http://msdn.microsoft.com/en-us/vcsharp/aa904594.aspx" target=_blank&gt;LINQ&lt;/A&gt; To SQL Questions &lt;A href="http://social.msdn.microsoft.com/forums/en-US/linqprojectgeneral/threads/" target=_blank&gt;here&lt;/A&gt;&lt;BR&gt;Post Entity Framework Questions &lt;A href="http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/threads/" target=_blank&gt;here&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Links that will answer questions:&lt;/STRONG&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;From the Dynamic Data architect &lt;A href="http://blogs.msdn.com/davidebb/default.aspx" target=_blank&gt;David Ebbo&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/davidebb/archive/2008/12/11/handling-database-exceptions-in-dynamic-data.aspx" target=_blank&gt;Handling database exceptions in Dynamic Data&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/davidebb/archive/2009/01/09/a-helper-to-easily-set-up-change-notifications-in-entity-framework.aspx" target=_blank&gt;A helper to easily set up change notifications in Entity Framework&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/davidebb/archive/2008/12/22/two-worlds-of-dynamic-data-customization-generic-vs-schema-specific.aspx" target=_blank&gt;Two worlds of Dynamic Data customization: generic vs schema specific&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/davidebb/archive/2008/12/11/using-dynamic-data-with-multiple-databases.aspx" target=_blank&gt;Using Dynamic Data with multiple databases&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/davidebb/archive/2008/11/26/fun-with-t4-templates-and-dynamic-data.aspx"&gt;Fun with T4 templates and Dynamic Data&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/davidebb/archive/2008/11/25/using-user-controls-as-page-templates-in-dynamic-data.aspx"&gt;Using User Controls as Page Templates in Dynamic Data&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/davidebb/archive/2008/10/25/a-many-to-many-field-template-for-dynamic-data.aspx"&gt;A ‘Many To Many’ field template for Dynamic Data&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/davidebb/archive/2008/06/18/using-asp-net-dynamic-data-with-objectdatasource.aspx"&gt;Using ASP.NET Dynamic Data with ObjectDataSource&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/davidebb/archive/2008/06/16/dynamic-data-and-the-associated-metadata-class.aspx"&gt;Dynamic Data and the Associated Metadata Class&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/davidebb/archive/2008/06/13/understanding-foreign-keys-and-relationship-columns-in-dynamic-data.aspx"&gt;Understanding foreign keys and relationship columns in Dynamic Data&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/davidebb/archive/2008/05/27/sample-dynamic-data-and-attribute-based-permissions.aspx"&gt;Sample: Dynamic Data and attribute based permissions&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/davidebb/archive/2008/05/25/dynamic-data-ajax-and-javascript-errors.aspx"&gt;Dynamic Data, AJAX and JavaScript errors&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;From &lt;/STRONG&gt;&lt;A href="http://blogs.msdn.com/rickAndy"&gt;&lt;STRONG&gt;http://blogs.msdn.com/rickAndy&lt;/STRONG&gt;&lt;/A&gt;&lt;STRONG&gt;&amp;nbsp; (Most samples include VB)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/rickandy/archive/2008/12/09/explicit-connection-string-for-ef.aspx"&gt;Explicit connection string for EF&lt;/A&gt; and L2S 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/rickandy/archive/2008/12/31/custom-validation-error-message-not-displayed.aspx"&gt;Custom Validation Error message not displayed&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/rickandy/archive/2008/11/22/improving-the-fk-field-display-showing-two-fields-in-foreign-key-columns-with-ef.aspx"&gt;Improving the FK field display: Showing two fields in Foreign Key columns&lt;/A&gt;&amp;nbsp; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/rickandy/archive/2008/10/04/how-to-create-an-updateable-view-with-ado-entity-framework.aspx"&gt;How to create an updateable view with ADO Entity Framework and with LINQ to SQL&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/rickandy/archive/2008/09/25/tweaking-the-filter-repeater.aspx"&gt;Tweaking the Filter Repeater&lt;/A&gt;&amp;nbsp; When you have too many FK to display in the filter repeater.&lt;/LI&gt;&lt;/UL&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;From ASP.Net Developer &lt;A href="http://weblogs.asp.net/davidfowler" target=_blank&gt;David Fowler&lt;/A&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://weblogs.asp.net/davidfowler/archive/2008/12/14/autofieldgenerator.aspx" target=_blank&gt;AutoFieldGenerators&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://weblogs.asp.net/davidfowler/archive/2008/12/14/dynamic-listview-layouttemplate.aspx"&gt;Dynamic ListView LayoutTemplate&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://weblogs.asp.net/davidfowler/archive/2008/12/11/dynamic-sorting-with-linq.aspx"&gt;Dynamic Sorting with Linq&lt;/A&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Q: How do I get started with Dynamic Data?&lt;BR&gt;&lt;/STRONG&gt;&lt;STRONG&gt;A: &lt;/STRONG&gt;If you like videos, see &lt;A href="http://www.asp.net/dynamicdata/" target=_blank mce_href="http://www.asp.net/dynamicdata/"&gt;ASP.NET Dynamic Data videos&lt;/A&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://msdn.microsoft.com/en-us/library/cc488545.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/cc488545.aspx"&gt;MSDN on Dynamic Data&lt;/A&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://msdn.microsoft.com/en-us/library/cc488469.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/cc488469.aspx"&gt;Walkthrough: Creating a New ASP.NET Dynamic Data Web Site Using Scaffolding&lt;/A&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A title=http://www.asp.net/dynamicdata/ href="http://www.asp.net/dynamicdata/" mce_href="http://www.asp.net/dynamicdata/"&gt;http://www.asp.net/dynamicdata/&lt;/A&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://forums.asp.net/1145.aspx" target=_blank mce_href="http://forums.asp.net/1145.aspx"&gt;Dynamic Data Forum&lt;/A&gt;&lt;/P&gt;&lt;STRONG&gt;Q: What's new with Dynamic Data for .Net 4 Beta?&amp;nbsp; &lt;FONT color=#ff0000&gt;&amp;lt;-- New&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;STRONG&gt;A: See &lt;A href="http://forums.asp.net/t/1425089.aspx"&gt;this link&lt;/A&gt;.&lt;/STRONG&gt; 
&lt;P&gt;&lt;STRONG&gt;Q: The data annotation to my partial class is not working?&lt;BR&gt;&lt;/STRONG&gt;&lt;STRONG&gt;A: &lt;/STRONG&gt;The most common problem is no namespace or incorrect namespace around your partial class. A partial class that is not part of the data model (or part of another class) is known as a naked partial class. The easiest way to test if you have a naked partial class is to add a non-existing field to the partial class. In the following snippet,&amp;nbsp; &lt;STRONG&gt;bogus&lt;/STRONG&gt; is not in the &lt;STRONG&gt;CustomerAddress&lt;/STRONG&gt; table. &lt;/P&gt;&lt;PRE class=code&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;MetadataType&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;typeof&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;CustomerAddressMetaData&lt;/SPAN&gt;))]
   &lt;SPAN style="COLOR: blue"&gt;public partial class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;CustomerAddress &lt;/SPAN&gt;{
       &lt;SPAN style="COLOR: blue"&gt;public class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;CustomerAddressMetaData &lt;/SPAN&gt;{

           [&lt;SPAN style="COLOR: #2b91af"&gt;ScaffoldColumn&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;)]
           &lt;SPAN style="COLOR: blue"&gt;public object &lt;/SPAN&gt;ModifiedDate;

           &lt;SPAN style="COLOR: blue"&gt;public object &lt;/SPAN&gt;bogus;
       }
   }&lt;/PRE&gt;
&lt;P&gt;When you run the Dynamic Data project, you will get the following exception in DefaultModel.RegisterContext (in global.asax):&lt;/P&gt;
&lt;P&gt;&lt;I&gt;The associated metadata type for type 'DynamicDataProject.CustomerAddress' contains the following unknown properties or fields: &lt;I&gt;bogus. Please make sure that the names of these members match the names of the properties on the main type.&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: How do I generate GUIDs on inserts?&lt;BR&gt;&lt;/STRONG&gt;&lt;STRONG&gt;A: &lt;/STRONG&gt;You don't, you shouldn't. Let the DB generate them or you will have performance problems. You can modify the data model XML and explicitly state they are DB generated. With the EDM, use StoreGeneratedPattern="Computed"&amp;nbsp; while Linq to SQL uses IsDbGenerated="true"&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: How to set Displayformat for a password field?&lt;BR&gt;&lt;/STRONG&gt;&lt;STRONG&gt;A: See Steve's excellent &lt;A href="http://csharpbits.notaclue.net/2009/05/password-fieldtemplates-for-dynamic.html"&gt;Password FieldTemplates for Dynamic Data&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: How do I check for duplicates before I insert? (Or get values from the DB for any reason before I insert)&lt;BR&gt;&lt;/STRONG&gt;&lt;STRONG&gt;A: &lt;/STRONG&gt;see &lt;A href="http://forums.asp.net/p/1358255/2794560.aspx"&gt;this post&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: How do I mark a columns as read-only?&lt;BR&gt;&lt;/STRONG&gt;&lt;STRONG&gt;A: &lt;/STRONG&gt;see &lt;A href="http://forums.asp.net/p/1375123/2888163.aspx" target=_blank&gt;this post&lt;/A&gt; or &lt;A class="" title=1498010850596349197 name=1498010850596349197&gt;&lt;/A&gt;&lt;A href="http://csharpbits.notaclue.net/2009/01/making-field-read-only-via.html"&gt;Making a Field Read-Only via the ReadOnlyAttribute – Dynamic Data&lt;/A&gt; - Note the next version of Dynamic Data And The &lt;A href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24887"&gt;ASP.NET Dynamic Data 4.0 Preview 3&lt;/A&gt; support the [ReadOnly(true)] attribute.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: Can Dynamic Data use a data model generated by a 3rd party O/RM tool?&lt;BR&gt;&lt;/STRONG&gt;A:The current Dynamic Data needs the following items to work with a technology: &lt;BR&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp; Technology must support Linq&lt;BR&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp; DataSource control must exist for the technology&lt;BR&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp; Dynamic Data ModelProvider must exist for the technology &lt;/P&gt;
&lt;P&gt;An example of one today is LLBLGen: &lt;A href="http://www.llblgen.com/defaultgeneric.aspx" mce_href="http://www.llblgen.com/defaultgeneric.aspx"&gt;http://www.llblgen.com/defaultgeneric.aspx&lt;/A&gt; 
&lt;P&gt;&lt;A href="http://www.hibernate.org/343.html" target=_blank mce_href="http://www.hibernate.org/343.html"&gt;nHibernate&lt;/A&gt; currently does not meet the Linq requirements. 
&lt;P&gt;&lt;STRONG&gt;Q: What DB's are supported?&lt;BR&gt;A: See &lt;A href="http://msdn.microsoft.com/en-us/data/dd363565.aspx" target=_blank&gt;ADO.NET Entity Framework Providers&lt;/A&gt;&lt;/STRONG&gt; 
&lt;P&gt;&lt;STRONG&gt;Q: How do I hide columns from the Edit and other page templates?&lt;/STRONG&gt; &lt;BR&gt;&lt;STRONG&gt;A: &lt;/STRONG&gt;Suppose you want to display the Salary field, but you don't want to show it in the Edit and Insert templates. See Stephens popular tutorial 
&lt;P&gt;&lt;A href="http://csharpbits.notaclue.net/2008/10/dynamic-data-hiding-columns-in-selected.html" target=_blank mce_href="http://csharpbits.notaclue.net/2008/10/dynamic-data-hiding-columns-in-selected.html"&gt;Dynamic Data - Hiding Columns in selected PageTemplates&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: How do I disallow navigation links on Foreign Key columns?&lt;BR&gt;&lt;/STRONG&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; By default, DD displays the first string column in the Foreign Key table in stead of the FK. This is rendered as a link (&lt;FONT color=#ff0000&gt;NavigateUrl&lt;/FONT&gt;) to the FK table. If you're not happy with the default (column shown) use the DisplayColumn attribute on the FK table to specify which property is displayed. See also &lt;A href="http://blogs.msdn.com/rickandy/archive/2008/11/22/improving-the-fk-field-display-showing-two-fields-in-foreign-key-columns-with-ef.aspx"&gt;Improving the FK field display: Showing two fields in Foreign Key columns&lt;/A&gt;. Back to the original question. The easiest way to disable the FK property from being a NavigateUrl is to hide the FK table by annotating your entity partial class with the &lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.scaffoldtableattribute.aspx" target=_blank&gt;ScaffoldTable&lt;/A&gt;&amp;nbsp;&amp;nbsp; attribute. Note,&amp;nbsp; &lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.scaffoldtableattribute.aspx" target=_blank&gt;ScaffoldTable&lt;/A&gt;&amp;nbsp;&amp;nbsp; will hide your table. If you want to expose your table but disable the hyperlink - see Stephens excellent blog &lt;A href="http://csharpbits.notaclue.net/2009/01/allow-navigation-on-foreignkey.html"&gt;Allow Navigation on ForeignKey FieldTemplate – Dynamic Data&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: How do I move the &lt;FONT color=#0000ff&gt;Edit Delete Details&lt;/FONT&gt; links from the left side (column 0) to the right side of the table.&lt;BR&gt;&lt;/STRONG&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; Create your own &lt;A href="http://msdn.microsoft.com/en-us/library/system.web.ui.iautofieldgenerator.generatefields.aspx" target=_blank&gt;IAutoFieldGenerator.GenerateFields&lt;/A&gt; and add the command field at the end. (thx David Fowler). See &lt;A href="http://forums.asp.net/p/1379821/2917320.aspx" target=_blank&gt;this post&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: How do I implement role based security? (tables/columns visibility dependent on users role).&lt;BR&gt;A: See &lt;A href="http://forums.asp.net/t/1343958.aspx" target=_blank&gt;this&lt;/A&gt; post, and &lt;A href="http://weblogs.asp.net/davidfowler/archive/2008/12/14/autofieldgenerator.aspx"&gt;custom IAutoFieldGenerator&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: How do map stored procedures (sprocs) to Inserts and get back the auto generated PK using L2S?&lt;BR&gt;&lt;/STRONG&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; See &lt;A href="http://weblogs.asp.net/scottgu/archive/2007/08/23/linq-to-sql-part-7-updating-our-database-using-stored-procedures.aspx"&gt;LINQ to SQL (Part 7 - Updating our Database using Stored Procedures)&lt;/A&gt; , &lt;A href="http://msdn.microsoft.com/en-us/library/bb386946.aspx"&gt;Stored Procedures (LINQ to SQL)&lt;/A&gt; and &lt;A href="http://forums.asp.net/t/1412943.aspx"&gt;How to override default insert method of Details View in Dynamic Data&lt;/A&gt; .&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9300193" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/rickandy/archive/tags/Dynamic+Data/default.aspx">Dynamic Data</category></item><item><title>Custom Validation Error message not displayed</title><link>http://blogs.msdn.com/rickandy/archive/2008/12/31/custom-validation-error-message-not-displayed.aspx</link><pubDate>Thu, 01 Jan 2009 01:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9259015</guid><dc:creator>ricka0</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9259015.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9259015</wfw:commentRss><description>&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A customer &lt;A href="http://forums.asp.net/t/1365732.aspx" target=_blank mce_href="http://forums.asp.net/t/1365732.aspx"&gt;pointed out&lt;/A&gt; that his Spanish validation error messages were not being displayed; the default Error message was shown instead.&amp;nbsp; I'll use the Products table from the NorthWind Db to reproduce the problem and show a work-around.&lt;/P&gt;
&lt;P&gt;Create a partial class for the Products entity:&lt;/P&gt;&lt;PRE class=csharpcode&gt; [MetadataType(&lt;SPAN class=kwrd&gt;typeof&lt;/SPAN&gt;(ProductsMD))]
    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;partial&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; Products {
        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; ProductsMD {
            [DataType(&lt;SPAN class=str&gt;"dummy"&lt;/SPAN&gt;, ErrorMessage = &lt;SPAN class=str&gt;"El campo debe ser un entero positivo"&lt;/SPAN&gt;)]
            [DisplayName(&lt;SPAN class=str&gt;"En la acción"&lt;/SPAN&gt;)]
            &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; UnitsInStock { get; set; }
        }
    }&lt;/PRE&gt;&lt;PRE class=csharpcode&gt;VB&lt;/PRE&gt;&lt;PRE class=csharpcode&gt;    &amp;lt;MetadataType(&lt;SPAN class=kwrd&gt;GetType&lt;/SPAN&gt;(ProductsMD))&amp;gt; _
&lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Class&lt;/SPAN&gt; Products
        &lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Class&lt;/SPAN&gt; ProductsMD
            &amp;lt;DataType(&lt;SPAN class=str&gt;"dummy"&lt;/SPAN&gt;, ErrorMessage:=&lt;SPAN class=str&gt;"El campo debe ser un entero positivo"&lt;/SPAN&gt;), _
             DisplayName(&lt;SPAN class=str&gt;"En la acción"&lt;/SPAN&gt;)&amp;gt; _
            &lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Property&lt;/SPAN&gt; UnitsInStock() &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Object&lt;/SPAN&gt;
            &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Property&lt;/SPAN&gt;
        &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Class&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; Class&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;

&lt;P&gt;Navigate to the Products table, edit a row, and change the &lt;STRONG&gt;UnitsInStock&lt;/STRONG&gt; to a letter. Select update and you will get a default error message, not the message applied with the &lt;STRONG&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.datatypeattribute.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.datatypeattribute.aspx"&gt;DataType&lt;/A&gt;&lt;/STRONG&gt; attribute. &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://blogs.msdn.com/photos/ricka/images/9258973/original.aspx" mce_src="http://blogs.msdn.com/photos/ricka/images/9258973/original.aspx"&gt; &lt;/P&gt;
&lt;P&gt;The example above was doomed to failure as the &lt;STRONG&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.datatypeattribute.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.datatypeattribute.aspx"&gt;DataType&lt;/A&gt;&lt;/STRONG&gt; attribute above does not match the &lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.datatype.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.datatype.aspx"&gt;&lt;STRONG&gt;DataType&lt;/STRONG&gt;&lt;/A&gt; enum or have a matching field template.&lt;/P&gt;
&lt;P&gt;There are a couple of possible solutions for displaying custom validation errors on integer conversion failure. You can add the compare validator message that will be displayed for any validation error. The code should be added as the last statement of the &lt;STRONG&gt;Page_Load&lt;/STRONG&gt; method in the DynamicData\FieldTemplates\Integer_Edit.ascx.cs&amp;nbsp; (or .vb) file.&lt;/P&gt;
&lt;P&gt;CompareValidator1.ErrorMessage = String.Format(&lt;SPAN class=str&gt;"El campo {0} debe ser un entero"&lt;/SPAN&gt;, Column.DisplayName);&lt;/P&gt;
&lt;P&gt;or for VB&lt;/P&gt;
&lt;P&gt;CompareValidator1.ErrorMessage = &lt;SPAN class=kwrd&gt;String&lt;/SPAN&gt;.Format(&lt;SPAN class=str&gt;"El campo {0} debe ser un entero"&lt;/SPAN&gt;, Column.DisplayName)&lt;/P&gt;
&lt;P&gt;Entering a non-integer such as Z to the &lt;STRONG&gt;units in stock&lt;/STRONG&gt; field now yields the following error message:&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#ff0000&gt;El campo En la acción debe ser un entero&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Adding the &lt;STRONG&gt;CompareValidator1.ErrorMessage&lt;/STRONG&gt; to the integer template works for every scaffolded integer. &lt;/P&gt;
&lt;P&gt;For more flexibility, you can extract the custom message from the data model partial class. Replace the CompareValidator1.ErrorMessage&amp;nbsp; line above with the following in the &lt;STRONG&gt;Page_Load&lt;/STRONG&gt; method.&lt;/P&gt;&lt;PRE class=csharpcode&gt; var dataTypeAttribute = MetadataAttributes.OfType&amp;lt;DataTypeAttribute&amp;gt;().SingleOrDefault();

 &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (dataTypeAttribute != &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;) {
    CompareValidator1.ErrorMessage = dataTypeAttribute.FormatErrorMessage(Column.DisplayName);
 }&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;

&lt;P&gt;VB&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; dataTypeAttribute = MetadataAttributes.OfType(Of DataTypeAttribute)().SingleOrDefault() 

&lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt; dataTypeAttribute IsNot &lt;SPAN class=kwrd&gt;Nothing&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Then&lt;/SPAN&gt; 
    CompareValidator1.ErrorMessage = dataTypeAttribute.FormatErrorMessage(Column.DisplayName) 
&lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt; &lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;

&lt;P&gt;Even simpler than adding a dummy attribute and extracting the error message;&amp;nbsp; use the &lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.regularexpressionattribute.aspx" target=_blank&gt;&lt;STRONG&gt;RegularExpression&lt;/STRONG&gt;&lt;/A&gt; attribute and allow only positive integers. The following snippet fixes the error message problem without requiring you to extract the error message in the &lt;STRONG&gt;Page_Load&lt;/STRONG&gt; method.&lt;/P&gt;&lt;PRE class=csharpcode&gt;  [MetadataType(&lt;SPAN class=kwrd&gt;typeof&lt;/SPAN&gt;(ProductsMD))]
    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;partial&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; Products {
        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; ProductsMD {
  &lt;SPAN class=rem&gt;//          [DataType("dummy", ErrorMessage = "El campo debe ser un entero positivo")]&lt;/SPAN&gt;
            [RegularExpression(&lt;SPAN class=str&gt;@"^0*[1-9][0-9]*$"&lt;/SPAN&gt;, ErrorMessage = &lt;SPAN class=str&gt;"Must be a entero positivo"&lt;/SPAN&gt;)]
            [DisplayName(&lt;SPAN class=str&gt;"En la acción"&lt;/SPAN&gt;)]
            &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; UnitsInStock { get; set; }
        }
    }&lt;/PRE&gt;&lt;PRE class=csharpcode&gt;VB&lt;/PRE&gt;&lt;PRE class=csharpcode&gt;&amp;lt;MetadataType(&lt;SPAN class=kwrd&gt;GetType&lt;/SPAN&gt;(ProductsMD))&amp;gt; _ 
&lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; Partial &lt;SPAN class=kwrd&gt;Class&lt;/SPAN&gt; Products 
    &lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Class&lt;/SPAN&gt; ProductsMD 
&lt;SPAN class=kwrd&gt;Private&lt;/SPAN&gt; _UnitsInStock &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Object&lt;/SPAN&gt; 
        &lt;SPAN class=rem&gt;' [DataType("dummy", ErrorMessage = "El campo debe ser un entero positivo")] &lt;/SPAN&gt;
        &amp;lt;RegularExpression(&lt;SPAN class=str&gt;"^0*[1-9][0-9]*$"&lt;/SPAN&gt;, ErrorMessage := &lt;SPAN class=str&gt;"Must be a entero positivo"&lt;/SPAN&gt;)&amp;gt; _ 
        &amp;lt;DisplayName(&lt;SPAN class=str&gt;"En la acción"&lt;/SPAN&gt;)&amp;gt; _ 
        &lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Property&lt;/SPAN&gt; UnitsInStock() &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Object&lt;/SPAN&gt; 
            &lt;SPAN class=kwrd&gt;Get&lt;/SPAN&gt; 
                &lt;SPAN class=kwrd&gt;Return&lt;/SPAN&gt; _UnitsInStock 
            &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Get&lt;/SPAN&gt; 
            &lt;SPAN class=kwrd&gt;Set&lt;/SPAN&gt;(&lt;SPAN class=kwrd&gt;ByVal&lt;/SPAN&gt; value &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Object&lt;/SPAN&gt;) 
                _UnitsInStock = value 
            &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Set&lt;/SPAN&gt; 
        &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Property&lt;/SPAN&gt; 
    &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Class&lt;/SPAN&gt; 
&lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Class&lt;/SPAN&gt; &lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;

&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;

&lt;P&gt;Notes: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;We are using the &lt;STRONG&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.datatypeattribute.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.datatypeattribute.aspx"&gt;DataType&lt;/A&gt;&lt;/STRONG&gt; attribute as a dummy attribute so we can extract our custom error message when a validation error occurs. 
&lt;LI&gt;This is a known bug that should be fixed in the next release.&lt;BR&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;

&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9259015" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/rickandy/archive/tags/Dynamic+Data/default.aspx">Dynamic Data</category><category domain="http://blogs.msdn.com/rickandy/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>Explicit connection string for EF</title><link>http://blogs.msdn.com/rickandy/archive/2008/12/09/explicit-connection-string-for-ef.aspx</link><pubDate>Tue, 09 Dec 2008 21:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9187857</guid><dc:creator>ricka0</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9187857.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9187857</wfw:commentRss><description>&lt;P mce_keep="true"&gt;The default constructor for the &lt;A href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.aspx"&gt;ObjectContext&lt;/A&gt; class in the&amp;nbsp; Entity Data Model (EDM) retrieves the construction string from the &lt;STRONG&gt;web.config&lt;/STRONG&gt; or &lt;STRONG&gt;app.config&lt;/STRONG&gt; file. If you have multiple data models or need to pass in the the construction string at run time you must use the &lt;A href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.aspx"&gt;ObjectContext&lt;/A&gt; constructor that takes a construction string. (Note: Be sure to see the bug/work-around at the end of this article.) The follow snippet shows how to build the string for integrated security.&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=rem&gt;//  copy connection string from app.config or web.config  &lt;/SPAN&gt;

    &lt;SPAN class=rem&gt;// connectionString="metadata=res://*;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;// provider=System.Data.SqlClient;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;// provider connection string=&amp;amp;quot;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;// Data Source=ricka0;Initial Catalog=Northwind;Persist Security Info=True;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;// User ID=sa;Password=*(IU89iu;MultipleActiveResultSets=True&amp;amp;quot;"&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;// providerName="System.Data.EntityClient" &lt;/SPAN&gt;
    

    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;static&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; UglyConStr() {

        &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=str&gt;"metadata=res://*;"&lt;/SPAN&gt;
          + &lt;SPAN class=str&gt;"provider=System.Data.SqlClient;"&lt;/SPAN&gt;
          + &lt;SPAN class=str&gt;"provider connection string=';"&lt;/SPAN&gt;  &lt;SPAN class=rem&gt;// Replace &amp;amp;quot with ' (single quote)&lt;/SPAN&gt;
        + &lt;SPAN class=str&gt;"Data Source=ricka0;"&lt;/SPAN&gt;
        + &lt;SPAN class=str&gt;"Initial Catalog=Northwind;"&lt;/SPAN&gt;
        + &lt;SPAN class=str&gt;"Persist Security Info=True;"&lt;/SPAN&gt;
        + &lt;SPAN class=str&gt;"User ID=sa;Password=*(IU89iu;"&lt;/SPAN&gt;
        + &lt;SPAN class=str&gt;"MultipleActiveResultSets=True';"&lt;/SPAN&gt;  &lt;SPAN class=rem&gt;// Replace &amp;amp;quot with ' (single quote)&lt;/SPAN&gt;
            &lt;SPAN class=rem&gt;//    + "providerName=\"System.Data.EntityClient\""&lt;/SPAN&gt;
        ;
    }&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;

&lt;P&gt;While the construction string above works, it's very ugly. The hair pulling trick to get it working is replacing &lt;STRONG&gt;&amp;amp;quot&lt;/STRONG&gt; with a single quote &lt;STRONG&gt;&lt;FONT size=5&gt;' &lt;/FONT&gt;&lt;/STRONG&gt;as shown in the comments. Using&amp;nbsp; the raw connection string from the config file (using &amp;amp;quot ) results in a misleading error message &lt;STRONG&gt;&lt;EM&gt;Keyword not supported: 'data source'&lt;/EM&gt;&lt;/STRONG&gt;.&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;A much more elegant construction string using SQL connection is shown below.&lt;/P&gt;&lt;PRE class=csharpcode&gt; &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;static&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; getConStrSQL() {

        &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; connectionString = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; System.Data.EntityClient.EntityConnectionStringBuilder
        {
            Metadata = &lt;SPAN class=str&gt;"res://*"&lt;/SPAN&gt;,
            Provider = &lt;SPAN class=str&gt;"System.Data.SqlClient"&lt;/SPAN&gt;,
            ProviderConnectionString = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; System.Data.SqlClient.SqlConnectionStringBuilder
            {
                InitialCatalog = &lt;SPAN class=str&gt;"Northwind"&lt;/SPAN&gt;,
                DataSource = &lt;SPAN class=str&gt;"ricka0"&lt;/SPAN&gt;,
                IntegratedSecurity = &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;,
                UserID = getUID(),                 &lt;SPAN class=rem&gt;// User ID such as "sa"&lt;/SPAN&gt;
                Password = getPWD(),               &lt;SPAN class=rem&gt;// hide the password&lt;/SPAN&gt;
            }.ConnectionString
        }.ConnectionString;

        &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; connectionString;
    }&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;

&lt;P&gt;In VB:&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Shared&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Function&lt;/SPAN&gt; getConStrSQL() &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;String&lt;/SPAN&gt;
     &lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; connectionString &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;String&lt;/SPAN&gt; = &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; System.Data.EntityClient.EntityConnectionStringBuilder() _
         &lt;SPAN class=kwrd&gt;With&lt;/SPAN&gt; {.Metadata = &lt;SPAN class=str&gt;"res://*"&lt;/SPAN&gt;, _
               .Provider = &lt;SPAN class=str&gt;"System.Data.SqlClient"&lt;/SPAN&gt;, _
               .ProviderConnectionString = &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; System.Data.SqlClient.SqlConnectionStringBuilder() _
                 &lt;SPAN class=kwrd&gt;With&lt;/SPAN&gt; {.InitialCatalog = &lt;SPAN class=str&gt;"Northwind"&lt;/SPAN&gt;, _
                       .DataSource = &lt;SPAN class=str&gt;"ricka0"&lt;/SPAN&gt;, _
                       .IntegratedSecurity = &lt;SPAN class=kwrd&gt;False&lt;/SPAN&gt;, _
                       .UserID = getUID(), _
                       .Password = getPWD()}.ConnectionString}.ConnectionString
     &lt;SPAN class=kwrd&gt;Return&lt;/SPAN&gt; connectionString
 &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; Function&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;

&lt;P&gt;The integrated security approach is slightly different.&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;static&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; getConStrIntegrated() {

        &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; conStrIntegratedSecurity = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; System.Data.EntityClient.EntityConnectionStringBuilder
           {
               Metadata = &lt;SPAN class=str&gt;"res://*"&lt;/SPAN&gt;,
               Provider = &lt;SPAN class=str&gt;"System.Data.SqlClient"&lt;/SPAN&gt;,
               ProviderConnectionString = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; System.Data.SqlClient.SqlConnectionStringBuilder
               {
                   InitialCatalog = &lt;SPAN class=str&gt;"NorthwindEF"&lt;/SPAN&gt;,
                   DataSource = &lt;SPAN class=str&gt;"bing0"&lt;/SPAN&gt;,
                   IntegratedSecurity = &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;,
               }.ConnectionString
           }.ConnectionString;

        &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; conStrIntegratedSecurity;
    }&lt;/PRE&gt;&lt;PRE class=csharpcode&gt;For Dynamic Data, simply pass the construction string to the &lt;A href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.metamodel.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.metamodel.aspx"&gt;MetaModel&lt;/A&gt; &lt;A href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.metamodel.registercontext.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.metamodel.registercontext.aspx"&gt;RegisterContext&lt;/A&gt; as follows. &lt;/PRE&gt;&lt;PRE class=csharpcode&gt; &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;static&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; RegisterRoutes(RouteCollection routes) {
        MetaModel model = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; MetaModel();


        model.RegisterContext(() =&amp;gt; &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; NorthwindModel.NorthwindEntities(getConStrIntegrated()),
            &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; ContextConfiguration()
            {
                ScaffoldAllTables = &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;
            });

        &lt;SPAN class=rem&gt;// Routes omitted for clarity&lt;/SPAN&gt;
    }&lt;/PRE&gt;
&lt;P&gt;Unfortunately, the current version of Dynamic Data doesn't support this approach with EF (L2S does work). To get the page templates to use the connection string you must add the following line to the Page_Load method in the page templates.&lt;/P&gt;&lt;PRE class=csharpcode&gt;GridDataSource.ContextCreating += &lt;SPAN class=kwrd&gt;delegate&lt;/SPAN&gt;(&lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; ceSender, System.Web.UI.WebControls.EntityDataSourceContextCreatingEventArgs ceArgs) {
            ceArgs.Context = (System.Data.Objects.ObjectContext)table.CreateContext();
        };&lt;/PRE&gt;
&lt;P&gt;The complete Page_Load is below&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;protected&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; Page_Load(&lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; sender, EventArgs e) {
        table = GridDataSource.GetTable();

         GridDataSource.ContextCreating += &lt;SPAN class=kwrd&gt;delegate&lt;/SPAN&gt;(&lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; ceSender, System.Web.UI.WebControls.EntityDataSourceContextCreatingEventArgs ceArgs) {
            ceArgs.Context = (System.Data.Objects.ObjectContext)table.CreateContext();
        }; 

        Title = table.DisplayName;
        GridDataSource.Include = table.ForeignKeyColumnsNames;
        InsertHyperLink.NavigateUrl = table.GetActionPath(PageAction.Insert);

        &lt;SPAN class=rem&gt;// Disable various options if the table is readonly&lt;/SPAN&gt;
        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (table.IsReadOnly) {
            GridView1.Columns[0].Visible = &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;
            InsertHyperLink.Visible = &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;
        }
    }&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9187857" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/rickandy/archive/tags/Dynamic+Data/default.aspx">Dynamic Data</category><category domain="http://blogs.msdn.com/rickandy/archive/tags/Connection+String/default.aspx">Connection String</category></item><item><title>Improving the FK field display: Showing two fields in Foreign Key columns</title><link>http://blogs.msdn.com/rickandy/archive/2008/11/22/improving-the-fk-field-display-showing-two-fields-in-foreign-key-columns-with-ef.aspx</link><pubDate>Sat, 22 Nov 2008 06:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9132537</guid><dc:creator>ricka0</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/9132537.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=9132537</wfw:commentRss><description>&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The default scaffold of the &lt;STRONG&gt;CustomerAddress&lt;/STRONG&gt; table in the AdventureWorksLT database poses a problem: Dynamic Data (DD) defaults to using the first string field in the referenced table. In this case, the first string field is the &lt;STRONG&gt;Title&lt;/STRONG&gt; field (Mr,Ms, and so on).&amp;nbsp; The image below shows the problem with the &lt;STRONG&gt;FilterRepeater&lt;/STRONG&gt; drop down list and &lt;STRONG&gt;Customer&lt;/STRONG&gt; column elements.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://blogs.msdn.com/photos/ricka/images/9132516/original.aspx" mce_src="http://blogs.msdn.com/photos/ricka/images/9132516/original.aspx"&gt;&lt;/P&gt;
&lt;P&gt;We can take a first step toward fixing this issue by creating and annotating a partial class for the&amp;nbsp;&lt;STRONG&gt;Customer&lt;/STRONG&gt; entity. The code below now displays the &lt;STRONG&gt;LastName&lt;/STRONG&gt; field for the customer entity. The &lt;STRONG&gt;&lt;A class="" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.displaycolumnattribute.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.displaycolumnattribute.aspx"&gt;DisplayColumn&lt;/A&gt;&lt;/STRONG&gt; attribute tells referring entities which column to use for display instead of the Foreign Key field.&lt;/P&gt;&lt;PRE class=csharpcode&gt; [DisplayColumn(&lt;SPAN class=str&gt;"LastName"&lt;/SPAN&gt;)]
 [MetadataType(&lt;SPAN class=kwrd&gt;typeof&lt;/SPAN&gt;(CustomerMetaData))]
 &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;partial&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; Customer {
      &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; CustomerMetaData {
   }
 }&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;While the resulting view is an improvement, it’s not there yet. Note that it doesn't distinguish between the customers with non-unique last names, such as Adams or Liu.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://blogs.msdn.com/photos/ricka/images/9132521/original.aspx" mce_src="http://blogs.msdn.com/photos/ricka/images/9132521/original.aspx"&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To fix this, we overload the &lt;STRONG&gt;ToString&lt;/STRONG&gt; method for the &lt;STRONG&gt;Customer&lt;/STRONG&gt; partial class as shown below:&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=rem&gt;// [DisplayColumn("LastName")]&lt;/SPAN&gt;
[MetadataType(&lt;SPAN class=kwrd&gt;typeof&lt;/SPAN&gt;(CustomerMetaData))]
&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;partial&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; Customer {

     &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;override&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; ToString() {
         &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; LastName.ToString() + &lt;SPAN class=str&gt;", "&lt;/SPAN&gt; + FirstName.ToString();
     }

     &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; CustomerMetaData {

}&lt;/PRE&gt;
&lt;P&gt;The resulting display gets it right: the code now shows the correct field, and it distinguishes between David, Jinghao and Kevin Liu.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://blogs.msdn.com/photos/ricka/images/9132534/original.aspx" mce_src="http://blogs.msdn.com/photos/ricka/images/9132534/original.aspx"&gt; &lt;/P&gt;
&lt;P&gt;Special thanks to &lt;A href="http://blogs.msdn.com/davidebb/default.aspx" target=_blank mce_href="http://blogs.msdn.com/davidebb/default.aspx"&gt;David Ebbo&lt;/A&gt; for recommending the ToString() approach and &lt;A href="http://haacked.com/archive/2006/04/13/CallingDibsOnBlogging.aspx" target=_blank mce_href="http://haacked.com/archive/2006/04/13/CallingDibsOnBlogging.aspx"&gt;Phil Haack&lt;/A&gt; for granting me blog dibs.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9132537" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/rickandy/archive/tags/Dynamic+Data/default.aspx">Dynamic Data</category><category domain="http://blogs.msdn.com/rickandy/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>How to create an updateable view with ADO Entity Framework and with LINQ to SQL</title><link>http://blogs.msdn.com/rickandy/archive/2008/10/04/how-to-create-an-updateable-view-with-ado-entity-framework.aspx</link><pubDate>Sat, 04 Oct 2008 05:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8976086</guid><dc:creator>ricka0</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/rickandy/comments/8976086.aspx</comments><wfw:commentRss>http://blogs.msdn.com/rickandy/commentrss.aspx?PostID=8976086</wfw:commentRss><description>&lt;P&gt;Creating an update-able view with&amp;nbsp; ADO Entity Framework (EF) or LINQ to SQL (L2S) is a fairly advanced topic and not directly associated with Dynamic Data. At the end of the article I have a sample console application to verify the modified L2S data model allows updates on a view. To create an update-able view, you must modify the wizard (or other tool) generated XML file (data model). Each time you generate a new data model (for example when the schema changes), you will need to reapply these steps. 
&lt;P&gt;ADO Entity Framework (EF) makes views Read Only via the &amp;lt;DefiningQuery&amp;gt; element. You make the data model view update-able by removing the &amp;lt;DefiningQuery&amp;gt; element and making a few minor changes. Note the example below is a very simple view on one table and includes the primary key. 
&lt;P&gt;This is what I did to make an update-able view for the AdventureWorksLT DB &lt;SPAN class=sqlkwd&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;
&lt;P&gt;CREATE&lt;/FONT&gt;&lt;FONT size=+0&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;VIEW&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; [SalesLT]&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;[vAddr]&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt; &lt;BR&gt;AS &lt;BR&gt;SELECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; AddressID&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;[AddressLine1]&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;[City]&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;[StateProvince]&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;[CountryRegion]&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;[PostalCode] &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;FROM&lt;/FONT&gt;&lt;FONT size=+0&gt; [AdventureWorksLT2008]&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;[SalesLT]&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;[Address]&lt;/FONT&gt;&lt;/SPAN&gt; 
&lt;P&gt;The next line shows this view is update-able (at least from T-SQL)&amp;nbsp;&amp;nbsp; 
&lt;P&gt;&lt;SPAN class=sqlkwd&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;UPDATE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; vAddr &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;SET&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; PostalCode &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;FONT color=#ff0000&gt;'54321'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;WHERE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; addressID &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; 11382 &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;AND&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; &lt;BR&gt;StateProvince &lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;FONT color=#ff0000&gt;'WA'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; &lt;PRE class=coloredcode&gt;&lt;/FONT&gt;&lt;/SPAN&gt; (18 row(s) affected) &lt;/PRE&gt;
&lt;P&gt;Edit the EF SSDL, comment out the &amp;lt;DefiningQuery&amp;gt; , remove store: prefix from &lt;FONT color=#ff0000&gt;&lt;FONT color=#ff0000&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;FONT color=#ff0000&gt;Schema&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;SalesLT&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=3&gt;and remove store:Name="vAddr" . The commented/changed code below&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;
&lt;P&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;FONT color=#a31515&gt;EntitySet&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;Address&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;FONT color=#ff0000&gt;EntityType&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;AdventureWorksLT2008Model.Store.Address&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;FONT color=#ff0000&gt;store:Type&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;Tables&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;FONT color=#ff0000&gt;Schema&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;SalesLT&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt; /&amp;gt; &lt;BR&gt;&amp;lt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;FONT color=#a31515&gt;EntitySet&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;vAddr&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;FONT color=#ff0000&gt;EntityType&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;AdventureWorksLT2008Model.Store.vAddr&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;FONT color=#ff0000&gt;store:Type&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;Views&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;FONT color=#ff0000&gt;Schema&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;SalesLT&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt; /&amp;gt; 
&lt;P&gt;&amp;lt;!--&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;FONT color=#008000&gt;&amp;lt;EntitySet Name="vAddr" EntityType="AdventureWorksLT2008Model.Store.vAddr" store:Type="Views" store:Schema="SalesLT" store:Name="vAddr"&amp;gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;--&amp;gt;&lt;BR&gt;&amp;lt;!--&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;FONT color=#008000&gt;&amp;lt;DefiningQuery&amp;gt;SELECT [vAddr].[AddressID] AS [AddressID], [vAddr].[AddressLine1] AS [AddressLine1], [vAddr].[City] AS [City], &lt;BR&gt;[vAddr].[StateProvince] AS [StateProvince], &lt;BR&gt;[vAddr].[CountryRegion] AS [CountryRegion], &lt;BR&gt;[vAddr].[PostalCode] AS [PostalCode] &lt;BR&gt;FROM [SalesLT].[vAddr] AS [vAddr]&amp;lt;/DefiningQuery&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;--&amp;gt; &lt;BR&gt;&amp;lt;!--&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;&lt;FONT color=#008000&gt;&amp;lt;/EntitySet&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;--&amp;gt; 
&lt;P&gt;&amp;lt;/&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;FONT color=#a31515&gt;EntityContainer&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#000000&gt;
&lt;H1&gt;LINQ to SQL is the simplest.&lt;/H1&gt;Using the view above, &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#000000&gt;Simply change the following line in the wizard generated code to use&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT size=+0&gt;AutoSync = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;&lt;FONT color=#2b91af&gt;AutoSync&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;&lt;FONT color=#000000&gt;.OnInsert &lt;/FONT&gt;&lt;FONT size=+0&gt;&lt;FONT color=#000000&gt;in lieu of &lt;FONT size=+0&gt;AutoSync=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;&lt;FONT color=#2b91af&gt;AutoSync&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;FONT size=+0&gt;.Always &lt;/FONT&gt;on the AddressID property.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; &lt;SPAN class=cmt&gt;&lt;BR&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&lt;FONT color=#008000&gt;// [Column(Storage="_AddressID", AutoSync=AutoSync.Always, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; &lt;BR&gt;[Column(Storage = &lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;FONT color=#a31515&gt;"_AddressID"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;, AutoSync = AutoSync.OnInsert, DbType = &lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;FONT color=#a31515&gt;"Int NOT NULL IDENTITY"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;, IsPrimaryKey = &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;, IsDbGenerated = &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt;)] &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;public&lt;/FONT&gt;&lt;FONT size=+0&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=+0&gt; AddressID&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#000000&gt;The following example shows how to test the view from a console application.&lt;/FONT&gt;&lt;/P&gt;&lt;PRE class=code&gt;&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;System.Data.Linq;
&lt;SPAN style="COLOR: blue"&gt;using &lt;/SPAN&gt;System.Data.Linq.Mapping;

&lt;SPAN style="COLOR: blue"&gt;namespace &lt;/SPAN&gt;updateableView {

        &lt;SPAN style="COLOR: blue"&gt;public class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;T &lt;/SPAN&gt;{
            &lt;SPAN style="COLOR: blue"&gt;public &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;LTDataContext &lt;/SPAN&gt;db;
            &lt;SPAN style="COLOR: green"&gt;//    readonly string con = "Data Source=bing0;Initial Catalog=AdventureWorksLT2008;Integrated Security=True";
            &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;readonly string &lt;/SPAN&gt;con = &lt;SPAN style="COLOR: #a31515"&gt;"Data Source=bing0;Initial Catalog=AdventureWorksLT2008;" &lt;/SPAN&gt;+
                                   &lt;SPAN style="COLOR: #a31515"&gt;"Persist Security Info=True;User ID=sa;Password=*(IU89iu"&lt;/SPAN&gt;;

            &lt;SPAN style="COLOR: blue"&gt;public &lt;/SPAN&gt;T() {
                db = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;LTDataContext&lt;/SPAN&gt;(con);
            }

            &lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;addAddr(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;city) {

                &lt;SPAN style="COLOR: #2b91af"&gt;vAddr &lt;/SPAN&gt;adr = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;vAddr&lt;/SPAN&gt;();
                adr.AddressLine1 = &lt;SPAN style="COLOR: #a31515"&gt;"1234 N St."&lt;/SPAN&gt;;
                adr.City = city;
                adr.PostalCode = &lt;SPAN style="COLOR: #a31515"&gt;"99966"&lt;/SPAN&gt;;
                adr.StateProvince = &lt;SPAN style="COLOR: #a31515"&gt;"Mt"&lt;/SPAN&gt;;
                adr.CountryRegion = &lt;SPAN style="COLOR: #a31515"&gt;"None"&lt;/SPAN&gt;;

                db.vAddrs.InsertOnSubmit(adr);
                db.SubmitChanges();
            }

            &lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;tq(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;city) {

                &lt;SPAN style="COLOR: #2b91af"&gt;Table&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;vAddr&lt;/SPAN&gt;&amp;gt; addr = db.GetTable&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;vAddr&lt;/SPAN&gt;&amp;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;addr
                        &lt;SPAN style="COLOR: blue"&gt;where &lt;/SPAN&gt;c.City == city
                        &lt;SPAN style="COLOR: blue"&gt;select &lt;/SPAN&gt;c;

                &lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;var &lt;/SPAN&gt;cst &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;q)
                    &lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"id = {0}, City = {1}"&lt;/SPAN&gt;, cst.AddressID, cst.City);
            }
        }

        &lt;SPAN style="COLOR: blue"&gt;class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Program &lt;/SPAN&gt;{
            &lt;SPAN style="COLOR: blue"&gt;static void &lt;/SPAN&gt;Main(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;[] args) {
                &lt;SPAN style="COLOR: #2b91af"&gt;T &lt;/SPAN&gt;tdb = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;T&lt;/SPAN&gt;();
                &lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;city = &lt;SPAN style="COLOR: #a31515"&gt;"GF"&lt;/SPAN&gt;;
                tdb.addAddr(city);
                tdb.tq(city);

            }
        }
    }

&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8976086" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/rickandy/archive/tags/Dynamic+Data/default.aspx">Dynamic Data</category><category domain="http://blogs.msdn.com/rickandy/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item></channel></rss>