<?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>ADO.NET team blog : ADO.NET</title><link>http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx</link><description>Tags: ADO.NET</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>There is still time to make yourself heard</title><link>http://blogs.msdn.com/adonet/archive/2009/11/09/there-is-still-time-to-make-yourself-heard.aspx</link><pubDate>Tue, 10 Nov 2009 00:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9919897</guid><dc:creator>dpblogs</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/adonet/comments/9919897.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=9919897</wfw:commentRss><description>&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;The ADO.NET Providers team still needs your input.&amp;nbsp; This is the last week to answer our ADO.NET Managed Providers Planning survey. &amp;nbsp;&amp;nbsp;Help us to make the decisions that will benefit our database community.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;The survey can be found at &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/adonet/archive/2009/11/01/the-ado-net-providers-team-wants-to-hear-your-opinion.aspx"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;http://blogs.msdn.com/adonet/archive/2009/11/01/the-ado-net-providers-team-wants-to-hear-your-opinion.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Thanks&lt;BR&gt;Luiz Fernando Santos&lt;BR&gt;Program Manager, SQLClient&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9919897" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/SQLClient/default.aspx">SQLClient</category></item><item><title>VS2010 and .NET Framework 4 Beta 2 Announced!</title><link>http://blogs.msdn.com/adonet/archive/2009/10/19/vs2010-and-net-framework-beta-2-announced.aspx</link><pubDate>Tue, 20 Oct 2009 00:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9909581</guid><dc:creator>dpblogs</dc:creator><slash:comments>21</slash:comments><comments>http://blogs.msdn.com/adonet/comments/9909581.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=9909581</wfw:commentRss><description>&lt;P&gt;Visual Studio 2010 and the .NET Framework 4 Beta 2 are now available for &lt;A href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx" mce_href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx"&gt;download by MSDN subscribers&lt;/A&gt; and will available to the rest of the world on Wednesday. Beta 2 as well the VS2010 Launch date of March 22, 2010 were announced this morning on &lt;A href="http://blogs.msdn.com/somasegar/archive/2009/10/19/announcing-visual-studio-2010-and-net-fx-4-beta-2.aspx" mce_href="http://blogs.msdn.com/somasegar/archive/2009/10/19/announcing-visual-studio-2010-and-net-fx-4-beta-2.aspx"&gt;Soma’s blog&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Included in Beta 2 are some great new features and updates for the Entity Framework 4 and ADO.NET Data Services 4. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Entity Framework 4 Beta 2&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;In addition to all of the new EF 4 features that were included in Beta 1, Beta 2 also includes:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Foreign Keys:&lt;/STRONG&gt; EF 4 now includes a new type of associations (Foreign Key Associations) that allow you to have Foreign Key properties on your entities. Foreign Key Associations simplify some key scenarios such as Data binding and can be included or excluded when using the model creation and update wizards. Independent Associations supported in .NET 3.5 remain as is, but Foreign Key Associations become the default type of association going forward. Referential integrity constraints can now be created from the designer. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Improvements to POCO Support: &lt;/STRONG&gt;Fix-up of changes to navigation properties and FKs is now performed automatically on DetectChanges and SaveChanges. It is also now possible to declare collections as ISet&amp;lt;T&amp;gt; in POCO objects. When either ICollection&amp;lt;T&amp;gt; or ISet&amp;lt;T&amp;gt; is used, the default collection type materialized is HashSet&amp;lt;T&amp;gt;, which among other advantages does not allow duplicate entries. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Lazy Loading on by Default in new Models: &lt;/STRONG&gt;When you create a new model in VS 2010, you get generated ObjectContext types that have lazy loading turned on by default (context.ContextOptions.LazyLoadingEnabled = true is placed in the constructor). This simplifies the default experience of working with objects. Of course, it is still possible to turn it off and do explicit and eager loading. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;EntityDataSource support for Query Extenders and POCO: &lt;/STRONG&gt;EntityDataSource now includes support for ASP.NET Query Extenders and POCO entities. Query Extenders are a new addition to ASP.NET that allow you to have more control over the data retrieval query of a Data Source, leveraging the LINQ capabilities of Entity Framework. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Support for Binary Keys: &lt;/STRONG&gt;The EF now allows you to have binary property types (and varbinary storage columns) mapped as Entity Key / Foreign Key. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;ObjectMaterialized event: &lt;/STRONG&gt;It is now possible to write logic that is executed immediately after an object has been materialized. This event is raised after the scalar, complex and reference properties are populated (collections are filled afterwards). &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Object Services API improvements to enable N-Tier and Self Tracking Entities: &lt;/STRONG&gt;ObjectStateEntry.GetUpdatableOriginalValues method provides a access to an updatable data record that you can use to establish the original state of an entity at the property level. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Improvements to the generated SQL: &lt;/STRONG&gt;Numerous simplifications and improvements of the SQL generated when querying using the Entity Framework have been done including: removal of joins, better translation of certain functions,&amp;nbsp; elimination of constants used for internal purposes, which results in removing of levels of nesting and others. &lt;/LI&gt;
&lt;LI&gt;&lt;B&gt;Navigation Property Management&lt;/B&gt;: Users can now delete and add navigation properties, enabling the creation of one-way associations.&lt;/LI&gt;
&lt;LI&gt;&lt;B&gt;Improved Database Generation&lt;/B&gt;: SQL CE support has been added. In addition, customization of database generation is significantly simpler now, with the ability to specify the DDL generation template to be used, as well as automatic discovery of installed database generation workflows and templates.&lt;/LI&gt;
&lt;LI&gt;&lt;B&gt;New Extensibility APIs&lt;/B&gt;: New APIs enable users to add custom properties to any object in the model and have those properties show up in the property sheet. In addition, other extension points allow for customization of models on load, save, and after the model creation and update wizards run.&lt;/LI&gt;
&lt;LI&gt;&lt;B&gt;Generation of Complex Types from Stored Procedures&lt;/B&gt;: When creating a function import from a function, the UI can now detect the columns returned from a stored procedure and create a corresponding complex type. In addition, existing complex types can be updated when a stored procedure definition changes.&lt;/LI&gt;
&lt;LI&gt;&lt;B&gt;Greatly Improved Facet Management&lt;/B&gt;: The designer can now distinguish between empty and blank values, and various property facet defaults are handled more cleanly and consistently.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;LINQ to Entities improvements:&lt;/STRONG&gt; Support for recognizing additional patterns in queries, simplification of EntityFunctions and SqlFunctions static classes and OrderBy is now lifted over filters and other operations.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;ADO.NET Data Services 4 Beta 2&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;B&gt;Projections&lt;/B&gt;: This ADO.NET Data Services URI format has been extended to express projections (i.e. you can now work with a subset of the properties of an entity).&amp;nbsp; Beta 2 includes both server and client library (including LINQ support) support for projections.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;&lt;B&gt;Data Binding&lt;/B&gt;:&amp;nbsp; The data services client library for the .NET Framework 3.5 SP1 and Silverlight2 has been extended to support two-way data binding for WPF and Silverlight based applications.&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Row Count&lt;/STRONG&gt;: One scenario we heard a ton of feedback on after shipping V1 of ADO.NET Data Services in the .NET Framework 3.5SP1 is the ability for the a client of a data service to determine the total number of entities in a set without having to retrieve them all.&amp;nbsp; To address this need, we have extended the data services addressing scheme to allow a client to obtain this type of information without having to download all the entities in a set. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Feed Customization (aka "Web Friendly Feeds")&lt;/STRONG&gt;: A common ask we have received is to provide the ability to customize how entities are mapped into the various elements of an AtomPub feed.&amp;nbsp; This feature does just that by providing a data service author declarative control over how the data service runtime maps the properties of an entity (e.g. a Customer, Order, etc) to the elements of a feed. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Server Driven Paging (SDP)&lt;/STRONG&gt;: This one is best described by example.&amp;nbsp; If you had a data service that exposes photos, you likely want to limit the total number of photos a single request to the service can retrieve because the total collection of photos may be very large.&amp;nbsp; This feature allows a service author to set per collection limits on the total number of entities returned for each request.&amp;nbsp; In addition to limiting the number of photos returned per request, the server provides the client a "next link" which is simply a URI specifying how to continue retrieving the rest of the entities in the collection not returned by the first request.&amp;nbsp; For those familiar with AtomPub, this feature adds support for AtomPub &amp;lt;link rel="next" ...&amp;gt; elements to the data service runtime.&amp;nbsp;&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;&lt;B&gt;Enhanced BLOB Support&lt;/B&gt;: This feature enhances the BLOB support provided in V1 to enable data services to stream arbitrarily large BLOBs, store binary content separate from its metadata, easily defer the loading of BLOB content when its metadata is requested, etc.&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;&lt;B&gt;Request Pipeline&lt;/B&gt;: We have started to expose events throughout the data services server request processing pipeline.&amp;nbsp; For this release we’ll expose request level events and in future we’ll look to expose more fine grained events based on your feedback.&amp;nbsp; The goal of exposing our processing pipeline is to allow services further transparency into a data service such that a service author can do things such as setting HTTP response cache headers, wrapping interceptor processing and data service request processing in a single transaction, etc.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;New "Data Service Provider" Interface for Custom Provider Writers&lt;/STRONG&gt;: As the data services runtime has evolved, so has the number of ways people want to plug data into the data service framework.&amp;nbsp; In V1, two methods (Entity Framework and arbitrary .NET classes) were supported to enable a data service to interact with various diverse data sources.&amp;nbsp; To address another class of environments and data sources we have &lt;A href="http://blogs.msdn.com/pablo/archive/2008/11/01/ado-net-data-services-in-windows-azure-pushing-scalability-to-the-next-level.aspx" mce_href="http://blogs.msdn.com/pablo/archive/2008/11/01/ado-net-data-services-in-windows-azure-pushing-scalability-to-the-next-level.aspx"&gt;introduced a way to write a "custom" provider&lt;/A&gt; for those cases when the previous two provider models don't meet your needs. &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Thank you, &lt;/P&gt;
&lt;P&gt;Elisa Flasko &lt;BR&gt;Program Manager, &lt;BR&gt;Data &amp;amp; Modeling Group&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9909581" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET+Data+Services/default.aspx">ADO.NET Data Services</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Visual+Studio+2010+Beta+2/default.aspx">Visual Studio 2010 Beta 2</category><category domain="http://blogs.msdn.com/adonet/archive/tags/What_2700_s+New/default.aspx">What's New</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework+Futures/default.aspx">Entity Framework Futures</category><category domain="http://blogs.msdn.com/adonet/archive/tags/What_2700_s+New+Data+Services/default.aspx">What's New Data Services</category></item><item><title>POCO in the Entity Framework : Part 2 – Complex Types, Deferred Loading and Explicit Loading</title><link>http://blogs.msdn.com/adonet/archive/2009/05/28/poco-in-the-entity-framework-part-2-complex-types-deferred-loading-and-explicit-loading.aspx</link><pubDate>Thu, 28 May 2009 19:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9647609</guid><dc:creator>dpblogs</dc:creator><slash:comments>42</slash:comments><comments>http://blogs.msdn.com/adonet/comments/9647609.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=9647609</wfw:commentRss><description>&lt;P&gt;In my post last week on the &lt;A href="http://blogs.msdn.com/adonet/archive/2009/05/21/poco-in-the-entity-framework-part-1-the-experience.aspx" mce_href="http://blogs.msdn.com/adonet/archive/2009/05/21/poco-in-the-entity-framework-part-1-the-experience.aspx"&gt;POCO Experience in Entity Framework&lt;/A&gt;, I covered the fundamentals of POCO support in Entity Framework 4.0. In this post, I’ll cover a few more aspects related to POCO.&lt;/P&gt;
&lt;H4&gt;Complex Types&lt;/H4&gt;
&lt;P&gt;Complex Types are supported in POCO just like they are with regular &lt;B&gt;EntityObject&lt;/B&gt; based entities. All you have to do is declare your complex types as POCO classes and then use them for declaring the complex type based properties on your POCO entities.&lt;/P&gt;
&lt;P&gt;As an example, here’s an &lt;B&gt;InventoryDetail&lt;/B&gt; complex type to represent a part of my Product entity:&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;class&lt;/SPAN&gt; &lt;FONT color=#55aaaa&gt;InventoryDetail&lt;BR&gt;&lt;/FONT&gt;{&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;FONT color=#58abab&gt;Int16&lt;/FONT&gt; UnitsInStock { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;FONT color=#55aaaa&gt;Int16&lt;/FONT&gt; UnitsOnOrder { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;FONT color=#53a6a6&gt;Int16&lt;/FONT&gt; ReorderLevel { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;} &lt;BR&gt;&lt;/PRE&gt;&lt;BR&gt;&lt;/DIV&gt;
&lt;P&gt;My &lt;B&gt;Product&lt;/B&gt; class now has been modified to include a property of this type to group the inventory detail fields:&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;class&lt;/SPAN&gt; &lt;FONT color=#50a0a0&gt;Product&lt;BR&gt;&lt;/FONT&gt;{&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;int&lt;/SPAN&gt; ProductID { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;string&lt;/SPAN&gt; ProductName { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;int&lt;/SPAN&gt; SupplierID { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;string&lt;/SPAN&gt; QuantityPerUnit { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;decimal&lt;/SPAN&gt; UnitPrice { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;FONT color=#53a6a6&gt;InventoryDetail&lt;/FONT&gt; InventoryDetail { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;bool&lt;/SPAN&gt; Discontinued { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;FONT color=#55aaaa&gt;Category&lt;/FONT&gt; Category { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;}&lt;BR&gt;&lt;/PRE&gt;&lt;BR&gt;&lt;/DIV&gt;
&lt;P&gt;You can then do everything you are used to doing with Complex Types. Here’s how I use it in a query:&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt; outOfStockProducts = &lt;FONT color=#0000ff&gt;from&lt;/FONT&gt; c &lt;SPAN style="COLOR: #0000ff"&gt;in&lt;/SPAN&gt; context.Products&lt;BR&gt;                         &lt;SPAN style="COLOR: #0000ff"&gt;where&lt;/SPAN&gt; c.InventoryDetail.UnitsInStock == 0&lt;BR&gt;                         &lt;FONT color=#0000ff&gt;select&lt;/FONT&gt; c;&lt;BR&gt;&lt;/PRE&gt;&lt;BR&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you can see, Complex Type support with POCO is really straightforward to use. There are a couple of things you need to keep in mind when using complex types support with POCO:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;You must define your Complex Type as a class. Structs are not supported.&lt;/LI&gt;
&lt;LI&gt;You cannot use inheritance with your complex type classes.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;While we are on the topic of Complex Types, I thought I’d mention one other thing: Did you know that the Entity Framework designer in Visual Studio 2010 supports complex type declarations? &lt;/P&gt;
&lt;P&gt;In Visual Studio 2008, you had to manually add the Complex Type declaration to the CSDL. That is all history with the Complex Type support in the designer in Visual Studio 2010.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/POCOintheEntityFrameworkPart2ComplexType_148A3/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/POCOintheEntityFrameworkPart2ComplexType_148A3/image_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/POCOintheEntityFrameworkPart2ComplexType_148A3/image_thumb.png" width=491 height=361 mce_src="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/POCOintheEntityFrameworkPart2ComplexType_148A3/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;And what’s cool is that because Visual Studio 2010 supports Multi-Targeting, you can use this capability when building applications that target .NET Framework 3.5, using Entity Framework 3.5 as well!&lt;/P&gt;
&lt;H4&gt;Deferred/Lazy Loading&lt;/H4&gt;
&lt;P&gt;In my &lt;A href="http://blogs.msdn.com/adonet/archive/2009/05/12/sneak-preview-deferred-loading-in-entity-framework-4-0.aspx" mce_href="http://blogs.msdn.com/adonet/archive/2009/05/12/sneak-preview-deferred-loading-in-entity-framework-4-0.aspx"&gt;sneak preview post on Deferred Loading&lt;/A&gt; two weeks ago, I mentioned that there is now Deferred Loading support in Entity Framework. It comes as no surprise then that the default code-generated entity types out of the box based on &lt;B&gt;EntityObject&lt;/B&gt; will offer Deferred Loading. If you are wondering whether Deferred Loading is supported with POCO objects, then I think you will be happy to know that you can get Deferred Loading with POCO as well.&lt;/P&gt;
&lt;P&gt;There are two things you need to do in order to get Deferred Loading support with POCO entities:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Declare the property that you would like to load lazily as &lt;B&gt;virtual. &lt;/B&gt;These properties can be any collection type that implements &lt;B&gt;ICollection&amp;lt;T&amp;gt; &lt;/B&gt;or they can be a reference representing a 1/0..1 relationship.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;For instance, here’s a part of the updated &lt;B&gt;Category&lt;/B&gt; entity class which I have modified to support Deferred Loading:&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;class&lt;/SPAN&gt; &lt;FONT color=#4b9696&gt;Category&lt;/FONT&gt;&lt;BR&gt;{&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;int&lt;/SPAN&gt; CategoryID { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;string&lt;/SPAN&gt; CategoryName { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;string&lt;/SPAN&gt; Description { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;byte&lt;/SPAN&gt;[] Picture { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;virtual&lt;/SPAN&gt; &lt;FONT color=#4e9c9c&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color=#4a9595&gt;Product&lt;/FONT&gt;&amp;gt; Products { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    ...&lt;BR&gt;&lt;/PRE&gt;&lt;BR&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.&amp;nbsp;&amp;nbsp; Enable deferred loading on the context: &lt;BR&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;context.ContextOptions.DeferredLoadingEnabled = &lt;SPAN style="COLOR: #0000ff"&gt;true&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;BR&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That’s it. You will now get automatic Deferred Loading for your POCO types without having to do anything else.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;So how exactly does this work and what’s going on under the covers? &lt;/B&gt;&lt;/P&gt;
&lt;P&gt;The reason why this works is because when I marked my collection property as &lt;B&gt;virtual&lt;/B&gt;, this allowed the Entity Framework to provide a &lt;B&gt;proxy&lt;/B&gt; instance for my POCO type at runtime, and it is this proxy that does automatic deferred loading. The proxy instance is based on a type that derives from my own POCO entity class - so all functionality you have provided is preserved. From a developer point of view, this allows you to write persistence ignorant code even when deferred loading might be a requirement.&lt;/P&gt;
&lt;P&gt;If you were to inspect the actual instance in the debugger, you will see that the underlying type for the instance is different from the original type that I declared:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/POCOintheEntityFrameworkPart2ComplexType_148A3/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/POCOintheEntityFrameworkPart2ComplexType_148A3/image_4.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/POCOintheEntityFrameworkPart2ComplexType_148A3/image_thumb_1.png" width=492 height=179 mce_src="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/POCOintheEntityFrameworkPart2ComplexType_148A3/image_thumb_1.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;While the Entity Framework does its best to provide automatic deferred loading with minimal friction, this is something you need to be aware of when dealing with manual creation of instances that you want to then add or attach, or when you serialize/deserialize instances.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;U&gt;Manual instantiation of Proxy instances for POCO entities&lt;/U&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;In order to enable creation of proxy instances for adding/attaching, you can use the CreateObject factory method on ObjectContext for creating entity instances:&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;FONT color=#0000ff&gt;Category&lt;/FONT&gt; category = context.CreateObject&amp;lt;&lt;FONT color=#53a6a6&gt;Category&lt;/FONT&gt;&amp;gt;();&lt;/PRE&gt;&lt;BR&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try to keep this in mind and use &lt;B&gt;CreateObject&lt;/B&gt; when creating instances that you want to then use with the Entity Framework.&lt;/P&gt;
&lt;H4&gt;More Efficient Change Tracking with “Change Tracking Proxies”&lt;/H4&gt;
&lt;P&gt;The standard POCO entities we have talked about until now rely on snapshot based change tracking – i.e. the Entity Framework will maintain snapshots of before values and relationships of the entities so that they can be compared with current values later during Save. However, this comparison is relatively expensive when compared to the way change tracking works with EntityObject based entities. &lt;/P&gt;
&lt;P&gt;There is another type of proxy that will allow you to get better performance out of change tracking with POCO entities.&lt;/P&gt;
&lt;P&gt;If you are familiar with IPOCO, you know that &lt;B&gt;IEntityWithChangeTracker &lt;/B&gt;was one of the interfaces you were required to implement to provide change notifications to the Entity Framework.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Change Tracking proxies &lt;/B&gt;subclass your POCO entity class to provide you with this capability during runtime without requiring you to implement the IPOCO interfaces yourself. &lt;/P&gt;
&lt;P&gt;In many ways, you get the best of both worlds with this approach: You get persistence ignorance with POCO classes and you get the performance of &lt;B&gt;EntityObject&lt;/B&gt; / &lt;B&gt;IPOCO&lt;/B&gt; when it comes to change tracking. &lt;/P&gt;
&lt;P&gt;To get change tracking proxies, the basic rule is that your class must be public, non-abstract or non-sealed. Your class must also implement public virtual getters/setters for all properties that are persisted. Finally, you must declare collection based relationship navigation properties as ICollection&amp;lt;T&amp;gt; only. They cannot be a concrete implementation or another interface that derives from ICollection&amp;lt;T&amp;gt; (a difference from the Deferred Loading proxy)&lt;/P&gt;
&lt;P&gt;Here’s an example of my POCO class for &lt;B&gt;Product&lt;/B&gt; that will give me more efficient proxy based change tracking at runtime:&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;&lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;class&lt;/SPAN&gt; &lt;FONT color=#4e9c9c&gt;Product&lt;BR&gt;&lt;/FONT&gt;{&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;virtual&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;int&lt;/SPAN&gt; ProductID { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;virtual&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;string&lt;/SPAN&gt; ProductName { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;virtual&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;int&lt;/SPAN&gt; SupplierID { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;virtual&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;string&lt;/SPAN&gt; QuantityPerUnit { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;virtual&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;decimal&lt;/SPAN&gt; UnitPrice { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;virtual&lt;/SPAN&gt; &lt;FONT color=#50a0a0&gt;InventoryDetail&lt;/FONT&gt; InventoryDetail { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;virtual&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;bool&lt;/SPAN&gt; Discontinued { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;virtual&lt;/SPAN&gt; &lt;FONT color=#54a7a7&gt;Category &lt;/FONT&gt;Category { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt;; &lt;FONT color=#0000ff&gt;set&lt;/FONT&gt;; }&lt;BR&gt;}&lt;BR&gt;&lt;/PRE&gt;&lt;BR&gt;&lt;/DIV&gt;
&lt;P&gt;Once again, keep in mind that you must use &lt;B&gt;CreateObject &lt;/B&gt;for creating proxy instances you want to then add or attach to the context. But pure POCO entities that don’t rely on proxies and proxy based entities can work together. You need to only use CreateObject when dealing with proxy based entities.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;What if I want both Deferred Loading and better change tracking for the same POCO type?&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;The two are not mutually exclusive and you don’t have to choose between a Deferred Loading proxy and a Change Tracking proxy. If you want Deferred Loading and efficient change tracking, you just have to follow the rules for Change Tracking via proxies, and enable Deferred Loading. Change Tracking proxies will give you deferred loading if deferred loading is enabled.&lt;/P&gt;
&lt;H4&gt;Explicit Loading&lt;/H4&gt;
&lt;P&gt;All this deferred loading capability is great – but there are plenty of you out there that want to be in full control of how you load related entities. You might even choose to go the route of pure POCO without having to resort to any of the automatic proxy generation done for you.&lt;/P&gt;
&lt;P&gt;This is a perfectly acceptable (and preferable in many cases) and you can use explicit loading of relationships and be in complete control of how you query for data from the database.&lt;/P&gt;
&lt;P&gt;There are two options for doing &lt;B&gt;Explicit Load&lt;/B&gt; with POCO:&lt;/P&gt;
&lt;P&gt;One is to use &lt;B&gt;ObjectContext.LoadProperty &lt;/B&gt;and specify the name of the navigation property you want to load:&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;context.LoadProperty(beveragesCategory, &lt;SPAN style="COLOR: #006080"&gt;&lt;FONT color=#800000&gt;"Products"&lt;/FONT&gt;&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;BR&gt;&lt;/DIV&gt;
&lt;P&gt;This gets the job done – but it isn’t very type safe as you can see. If I don’t have the right name of the navigation property here, I will get a runtime exception.&lt;/P&gt;
&lt;P&gt;Some of you might actually prefer this:&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: silver 1px solid; TEXT-ALIGN: left; BORDER-LEFT: silver 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; BACKGROUND-COLOR: #f4f4f4; MARGIN: 20px 0px 10px; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; MAX-HEIGHT: 200px; FONT-SIZE: 8pt; OVERFLOW: auto; BORDER-TOP: silver 1px solid; CURSOR: text; BORDER-RIGHT: silver 1px solid; PADDING-TOP: 4px" id=codeSnippetWrapper&gt;&lt;PRE style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: 'Courier New', courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id=codeSnippet&gt;context.LoadProperty(beveragesCategory, c =&amp;gt; c.Products);&lt;/PRE&gt;&lt;BR&gt;&lt;/DIV&gt;
&lt;P&gt;I can use a lambda expression to specify the property that I want to load explicitly, and this is offers more type safety.&lt;/P&gt;
&lt;P&gt;So that’s about everything I planned on covering in the second post. There’s more to come however – in the final part of this series, we’ll go over some of the things to be aware of when dealing with pure POCO (non proxy) instances and keeping things in sync between your object graph and the Object State Manager. We will also cover variations of SaveChanges that you might want to be aware of.&lt;/P&gt;
&lt;P&gt;In the meantime, check out the sample code that I have updated to cover some of the things we have talked about in this post.&lt;/P&gt;
&lt;P&gt;Faisal Mohamood &lt;BR&gt;Program Manager, Entity Framework&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9647609" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/adonet/attachment/9647609.ashx" length="16340" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx">Entity Framework</category></item><item><title>DataSet and Silverlight</title><link>http://blogs.msdn.com/adonet/archive/2009/05/26/dataset-and-silverlight.aspx</link><pubDate>Wed, 27 May 2009 07:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9643460</guid><dc:creator>dpblogs</dc:creator><slash:comments>40</slash:comments><comments>http://blogs.msdn.com/adonet/comments/9643460.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=9643460</wfw:commentRss><description>&lt;P&gt;I’ve been asked a few times lately whether DataSet is or will be supported in Silverlight, so I thought I’d post the answer here. &lt;/P&gt;
&lt;P&gt;There are no plans to add DataSet into future releases of Silverlight. However we are investigating work to bridge existing DataSet investments to new data technologies. Below are three different approaches that can be used to build data-centric applications in Silverlight now.&lt;/P&gt;
&lt;P&gt;ADO.NET Data Services is the primary approach to creating data-centric applications in Silverlight. There is a client api within Silverlight for accessing these RESTful Services. ADO.NET Data Services exposes data through ATOM and JSON which are standard technologies when building rich internet applications. Here is a link to get started on this technology: &lt;A href="http://msdn.microsoft.com/en-us/data/bb931106.aspx" mce_href="http://msdn.microsoft.com/en-us/data/bb931106.aspx"&gt;http://msdn.microsoft.com/en-us/data/bb931106.aspx&lt;/A&gt;.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;In addition to ADO.NET Data Services, there is .Net RIA Services. The project aims to allow developers to build rich internet applications on Silverlight using Visual Studio. This isn't a released project yet, but there May 2009 preview that developers can use. Here is a link to this preview: &lt;A href="http://silverlight.net/forums/53.aspx" mce_href="http://silverlight.net/forums/53.aspx"&gt;http://silverlight.net/forums/53.aspx&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;Lastly, if there are requirements to expose data through Web Services rather than RESTful Services, we would recommend using WCF. These services can be accessed within Silverlight and would expose specific data contracts, not DataSets. Here is a link to get started on this approach: &lt;A href="http://msdn.microsoft.com/en-us/magazine/cc794260.aspx" mce_href="http://msdn.microsoft.com/en-us/magazine/cc794260.aspx"&gt;http://msdn.microsoft.com/en-us/magazine/cc794260.aspx&lt;/A&gt;. We welcome any feedback from the community on this.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;BR&gt;Chris Robinson&lt;BR&gt;Program Manager - DataSet&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9643460" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/DataSet/default.aspx">DataSet</category></item><item><title>Entity Framework-Enabled Providers Lists</title><link>http://blogs.msdn.com/adonet/archive/2009/01/26/entity-framework-enabled-providers-lists.aspx</link><pubDate>Mon, 26 Jan 2009 23:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9373360</guid><dc:creator>dpblogs</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/adonet/comments/9373360.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=9373360</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;I love posting announcements to the blog to let people know about the latest and greatest information about Entity Framework-enabled ADO.NET providers.&amp;nbsp; Blogs are perfect for announcements like that, but they're not as handy for providing an overview about the available Entity Framework-enabled providers.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;To help customers quickly and easily see what Entity Framework-enabled providers are available, released providers are listed on the main Entity Framework page &lt;A class="" href="http://www.microsoft.com/sqlserver/2008/en/us/ado-net-entity.aspx" mce_href="http://www.microsoft.com/sqlserver/2008/en/us/ado-net-entity.aspx"&gt;here&lt;/A&gt;.&amp;nbsp; We also have a separate page that lists all publicly available providers, including pre-released providers &lt;A class="" href="http://msdn.microsoft.com/en-us/data/dd363565.aspx" mce_href="http://msdn.microsoft.com/en-us/data/dd363565.aspx"&gt;here&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;We'll continue to post announcements about provider availability to the team blog.&amp;nbsp; The corresponding entries will appear on the provider list pages within a couple days, since those changes require more time to format and review.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;David Sceppa&lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;ADO.NET Program Manager&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9373360" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Providers/default.aspx">Providers</category></item><item><title>OpenLink Releases Their Virtuoso ADO.NET Entity Framework Provider</title><link>http://blogs.msdn.com/adonet/archive/2009/01/12/openlink-releases-their-virtuoso-ado-net-entity-framework-provider.aspx</link><pubDate>Tue, 13 Jan 2009 04:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9312108</guid><dc:creator>dpblogs</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/adonet/comments/9312108.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=9312108</wfw:commentRss><description>&lt;DIV class=postcontent&gt;&lt;FONT face=Calibri size=3&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;It is my pleasure to announce that OpenLink Software has released their Virtuoso ADO.NET Entity Framework provider - an&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;ADO.NET 3.5 data provider compatible with Visual Studio 2008 and Entity Frameworks, that provides access to native Virtuoso data (SQL, XML, and RDF) in addition to any Virtuoso Linked Tables from external ODBC and JDBC accessible data sources. Known-compatible external data sources include Oracle (versions 7.x to 11.x), Microsoft SQL Server (6.x to 2005), IBM DB2 , Sybase (4.2 to 12.x+), IBM Informix (5.x to 11.x), Ingres (6.4 to 9.x), Progress (7.x to 10.x), MySQL, PostgreSQL, and Firebird.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;For more information, see the OpenLink announcement page about the release &lt;A class="" href="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtAdoNet35Provider" mce_href="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtAdoNet35Provider"&gt;here&lt;/A&gt;.&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;Congratulations to everyone at&amp;nbsp;OpenLink who contributed to the release!&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;Enjoy!&lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;David Sceppa&lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;ADO.NET Program Manager&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9312108" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Providers/default.aspx">Providers</category><category domain="http://blogs.msdn.com/adonet/archive/tags/OpenLink/default.aspx">OpenLink</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Virtuoso/default.aspx">Virtuoso</category></item><item><title>Beta of Firebird ADO.NET Provider with Entity Framework Support Available</title><link>http://blogs.msdn.com/adonet/archive/2009/01/12/beta-of-firebird-ado-net-provider-with-entity-framework-support-available.aspx</link><pubDate>Tue, 13 Jan 2009 03:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9311801</guid><dc:creator>dpblogs</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/adonet/comments/9311801.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=9311801</wfw:commentRss><description>&lt;DIV class=postcontent&gt;&lt;FONT face=Calibri size=3&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;BR&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;I'm pleased to announce that a beta of the Firebird ADO.NET provider with Entity Framework support is now available.&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;Congratulations to Jiří Činčura and to everyone else who has worked on this project so far!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;For more information, please see Jiří's blog post &lt;A class="" href="http://blog.vyvojar.cz/jirka/archive/2009/01/06/firebird-ado-net-data-provider-2-5-0-beta-1-for-net-3-5-2-0-with-entity-framework-support.aspx" mce_href="http://blog.vyvojar.cz/jirka/archive/2009/01/06/firebird-ado-net-data-provider-2-5-0-beta-1-for-net-3-5-2-0-with-entity-framework-support.aspx"&gt;here&lt;/A&gt; or access the download page for the provider &lt;A class="" href="http://www.firebirdsql.org/index.php?op=files&amp;amp;id=netprovider" mce_href="http://www.firebirdsql.org/index.php?op=files&amp;amp;id=netprovider"&gt;here&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;Enjoy!&lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;David Sceppa&lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;ADO.NET Program Manager&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9311801" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Providers/default.aspx">Providers</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Firebird/default.aspx">Firebird</category></item><item><title>IBM's ADO.NET Provider Supports the Entity Framework!</title><link>http://blogs.msdn.com/adonet/archive/2008/12/10/IBMs-ADO.NET-Provider-Supports-the-Entity-Framework.aspx</link><pubDate>Thu, 11 Dec 2008 03:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9167049</guid><dc:creator>dpblogs</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/adonet/comments/9167049.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=9167049</wfw:commentRss><description>&lt;DIV class=postcontent&gt;&lt;FONT face=Calibri size=3&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;Time for another update on Entity Framework-enabled ADO.NET providers.&lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;It is my pleasure to announce that IBM has added Entity Framework support to their ADO.NET provider.&amp;nbsp; The provider supports DB2, Informix and U2 databases.&amp;nbsp; For more information on the specific versions of the IBM data servers supported, see &lt;A class="" title="Provider support for Microsoft Entity Framework" href="http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=/com.ibm.db2.luw.apdv.ms.doc/doc/c0054118.html" mce_href="http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=/com.ibm.db2.luw.apdv.ms.doc/doc/c0054118.html"&gt;this page&lt;/A&gt; on the IBM web site.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;Congratulations to everyone at IBM who contributed to the release, and a special thanks to Brent Gross and Praveen Ghantasala for all of the feedback they provided back to the Entity Framework team!&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;Enjoy!&lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;David Sceppa&lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN style="FONT-SIZE: 13.5pt; FONT-FAMILY: 'Calibri','sans-serif'"&gt;ADO.NET Program Manager&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9167049" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Providers/default.aspx">Providers</category><category domain="http://blogs.msdn.com/adonet/archive/tags/IBM/default.aspx">IBM</category><category domain="http://blogs.msdn.com/adonet/archive/tags/U2/default.aspx">U2</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Informix/default.aspx">Informix</category><category domain="http://blogs.msdn.com/adonet/archive/tags/DB2/default.aspx">DB2</category></item><item><title>“Table Splitting”: Mapping multiple entity types to the same table.</title><link>http://blogs.msdn.com/adonet/archive/2008/12/05/table-splitting-mapping-multiple-entity-types-to-the-same-table.aspx</link><pubDate>Sat, 06 Dec 2008 02:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9180773</guid><dc:creator>dpblogs</dc:creator><slash:comments>25</slash:comments><comments>http://blogs.msdn.com/adonet/comments/9180773.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=9180773</wfw:commentRss><description>&lt;P&gt;Imagine that you have a table called “Products” which contains a number of columns holding a large amount of data. For example, images of the product from above, front, and side. For most operations against instances of Products, you do not wish to pull down these large columns.&lt;/P&gt;
&lt;P&gt;Or, imagine that you would like to split a table such that some clients get a constrained view of the table, while more sophisticated clients get additional information, such as auditing and other internal fields.&lt;/P&gt;
&lt;P&gt;There are several ways with which to accomplish this in the Entity Framework, but one of the more flexible and powerful approaches is not much discussed. In this blog post, I will provide a soup-to-nuts example, from DDL to client code, of how to implement this pattern.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Step 1: Create the Sample Database&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;We’ll start with an example table, although any table will do:&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 8pt; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BACKGROUND-COLOR: #f4f4f4"&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #0000ff"&gt;CREATE&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;TABLE&lt;/SPAN&gt; [dbo].[Products](
                [id] [&lt;SPAN style="COLOR: #0000ff"&gt;int&lt;/SPAN&gt;] &lt;SPAN style="COLOR: #0000ff"&gt;IDENTITY&lt;/SPAN&gt;(1,1) &lt;SPAN style="COLOR: #0000ff"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;NULL&lt;/SPAN&gt;,
                [Name] [nvarchar](150) &lt;SPAN style="COLOR: #0000ff"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;NULL&lt;/SPAN&gt;,
                [MSRP] [money] &lt;SPAN style="COLOR: #0000ff"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;NULL&lt;/SPAN&gt;,
                [FrontImage] [image] &lt;SPAN style="COLOR: #0000ff"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;NULL&lt;/SPAN&gt;,
                [TopImage] [image] &lt;SPAN style="COLOR: #0000ff"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;NULL&lt;/SPAN&gt;,
                [SideImage] [image] &lt;SPAN style="COLOR: #0000ff"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;NULL&lt;/SPAN&gt;,
 &lt;SPAN style="COLOR: #0000ff"&gt;CONSTRAINT&lt;/SPAN&gt; [PK_Products] &lt;SPAN style="COLOR: #0000ff"&gt;PRIMARY&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;KEY&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;CLUSTERED&lt;/SPAN&gt; 
(
                [id] &lt;SPAN style="COLOR: #0000ff"&gt;ASC&lt;/SPAN&gt;
)&lt;SPAN style="COLOR: #0000ff"&gt;WITH&lt;/SPAN&gt; (PAD_INDEX  = &lt;SPAN style="COLOR: #0000ff"&gt;OFF&lt;/SPAN&gt;, IGNORE_DUP_KEY = &lt;SPAN style="COLOR: #0000ff"&gt;OFF&lt;/SPAN&gt;) &lt;SPAN style="COLOR: #0000ff"&gt;ON&lt;/SPAN&gt; [&lt;SPAN style="COLOR: #0000ff"&gt;PRIMARY&lt;/SPAN&gt;]
) &lt;SPAN style="COLOR: #0000ff"&gt;ON&lt;/SPAN&gt; [&lt;SPAN style="COLOR: #0000ff"&gt;PRIMARY&lt;/SPAN&gt;] TEXTIMAGE_ON [&lt;SPAN style="COLOR: #0000ff"&gt;PRIMARY&lt;/SPAN&gt;]
&lt;SPAN style="COLOR: #0000ff"&gt;END&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;I created this table in a database schema called “TableSplitting”&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Step 2: Create the Entity Data Model&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;I created a new command-line project and added an Entity Data Model file to it called “TableSplitting.edmx”. I used the wizard to reverse engineer the database containing the Products table defined above, which resulted in this model:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog1_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog1_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=222 alt=blog1 src="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog1_thumb.jpg" width=158 border=0 mce_src="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog1_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;B&gt;Step 3: Modify the Model&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;1. Rename “Products” to “Product”.&lt;/P&gt;
&lt;P&gt;2. Copy and paste the “Product” type and rename the copied type “ProductImages”.&lt;/P&gt;
&lt;P&gt;3. Delete “FrontImage”, “TopImage” and “SideImage” from “Product”.&lt;/P&gt;
&lt;P&gt;4. Delete “Name” and “MSRP” from “ProductImages”.&lt;/P&gt;
&lt;P&gt;5. Add a 1:1 association between “Product” and “ProductImages”.&lt;/P&gt;
&lt;P&gt;The resulting model should look like this:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog2_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog2_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=205 alt=blog2 src="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog2_thumb.jpg" width=378 border=0 mce_src="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog2_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;B&gt;Step 4: Map the Model&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;The mappings for the ProductImages type should look like this:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog3_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog3_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=221 alt=blog3 src="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog3_thumb.jpg" width=452 border=0 mce_src="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog3_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;The mappings for the association should look like this:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog4_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog4_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=155 alt=blog4 src="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog4_thumb.jpg" width=521 border=0 mce_src="http://blogs.msdn.com/blogfiles/adonet/WindowsLiveWriter/TableSplittingMappingmultipleentitytype_D8BF/blog4_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;B&gt;Step 5: Introduce a Referential Constraint&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;At this point we have one remaining problem: If you build the project, you will get the following error:&lt;/P&gt;
&lt;P&gt;&lt;I&gt;Error 3021: Problem in Mapping Fragment starting at line 72: Each of the following columns in table Products is mapped to multiple conceptual side properties: Products.id is mapped to &amp;lt;ProductsProductImages.ProductImages.id, ProductsProductImages.Products.id&amp;gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;Fixing this duplicate mapping issue requires a referential constraint, which the designer will only support in the next release, so save the edmx file, close it, then right-click it in Solution Explorer, select “Open With…” and double click on “XML Editor”.&lt;/P&gt;
&lt;P&gt;In the CSDL section, you will see the ProductProductImages association:&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 8pt; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BACKGROUND-COLOR: #f4f4f4"&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #008000"&gt;&amp;lt;!-- CSDL content --&amp;gt;&lt;/SPAN&gt;
…
&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;Association&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="ProductProductImages"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="TableSplittingModel.Product"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Role&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="Product"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Multiplicity&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="TableSplittingModel.ProductImages"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Role&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="ProductImages"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Multiplicity&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;Association&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;
 
We add the referential constraint to it to inform the model that the ids of these two types are tied to each other:
 
&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;Association&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="ProductProductImages"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="TableSplittingModel.Product"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Role&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="Product"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Multiplicity&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="TableSplittingModel.ProductImages"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Role&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="ProductImages"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Multiplicity&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;ReferentialConstraint&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;Principal&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Role&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="Product"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;PropertyRef&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="id"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;/&amp;gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;Principal&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;Dependent&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Role&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="ProductImages"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;PropertyRef&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="id"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;/&amp;gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;Dependent&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;ReferentialConstraint&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;Association&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;At this point, the model should validate when you build your project.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Step 6: Test the Model&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;Finally, we’ll write some code that will create a product and its images, then pull the product back and lazily load its images. The acquisition of test images for the front, side, and top is left as an exercise for the user.&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 8pt; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BACKGROUND-COLOR: #f4f4f4"&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #0000ff"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;void&lt;/SPAN&gt; Main(&lt;SPAN style="COLOR: #0000ff"&gt;string&lt;/SPAN&gt;[] args)
{
      Product product = &lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt; Product() {
            Name = &lt;SPAN style="COLOR: #006080"&gt;"Split Entity Soup"&lt;/SPAN&gt;,
            MSRP = 1337.42M,
      };
      ProductImages productImages = &lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt; ProductImages();
      product.ProductImages = productImages;
      productImages.FrontImage = File.ReadAllBytes(&lt;SPAN style="COLOR: #006080"&gt;@"C:\front.jpg"&lt;/SPAN&gt;);
      productImages.SideImage = File.ReadAllBytes(&lt;SPAN style="COLOR: #006080"&gt;@"C:\side.jpg"&lt;/SPAN&gt;);
      productImages.TopImage = File.ReadAllBytes(&lt;SPAN style="COLOR: #006080"&gt;@"C:\top.jpg"&lt;/SPAN&gt;);
 
      &lt;SPAN style="COLOR: #008000"&gt;//Save a product with its images&lt;/SPAN&gt;
      &lt;SPAN style="COLOR: #0000ff"&gt;using&lt;/SPAN&gt; (TableSplittingEntities context = &lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt; TableSplittingEntities()) {
            &lt;SPAN style="COLOR: #008000"&gt;//Adding the product also implicitly adds the product's images object.&lt;/SPAN&gt;
            context.AddToProductSet(product);
            context.SaveChanges();
            Console.Out.WriteLine(&lt;SPAN style="COLOR: #006080"&gt;"Saved product {0}."&lt;/SPAN&gt;, product.id);
            &lt;SPAN style="COLOR: #008000"&gt;//Note that productImages.id is the same as product.id. This is why we love the Entity Framework.&lt;/SPAN&gt;
            Console.Out.WriteLine(&lt;SPAN style="COLOR: #006080"&gt;"Saved product images {0}.\n"&lt;/SPAN&gt;, productImages.id);
      }
 
      &lt;SPAN style="COLOR: #008000"&gt;//Next, the product, update it, then load its images&lt;/SPAN&gt;
      &lt;SPAN style="COLOR: #0000ff"&gt;using&lt;/SPAN&gt; (TableSplittingEntities context = &lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt; TableSplittingEntities()) {
            &lt;SPAN style="COLOR: #008000"&gt;//Query the product back from the database&lt;/SPAN&gt;
            product = (from p &lt;SPAN style="COLOR: #0000ff"&gt;in&lt;/SPAN&gt; context.ProductSet
                           &lt;SPAN style="COLOR: #0000ff"&gt;where&lt;/SPAN&gt; p.id == product.id
                           select p).FirstOrDefault();
            &lt;SPAN style="COLOR: #008000"&gt;//Note that product.ProductImages is null, since we did not include it in the query&lt;/SPAN&gt;
            Console.Out.WriteLine(&lt;SPAN style="COLOR: #006080"&gt;"Retrieved product {0} with product images '{1}'."&lt;/SPAN&gt;, product.id, product.ProductImages);
 
            &lt;SPAN style="COLOR: #008000"&gt;//We can now lazily load the product's images&lt;/SPAN&gt;
            product.ProductImagesReference.Load();
            Console.Out.WriteLine(&lt;SPAN style="COLOR: #006080"&gt;"Retrieved product images for product {0}."&lt;/SPAN&gt;, product.ProductImages.id);
            Console.Out.WriteLine(&lt;SPAN style="COLOR: #006080"&gt;"Retrieved product front product image contains {0} bytes."&lt;/SPAN&gt;, product.ProductImages.FrontImage.Length);
            Console.Out.WriteLine(&lt;SPAN style="COLOR: #006080"&gt;"Retrieved product side product image contains {0} bytes."&lt;/SPAN&gt;, product.ProductImages.SideImage.Length);
            Console.Out.WriteLine(&lt;SPAN style="COLOR: #006080"&gt;"Retrieved product top product image contains {0} bytes."&lt;/SPAN&gt;, product.ProductImages.TopImage.Length);
            Console.ReadLine();
 
      }
}&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;Running this code will result in output that looks something like this:&lt;/P&gt;
&lt;P&gt;&lt;I&gt;Saved product 8.&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;Saved product images 8.&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;Retrieved product 8 with product images ''.&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;Retrieved product images for product 8.&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;Retrieved product front product image contains 31345 bytes.&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;Retrieved product front product image contains 45332 bytes.&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;Retrieved product front product image contains 98761 bytes.&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;A Note About Optimistic Concurrency&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;In a timestamp-based optimistic concurrency model, the timestamp column can only be mapped to one of the types. Placing the timestamp on the Product type (and setting its ConcurrencyMode to “fixed”) means that if you alter an instance of ProductImage and call SaveChanges() and then alter Product and call SaveChanges() again, you will get an optimistic concurrency exception. This is not a “strong” guarantee that the two types are written to the database as a unit, but can be helpful. If you desire to have optimistic concurrency guarantees against both types, a more careful, manual process is probably necessary, for example, the creation of integer “ProductVersion” and “ProductImagesVersion” columns that are updated manually.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;A Note About Possible Issues&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;There is a bug in the current mapping system that may cause validation errors when using this technique in some situations. We are fixing this issue for the next release. In the meantime, validation issues are most often resolved by reversing the principal and dependent roles in the referential constraint.&lt;/P&gt;
&lt;P&gt;We hope you’ve found this post useful and look forward to your feedback.&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; The Entity Framework Team&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9180773" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx">Entity Framework</category></item><item><title>Update on LINQ to SQL and LINQ to Entities Roadmap</title><link>http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx</link><pubDate>Thu, 30 Oct 2008 03:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9023341</guid><dc:creator>dpblogs</dc:creator><slash:comments>195</slash:comments><comments>http://blogs.msdn.com/adonet/comments/9023341.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=9023341</wfw:commentRss><description>&lt;P&gt;&lt;FONT face="Times New Roman" size=3&gt;Since the release of LINQ to SQL and the Entity Framework, many questions have been raised about the future plans for the technologies and how they will relate to each other long term.&lt;BR&gt;During this week of PDC we are now at a point, with the announcement of Visual Studio 10 and the .NET Framework 4.0, that we can provide more clarity on our direction. &lt;BR&gt;&amp;nbsp;&lt;BR&gt;We have seen great momentum with LINQ in the last year.&amp;nbsp; In .NET Framework 3.5 we released several LINQ providers, including LINQ to SQL which set the bar for a great programming model with LINQ over relational databases.&amp;nbsp; In .NET 3.5 SP1, we followed up that investment with the Entity Framework enabling developers to build more advanced scenarios and to use LINQ against any database including SQL Server, Oracle, DB2, MySQL, etc.&lt;BR&gt;&amp;nbsp;&lt;BR&gt;We’re making significant investments in the Entity Framework such that as of .NET 4.0 the Entity Framework will be our recommended data access solution for LINQ to relational scenarios.&amp;nbsp; We are listening to customers regarding LINQ to SQL and will continue to evolve the product based on feedback we receive from the community as well.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Times New Roman" size=3&gt;Tim Mallalieu&lt;BR&gt;Program Manager, LINQ to SQL and Entity Framework&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9023341" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/adonet/archive/tags/LINQ+to+SQL/default.aspx">LINQ to SQL</category></item><item><title>Sybase's SQL Anywhere ADO.NET Provider Supports the ADO.NET Entity Framework!</title><link>http://blogs.msdn.com/adonet/archive/2008/10/21/sybase-s-sql-anywhere-ado-net-provider-supports-the-ado-net-entity-framework.aspx</link><pubDate>Tue, 21 Oct 2008 21:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9010144</guid><dc:creator>dpblogs</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/adonet/comments/9010144.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=9010144</wfw:commentRss><description>&lt;DIV class=postcontent&gt;&lt;FONT face=Calibri size=3&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Another Entity Framework-enabled ADO.NET providers post!&amp;nbsp; Woohoo!&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;It is my pleasure to announce that as part of the release of SQL Anywhere 11, Sybase iAnywhere has added Entity Framework support to their ADO.NET provider&lt;/FONT&gt;&lt;FONT face=Calibri size=3&gt;.&amp;nbsp; For more information on the SQL Anywhere 11 release, please see the following announcement on the Sybase web site:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://www.sybase.com/detail?id=1057559"&gt;http://www.sybase.com/detail?id=1057559&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Congratulations to everyone else at Sybase who contributed to the release!&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Enjoy!&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;David Sceppa&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;ADO.NET Program Manager&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9010144" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Providers/default.aspx">Providers</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Sybase/default.aspx">Sybase</category></item><item><title>Introducing Table-Valued Parameters - Part 1</title><link>http://blogs.msdn.com/adonet/archive/2008/08/15/introducing-table-valued-parameters-part-1.aspx</link><pubDate>Sat, 16 Aug 2008 02:37:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8870994</guid><dc:creator>dpblogs</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/adonet/comments/8870994.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=8870994</wfw:commentRss><description>&lt;p&gt;Hey everyone! &lt;p&gt;I am Himanshu. I am a program manager in the ADO.Net team. Today I am going to talk about Table-Valued parameters that are new in SQL Server 2008. About 4 years back I was writing an application which involved adding metadata about my music library into a database. The database had a table each for storing Artists, Albums, and Songs. While adding an Album of songs into the database I had to insert data into each of these tables. I had defined stored procedure for inserting data into each of the tables. In the first iteration there was a bug in the code due to which these operations were not being done in a single transaction. Needless to say this bug surfaced as a data-corruption issue later on. Once identified the fix was trivial, ensure that all commands are executed in a single transaction. However, what I would have really liked to do was to be able to call a single stored procedure to which I could pass the metadata about the Album and the list of songs at the same time. But there was no good way of accomplishing this back then. I was programming against SQL Server 2000 back then. I am excited to say that now with the new table-valued parameters in SQL Server 2008 I can finally write a single stored procedure that will let me accomplish this without any kind of hacks! &lt;p&gt;Table-Valued parameters, as the name suggests lets you pass a table as parameter to a stored procedure. In order to use table-valued parameters you need to define a table type and then use the table type in the definition of the stored procedure. Let me illustrate this with the help of an example. I am going to first create a table type named Songs_TableType with two columns, Title and TrackNumber. Then I will use it in a stored procedure to pass a table as parameter. &lt;p&gt;First creating the table type&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Create Type Songs_TableType as Table
&lt;/span&gt;&lt;span style="color: gray"&gt;(Title &lt;/span&gt;&lt;span style="color: blue"&gt;nvarchar&lt;/span&gt;&lt;span style="color: gray"&gt;(120) not null,
TrackNumber &lt;/span&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt;&lt;span style="color: gray"&gt;)
&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;
&lt;p&gt;I can now use this type in a stored procedure to pass a table as a parameter. The following T-Sql shows how to define a stored procedure that takes this type as a parameter. Note that I have skipped error handling for brevity.&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;create procedure AddSongs&lt;/span&gt;&lt;span style="color: gray"&gt;(
 @ArtistName &lt;/span&gt;&lt;span style="color: blue"&gt;nvarchar&lt;/span&gt;&lt;span style="color: gray"&gt;(120), 
 @AlbumName &lt;/span&gt;&lt;span style="color: blue"&gt;nvarchar&lt;/span&gt;&lt;span style="color: gray"&gt;(120), 
 @Songs Songs_TableType &lt;/span&gt;&lt;span style="color: blue"&gt;READONLY&lt;/span&gt;&lt;span style="color: gray"&gt;)
&lt;/span&gt;&lt;span style="color: blue"&gt;as
begin
 &lt;/span&gt;&lt;span style="color: green"&gt;-- Add the Artist
 &lt;/span&gt;&lt;span style="color: blue"&gt;Declare @ArtistID int
 insert into Artists values &lt;/span&gt;&lt;span style="color: gray"&gt;(@ArtistName)
 &lt;/span&gt;&lt;span style="color: blue"&gt;select @ArtistID &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: magenta"&gt;SCOPE_IDENTITY&lt;/span&gt;&lt;span style="color: gray"&gt;()

 &lt;/span&gt;&lt;span style="color: green"&gt;-- Add the Album
 &lt;/span&gt;&lt;span style="color: blue"&gt;Declare @AlbumID int
 insert into Albums values &lt;/span&gt;&lt;span style="color: gray"&gt;(@AlbumName, @ArtistID)
 &lt;/span&gt;&lt;span style="color: blue"&gt;select @AlbumID &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: magenta"&gt;SCOPE_IDENTITY&lt;/span&gt;&lt;span style="color: gray"&gt;()

 &lt;/span&gt;&lt;span style="color: green"&gt;-- Insert songs
 &lt;/span&gt;&lt;span style="color: blue"&gt;insert into Songs 
 select title&lt;/span&gt;&lt;span style="color: gray"&gt;, trackNumber, @AlbumID, @ArtistID
 &lt;/span&gt;&lt;span style="color: blue"&gt;from @Songs
end &lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;
&lt;p&gt;In the next post I will go into more details into how I can use the stored procedure defined above to simplify the code I have on the client. Till then, adios!
&lt;p&gt;Himanshu Vasishth&lt;br&gt;Program Manager&lt;br&gt;ADO.NET
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8870994" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category></item><item><title>Entity Framework RTM Breaking Changes</title><link>http://blogs.msdn.com/adonet/archive/2008/08/12/entity-framework-rtm-breaking-changes.aspx</link><pubDate>Tue, 12 Aug 2008 21:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8852918</guid><dc:creator>dpblogs</dc:creator><slash:comments>13</slash:comments><comments>http://blogs.msdn.com/adonet/comments/8852918.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=8852918</wfw:commentRss><description>&lt;P&gt;There were a number of changes to the Entity Framework and the designer between Visual Studio 2008 SP1/ .NET Framework 3.5 Beta and RTM that will require updates to existing source code. These breaking changes are listed below, including the mitigation for adjusting to the new behavior, and a side by side comparison of Beta code and RTM code. &lt;BR&gt;&lt;BR&gt;Jeff Derstadt&lt;BR&gt;Entity Framework Developer 
&lt;H4&gt;Provider Changes&lt;/H4&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;1. The Function property of DbFunctionCommandTree is renamed to EdmFunction.&lt;/B&gt;&lt;B&gt;&lt;/B&gt; &lt;BR&gt;&lt;EM&gt;Affects:&lt;/EM&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Provider writers&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;/EM&gt;
&lt;P&gt;&lt;EM&gt;Mitigation:&lt;/EM&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Replace ".Function" wtih ".EdmFunction" 
&lt;P&gt;&lt;I&gt;SP1 Beta Code:&lt;/I&gt;&lt;PRE class=code&gt;funcTree.Function&lt;/PRE&gt;
&lt;P&gt;&lt;I&gt;SP1 RTM Code:&lt;/I&gt;&lt;I&gt;&lt;/I&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;funcTree.EdmFunction&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;&lt;/PRE&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;B&gt;2. &lt;/B&gt;&lt;B&gt;DbExpression, DbAggregate and DbModificationClause no longer have 'CommandTree' property&lt;/B&gt;&lt;B&gt;&lt;/B&gt; 
&lt;P&gt;&lt;EM&gt;&lt;/EM&gt;
&lt;P&gt;&lt;EM&gt;Affects&lt;/EM&gt;: &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Provider writers 
&lt;P&gt;&lt;EM&gt;SP1 Beta Code:&lt;/EM&gt;&amp;nbsp;&lt;BR&gt;Provider writers were able to go directly from an expression to a command tree, so when visiting&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;command tree in CreateDbCommandDefinition, the expression instance was enough to have.&lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public DbCommandDefinition CreateDbCommandDefinition(
DbProviderManifest manifest, 
DbCommandTree commandTree)
{
    commandTree.Validate();
    DbQueryCommandTree queryTree = (DbQueryCommandTree)commandTree;
    string tsql = this.Visit(queryTree.Query);
    return new CustomCommandDefinition(queryTree.Parameters, tsql);
}
 
...
 
public override string VisitParameterReferenceExpression(
DbParameterReferenceExpression expression)
{
    if (!expression.CommandTree.Parameters.ToDictionary(p =&amp;gt; p.Key, p =&amp;gt; p.Value).ContainsKey(expression.ParameterName))
    {
       throw new ArgumentException("Invalid parameter name");
    }
 
    return "@" + expression.ParameterName;
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;SP1 RTM Code:&lt;/I&gt;&amp;nbsp;&lt;BR&gt;Providers must now keep a reference to the command tree that was passed as an argument to CreateDbCommandDefinition if they need to refer back to it.&lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;private DbCommandTree _currentTree;

public DbCommandDefinition CreateDbCommandDefinition(
DbProviderManifest manifest, 
DbCommandTree commandTree)
{
// no need to call commandTree.Validate()  
 // EF has already done so and the tree cannot change
DbQueryCommandTree queryTree = (DbQueryCommandTree)commandTree;
this._currentTree = commandTree;
string tsql = this.Visit(queryTree.Query);
return new CustomCommandDefinition(queryTree.Parameters, tsql);
}

...

public override string VisitParameterReferenceExpression(
DbParameterReferenceExpression expression)
{
if (!this._currentTree.Parameters.ToDictionary(p =&amp;gt; p.Key, p =&amp;gt; p.Value).ContainsKey(expression.ParameterName))
{
throw new ArgumentException("Invalid parameter name");
}

return "@" + expression.ParameterName;
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;3. &lt;/B&gt;&lt;B&gt;DbCommandTree.Validate method is removed&lt;/B&gt; 
&lt;P&gt;&lt;EM&gt;Affects:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - &lt;/EM&gt;Provider writers 
&lt;P&gt;&lt;B&gt;4. &lt;/B&gt;&lt;B&gt;DbCommandTree and DbExpression no longer have a Clone method&lt;/B&gt; 
&lt;P&gt;&lt;EM&gt;Affects:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - &lt;/EM&gt;Provider writers 
&lt;P&gt;&lt;I&gt;SP1 Beta Code:&lt;/I&gt;&amp;nbsp;&lt;BR&gt;Provider writers were previously able to clone a command tree or a expression, e.g: &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;DbCommandTree tree = ...
DbCommandTree clonedTree = tree.Clone();

DbQueryCommandTree queryTree = ...
DbExpression clonedExpression = queryTree.Query.Clone();
&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&lt;I&gt;SP1 RTM Code:&lt;/I&gt;&amp;nbsp;&lt;BR&gt;Providers will no longer be able to clone a DbCommandTree or a DbExpression 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;5. &lt;/B&gt;&lt;B&gt;DbNaryExpression is removed from the CommandTree API&lt;/B&gt; 
&lt;P&gt;&lt;I&gt;Affects:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Provider Writers 
&lt;P&gt;&lt;I&gt;Workaround:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Use DbArithmeticExpression 
&lt;P&gt;&lt;I&gt;SP1 Beta Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;IList&amp;lt;DbExpression&amp;gt; arg = ((DbNaryExpression)exp).Arguments;
&lt;/PRE&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;SP1 RTM Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;IList&amp;lt;DbExpression&amp;gt; arg = ((DbArithmeticExpression)exp).Arguments;
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;B&gt;6. &lt;/B&gt;&lt;B&gt;ProviderManifest.Provider and ProviderManifest.Token properties have been removed&lt;/B&gt; 
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;Affects:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Provider Writers 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;I&gt;SP1 Beta Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;protected override DbCommandDefinition CreateDbCommandDefinition(
DbProviderManifest providerManifest,
DbCommandTree commandTree)
{     
  if(!SqlProviderManifest.ProviderInvariantName.Equals(
     providerManifest.Provider, StringComparison.Ordinal))
  {
   throw EntityUtil.Argument(...);
  }
 
  ...
 
}
&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;I&gt;SP1 RTM Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;protected override DbCommandDefinition CreateDbCommandDefinition(
DbProviderManifest providerManifest,
DbCommandTree commandTree)
{     
  if(!(providerManifest is SqlProviderManifest))
  {
   throw EntityUtil.Argument(...);
  }
 
  ...
 
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;7. &lt;/B&gt;&lt;B&gt;DbFunctionExpression IsLambda and LambdaBody properties are now internal&lt;/B&gt; 
&lt;P&gt;&lt;I&gt;Affects:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Provider Writers 
&lt;P&gt;&lt;I&gt;SP1 Beta Code:&lt;/I&gt;&amp;nbsp;&lt;BR&gt;In provider code it was possible to inspect the values of the IsLambda and Lambda body&amp;nbsp;parameters, but they would always be false and null, respectively. &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;protected override void VisitDbFunctionExpression(
DbFunctionExpression expression)
{ 
if(expression.IsLambda) {
throw EntityUtil.NotSupported(...);
}

GenerateFunctionInvocationSql(expression);
}
&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;I&gt;SP1 RTM Code:&lt;/I&gt; &lt;BR&gt;Any code that was testing the values of these properties is unnecessary. &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;protected override void VisitDbFunctionExpression(
DbFunctionExpression expression)
{ 
GenerateFunctionInvocationSql(expression);
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;
&lt;P&gt;&lt;B&gt;Entity Services Changes&lt;/B&gt; 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;1. &lt;/B&gt;&lt;B&gt;The Metadata keyword in an entity connection string is now required.&lt;/B&gt; 
&lt;P&gt;&lt;EM&gt;&lt;/EM&gt;
&lt;P&gt;&lt;EM&gt;Affects:&lt;/EM&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - EntityConnection and ObjectContext users 
&lt;P&gt;&lt;I&gt;SP1 Beta Behavior:&lt;/I&gt;&amp;nbsp;&lt;BR&gt;In SP1 Beta, initializing an EntityConnection with a connection string that that doesn't have a&amp;nbsp;Metadata keyword would not throw on the ConnectionString setter or constructor, but would throw on calls to Open() and GetMetadataWorkspace(). &lt;/P&gt;
&lt;P&gt;&lt;I&gt;SP1 RTM Behavior:&lt;/I&gt;&amp;nbsp;&lt;BR&gt;In SP1 RTM, the EntityConnection will throw in the ConnectionString setter or constructor. 
&lt;P&gt;&lt;B&gt;2. &lt;/B&gt;&lt;B&gt;EntityDataReader no longer overrides Object.GetHashCode() and Object.Equals(Object object)&lt;/B&gt; 
&lt;P&gt;&lt;I&gt;Affects:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - EntityDataReader users 
&lt;P&gt;&lt;I&gt;SP1 Beta Code:&lt;/I&gt; &lt;BR&gt;Object.Equals(Object object)&lt;I&gt;&lt;/I&gt; 
&lt;P&gt;Users could have compared two data readers for equality. &lt;PRE class=code&gt;Object obj = …
EntityDataReader reader = …

reader.Equals(obj);
&lt;/PRE&gt;
&lt;P&gt;Object.GetHashCode() 
&lt;P&gt;Users could have used instances of EntityDataReader as keys in data structures relying on&amp;nbsp;hashing algorithms such as a hash table or a dictionary. &lt;PRE class=code&gt;System.Collections.Hashtable hashtable = new Hashtable();
EntityDataReader reader1 = …
hashtable.Add(reader1, "first");
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;EM&gt;&lt;/EM&gt;
&lt;P&gt;&lt;I&gt;SP1 RTM Code:&lt;/I&gt; &lt;BR&gt;Object.Equals(Object object) 
&lt;P&gt;Unchanged, but the result would be based on the default implementation. 
&lt;P&gt;Object.GetHashCode() 
&lt;P&gt;The default implementation of GetHashCode does not guarantee unique return values for different&amp;nbsp;objects. Thus while the same code would run, it would be officially not supported. 
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;B&gt;Mapping and Metadata Changes&lt;/B&gt; 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;1. &lt;/B&gt;&lt;B&gt;Compile time view generation hash has changed&lt;/B&gt; 
&lt;P&gt;&lt;I&gt;Affects:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Users of compile time view generation 
&lt;P&gt;&lt;I&gt;Mitigation:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - &lt;/I&gt;Anyone who uses compile time view generation will need to regenerate the views and recompile &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; them. 
&lt;P&gt;&lt;B&gt;2. &lt;/B&gt;&lt;B&gt;SSDL no longer allows periods in Entity, Association, EntityContiner, EntitySet, AssociationSet, and Function names&lt;/B&gt; 
&lt;P&gt;&lt;I&gt;Affects:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Metadata artifact authors 
&lt;P&gt;&lt;I&gt;Mitigation:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - &lt;/I&gt;Names need to be changed so that they do not include periods 
&lt;P&gt;&lt;I&gt;SP1 Beta Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;&amp;lt;EntityType Name="Entity.1"&amp;gt;
...
&amp;lt;/EntityType&amp;gt;
&amp;lt;EntityContainer Name="Entity.Container"&amp;gt;
 &amp;lt;EntitySet Name="Entity.1"
             Entity="My.Namespace.[Entity.1]"/&amp;gt;
&amp;lt;/EntityContainer&amp;gt;
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;SP1 RTM Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;&amp;lt;EntityType Name="Entity_1"&amp;gt;...&amp;lt;/EntityType&amp;gt;&amp;lt;EntityContainer Name="Entity_Container"&amp;gt; &amp;lt;EntitySet Name="Entity_1" Table="Entity.1"
             Entity="My.Namespace.Entity_1"/&amp;gt;&amp;lt;/EntityContainer&amp;gt;
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;B&gt;3. &lt;/B&gt;&lt;B&gt;MetadataException constructors no longer take DataSpace string&lt;/B&gt; 
&lt;P&gt;Continue to use the following constructors to construct MetadataException. &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public MetadataException(string message)
public MetadataException(string message, Exception innerException) &lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;EntityDataSource Changes&lt;/B&gt; 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;1. &lt;/B&gt;&lt;B&gt;The IncludePaths property has been renamed to Include&lt;/B&gt; 
&lt;P&gt;&lt;I&gt;Affects:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - ASP.NET users 
&lt;P&gt;&lt;I&gt;SP1 Beta Code:&lt;/I&gt; &lt;BR&gt;The property IncludePaths was used to specify which navigation propreties should be included in&amp;nbsp;the query. 
&lt;P&gt;&lt;I&gt;SP1 RTM Code:&lt;/I&gt; &lt;BR&gt;The property name has changed to “Include”. 
&lt;P&gt;&lt;B&gt;2. &lt;/B&gt;&lt;B&gt;Public Methods removed from the EntityDataSourceView class&lt;/B&gt; 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;The following methods were removed from the EntityDataSourceView class &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public String DefaultOrderByClause { get; }
public void DisposeContext();
public static Boolean EnumerableContentEquals( IEnumerable enumerableA,  IEnumerable enumerableB);
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;3. &lt;/B&gt;&lt;B&gt;Event argument class APIs have changed&lt;/B&gt; 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;The event argument classes for the EntityDataSource have been re-architected to provide better usability. 
&lt;P&gt;&lt;I&gt;Affects:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp; ASP.NET users 
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;UL&gt;
&lt;LI&gt;ContextCreating&lt;I&gt;&lt;/I&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 Beta Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public class EntityDataSourceContextEventArgs : EventArgs
{
 // Methods
 public EntityDataSourceContextEventArgs();

 // Properties
 public ObjectContext Context { get; set; }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 RTM Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public class EntityDataSourceContextCreatingEventArgs : EventArgs
{
 public ObjectContext Context { get; set; }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;UL&gt;
&lt;LI&gt;ContextCreated &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 Beta Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public class EntityDataSourceStatusEventArgs : EventArgs
{
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 RTM Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public class EntityDataSourceContextCreatedEventArgs : EventArgs
{
  public ObjectContext Context { get; }
}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;UL&gt;
&lt;LI&gt;ContextDisposing&lt;I&gt;&lt;/I&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 Beta Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public class EntityDataSourceDisposeEventArgs : CancelEventArgs
{
 public object Context { get; }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 RTM Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public class EntityDataSourceContextDisposingEventArgs : CancelEventArgs
{
 public ObjectContext Context { get; }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;UL&gt;
&lt;LI&gt;Selecting&lt;I&gt;&lt;/I&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 Beta Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public class EntityDataSourceSelectEventArgs : CancelEventArgs
{
 public DataSourceSelectArguments Arguments { get; }
 public ParameterCollection CommandParameters { get; }
 public string CommandText { get; set; }
 public ObjectContext Context { get; }
 public string OrderBy { get; }
 public ParameterCollection OrderByParameters { get; }
 public string Where { get; }
 public ParameterCollection WhereParameters { get; }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 RTM Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public class EntityDataSourceSelectingEventArgs : CancelEventArgs
{
 public EntityDataSource DataSource { get; }
 public DataSourceSelectArguments SelectArguments { get; }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;UL&gt;
&lt;LI&gt;Selected &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 Beta Code:&lt;/I&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; See EntityDataSourceStatusEventArgs 
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 RTM Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt; public class EntityDataSourceSelectedEventArgs : EventArgs
{
    public ObjectContext Context { get; }
 public Exception Exception { get; }
 public bool ExceptionHandled { get; set; }
 public IEnumerable Results { get; }
 public DataSourceSelectArguments SelectArguments { get; }
 public int TotalRowCount { get; }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;UL&gt;
&lt;LI&gt;Updating&lt;I&gt;&lt;/I&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 Beta Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public class EntityDataSourceUpdateEventArgs : CancelEventArgs
{
 public Exception Exception { get; }
 public bool ExceptionHandled { get; set; }
 public object NewEntity { get; }
 public object OriginalEntity { get; }
}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 RTM Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public class EntityDataSourceChangingEventArgs : CancelEventArgs
{
  public ObjectContext Context { get; }
 public object Entity { get; }
 public Exception Exception { get; }
 public bool ExceptionHandled { get; set; }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;UL&gt;
&lt;LI&gt;Updated&lt;I&gt;&lt;/I&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 Beta Code:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; See EntityDataSourceStatusEventArgs 
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 RTM Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public class EntityDataSourceChangedEventArgs : EventArgs
{
 public ObjectContext Context { get; }
 public object Entity { get; }
 public Exception Exception { get; }
 public bool ExceptionHandled { get; set; }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;UL&gt;
&lt;LI&gt;Inserting&lt;I&gt;&lt;/I&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 Beta Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public class EntityDataSourceInsertEventArgs : CancelEventArgs
{
 public Exception Exception { get; }
 public bool ExceptionHandled { get; set; }
 public object NewEntity { get; set; }
 public IDictionary Values { get; }
}
&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 RTM Code:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; See EntityDataSourceChangingEventArgs 
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;UL&gt;
&lt;LI&gt;Inserted&lt;I&gt;&lt;/I&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 Beta Code:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; See EntityDataSourceStatusEventArgs 
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 RTM Code:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; See EntityDataSourceChangedEventArgs&lt;I&gt;&lt;/I&gt; 
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;UL&gt;
&lt;LI&gt;Deleting&lt;I&gt;&lt;/I&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 Beta Code:&lt;/I&gt; &lt;PRE class=code&gt;&lt;SPAN style="COLOR: black"&gt;public class EntityDataSourceDeleteEventArgs : CancelEventArgs
{
 public EntityDataSourceValidationException Exception { get; }
 public bool ExceptionHandled { get; set; }
 public object OriginalEntity { get; }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 RTM Code:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; See EntityDataSourceChangingEventArgs&lt;I&gt;&lt;/I&gt; 
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;UL&gt;
&lt;LI&gt;Deleted&lt;I&gt;&lt;/I&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 Beta Code:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; See EntityDataSourceStatusEventArgs&lt;I&gt;&lt;/I&gt; 
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1 RTM Code:&lt;/I&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; See EntityDataSourceChangedEventArgs&lt;I&gt;&lt;/I&gt; 
&lt;P&gt;&lt;I&gt;&lt;/I&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;Tools Changes&lt;/B&gt; 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;1. &lt;/B&gt;&lt;B&gt;Namespace generation has changed&lt;/B&gt; 
&lt;P&gt;Existing EDMX files will be affected as soon as you make a change, open/save/close it, “Run Custom Tool” or move the EDMX file into a project sub-folder. 
&lt;P&gt;In SP1 beta the data classes were generated into a separate top level CSDL model namespace and users were forced to import the CLR namespace or fully qualify the class names in order to consume the generated data classes. The following changes were made in the RC based on feedback from users: 
&lt;UL&gt;
&lt;LI&gt;The Model Namespace specified in the wizard GUI has nothing to do with the CLR namespace of the generated data classes 
&lt;LI&gt;The data classes are generate into a CLR namespace determined by the Visual Studio project system (based project type and the project sub-folder containing the EDMX file) 
&lt;LI&gt;The designer respects the value of the Custom Tool Namespace project item property (if set) &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;U&gt;Note&lt;/U&gt;: EDMX files in VB projects with an empty root namespace or in App_Code root in ASP.NET website projects continue to have the Beta 1 behavior for generated classes (i.e.&amp;nbsp; data classes are generated into a separate top level CSDL model namespace) 
&lt;P&gt;Code consuming the model is affected as follows: 
&lt;OL&gt;
&lt;LI&gt;VB projects with an empty root namespace and ASP.NET website apps with EDMX files in App_Code root: no change since SP1 beta 
&lt;LI&gt;All other projects where the EDMX file is in the project root: &lt;BR&gt;
&lt;P&gt;a. SP1 Beta C# code example: &lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NorthwindModel;

namespace ConsoleApplication1
{
 class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Program
 {
 &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;static void Main(string[] args)
 {
 using (&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;NorthwindEntities entities = 
                       &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;NorthwindEntities())
 {
 &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;foreach (&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Customers c &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;in entities.Customers)
 &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console.WriteLine(c.ContactName);
 }
 }
 }
}&lt;BR&gt;
&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;b. SP1 RTM C# code example (note we don’t need the “using NorthwindModel;” anymore): &lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
 class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Program
 {
 &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;static void Main(string[] args)
 {
 using (&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;NorthwindEntities entities = 
                       &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;NorthwindEntities())
 {
 &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;foreach (&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Customers c &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;in entities.Customers)
 &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console.WriteLine(c.ContactName);
 }
 }
 }
}
&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;LI&gt;SP1 RTM C# code example for all projects where the EDMX file is in a project sub-folder (e.g. MyModels). Note the “using ConsoleApplication1.MyModels;”&amp;nbsp; below: &lt;PRE class=code&gt;PrFont34Bin0BinSub0Frac0Def1Margin0Margin0Jc1Indent1440Lim0Lim1&lt;SPAN style="COLOR: blue"&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ConsoleApplication1.MyModels;

namespace ConsoleApplication1
{
 class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Program
 {
 &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;static void Main(string[] args)
 {
 using (&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;NorthwindEntities entities = 
                 &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;NorthwindEntities())
 {
 &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;foreach (&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Customers c &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;in entities.Customers)
 &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console.WriteLine(c.ContactName);
 }
 }
 }
}&lt;BR&gt;
&lt;/PRE&gt;&lt;/SPAN&gt;
&lt;LI&gt;In all projects, multiple EDMX files in the same project sub-folder cannot have duplicate entity or container names. Conflicts in generated classes (if any) can be resolved in one of the following ways: &lt;/LI&gt;&lt;/OL&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;a. For C# projects: Move the EDMX files into different project sub-folders folders or set the “Custom Tool Namespace” to a unique namespace &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;b. For ASP.NET website projects: Move the EDMX files into different project sub-folders folders under App_Code &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;c. For VB projects: Set the “Custom Tool Namespace” to a unique namespace &lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8852918" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx">Entity Framework</category></item><item><title>Update Model – a Question of Identity – Part 2 of 3</title><link>http://blogs.msdn.com/adonet/archive/2008/07/22/update-model-a-question-of-identity-part-2-of-3.aspx</link><pubDate>Tue, 22 Jul 2008 19:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8764364</guid><dc:creator>dpblogs</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/adonet/comments/8764364.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=8764364</wfw:commentRss><description>&lt;P&gt;This article is Part 2 of 3 – please see &lt;A href="http://blogs.msdn.com/adonet/archive/2008/07/21/update-model-a-question-of-identity-part-1-of-3.aspx" mce_href="http://blogs.msdn.com/adonet/archive/2008/07/21/update-model-a-question-of-identity-part-1-of-3.aspx"&gt;http://blogs.msdn.com/adonet/archive/2008/07/21/update-model-a-question-of-identity-part-1-of-3.aspx&lt;/A&gt; for Part 1.&lt;/P&gt;
&lt;P&gt;In the last article I explained the principle that the C-side updates would be non-destructive.&lt;/P&gt;
&lt;P&gt;The “Update Model” code needs to decide when we should add new C-side EntityTypes, new C-side Properties and new C-side Associations. This brings us into the idea of identity. Bear with me – this can get pretty complicated.&lt;/P&gt;
&lt;P&gt;Suppose you have a database with two tables in it. They have the same name but are in different schemas e.g. schema1.Customer and schema2.Customer. All S-side EntitySets (which are the way the EDM represents a database table or view) in a given model must have unique names. So if you attempt to import both of the above tables then one of them will be represented as an EntitySet with name ‘Customer’ and one with name ‘Customer1’ each with a matching EntityType. Which one will be which? Well, it depends on in what order you import them and sometimes on what else you import at the same time. The important point is that the Name attribute of the EntitySet is not always the same as the name of underlying database object.&lt;/P&gt;
&lt;P&gt;So we cannot rely on the Name attribute of a given EntitySet to identify the underlying database object. But for “Update Model from Database” we do need to identify what the true underlying database object is to decide whether a given one is “new”. So instead we construct a “database identity” for each S-side EntitySet which consists of its underlying schema name and its underlying table/view name. If the EntitySet’s Name attribute does not match the underlying table/view name then either a Table attribute or the special attribute store:Name (where ‘store’ is a prefix defined as the XML namespace “http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator”) is defined on that EntitySet. The value of this attribute is the true underlying database object name. Similarly the Schema or store schema attribute will represent the true underlying database schema name (and there’s a similar story for Function elements which is how the EDM represents stored procedures).&lt;/P&gt;
&lt;P&gt;This combination of the true database schema name and the true database object name are the “database identity” of that EntitySet. “New” S-side EntitySets are defined as those whose “database identity” does not appear in the S-side of the existing model.&lt;/P&gt;
&lt;P&gt;For every imported, new S-side EntitySet we create a single, matching C-side EntitySet and EntityType and the mappings necessary to map them through to the S-side EntitySet. If it is available, we will use the existing S-side name for the matching C-side EntityType, but that name may already be in use in which case we will try appending 1, 2, 3 … until we find a name that is not in use.&lt;/P&gt;
&lt;P&gt;So as an example, if a C-side EntityType, say ‘Customer’, was originally mapped to the S-side ‘Customer’ EntityType but has been manually unmapped, and “Update Model from Database” is run then the above rules will _not_ result in a “duplicate” C-side EntityType called ‘Customer1’ because “Update Model” knows that there was already a ‘Customer’ S-side EntityType – we assume the user knew what s/he was doing when they unmapped the C-side EntityType. However if a _new_ S-side EntityType called ‘Customer’ is added and there happens to exist a C-side EntitySet already called ‘Customer’ then the new, matching C-side EntityType would be called ‘Customer1’ and it will be up to the user to rename the C-side EntityTypes as needed.&lt;/P&gt;
&lt;P&gt;In the next article I’ll explain how this concept is extended to C-side Properties and Associations.&lt;/P&gt;
&lt;P&gt;Lawrence Jones &lt;BR&gt;Software Design Engineer, Entity Framework Tools&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8764364" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/adonet/archive/tags/EDM/default.aspx">EDM</category></item><item><title>Update Model – a Question of Identity – Part 1 of 3</title><link>http://blogs.msdn.com/adonet/archive/2008/07/21/update-model-a-question-of-identity-part-1-of-3.aspx</link><pubDate>Mon, 21 Jul 2008 21:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8762197</guid><dc:creator>dpblogs</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/adonet/comments/8762197.aspx</comments><wfw:commentRss>http://blogs.msdn.com/adonet/commentrss.aspx?PostID=8762197</wfw:commentRss><description>&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I propose to explain the reason behind some of the oddities of the “Update Model from Database” functionality and hopefully answer some common questions that come up about it.&lt;/P&gt;
&lt;P&gt;Before I get started let me note that this will be a fairly technical post split into three parts (I’ll post links to the other parts as responses to this one). There is also a good blog on this subject taking a look at the changes since our last release and showcasing some particular examples of the principles I will be explaining below. This blog is by Noam Ben-Ami at the following link: &lt;A href="http://blogs.msdn.com/adonet/archive/2008/04/01/update-model-from-db.aspx" mce_href="http://blogs.msdn.com/adonet/archive/2008/04/01/update-model-from-db.aspx"&gt;http://blogs.msdn.com/adonet/archive/2008/04/01/update-model-from-db.aspx&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;An EDMX file represents the conceptual (C-) side of the model, the storage (S-) side of the model and a mapping between the two. The major job of “Update Model from Database” is to update the S-side of the model to be consistent with any changes that have been made to the database since it was created or last updated. (Note that in this sense “changes” can also include any database objects which you chose not to include in your S-side model the last time through). “Update Model” will also automatically remove any mappings which would target non-existent S-side objects after the update.&lt;/P&gt;
&lt;P&gt;For RTM, the S-side of the model is completely replaced by a new S-side model generated from all the tables/views/stored procedures in the existing model plus any new ones selected via the “Update Model from Database” wizard. This has the advantage of ensuring that the new S-side model is self-consistent, but has the disadvantage that it removes any S-side elements which have been added by hand to the EDMX file. We are considering alternatives to this approach for V2.&lt;/P&gt;
&lt;P&gt;Now before we go on note that the Entity Designer shows you only the C-side of your model, not the S-side. The S-side is only visible through the Browser and entries in the Mapping Details window. Hence most people’s view of “the model” is the C-side of the model.&lt;/P&gt;
&lt;P&gt;Note also that for any given S-side model there are many possible C-side models which could be mapped to it: in particular in addition to the more simple 1:1 scenario, two or more C-side EntityTypes can be mapped to the same underlying table, or a single C-side EntityType can be mapped to more than one table.&lt;/P&gt;
&lt;P&gt;Although the major job of “Update Model from Database” is to update the S-side, we decided that, in order to reduce work for the user, we would also update the C-side but only under the following rule:&lt;/P&gt;
&lt;P&gt;· The C-side updates would be non-destructive.&lt;/P&gt;
&lt;P&gt;This means that we feel free to e.g. add new C-side EntityTypes to represent new S-side EntityTypes or new C-side Properties to represent new S-side Properties, but we will not e.g. delete a C-side EntityType because we believe the S-side EntityType it was mapped to has been deleted. Nor will we “resurrect” a C-side EntityType which the user has chosen to delete. We leave such decisions up to the user. &lt;/P&gt;
&lt;P&gt;As a consequence of this it is possible that an Entity Data Model which passed validation before “Update Model” was run will no longer be valid after “Update Model” is run. In this case the user should investigate each error message in the Error List Window and manually take some action to update the model before it can be used. The action that needs to be taken is probably destructive and so we leave it up to the user to decide.&lt;/P&gt;
&lt;P&gt;In the next article I’ll explain how “Update Model” makes the decision to create new C-side EntitySets based on new S-side EntitySets and what “identity” has to do with all this.&lt;/P&gt;
&lt;P&gt;Lawrence Jones &lt;BR&gt;Software Design Engineer, Entity Framework Tools&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8762197" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/adonet/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/adonet/archive/tags/EDM/default.aspx">EDM</category></item></channel></rss>