<?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>Entity Framework Design : ADO.NET</title><link>http://blogs.msdn.com/efdesign/archive/tags/ADO.NET/default.aspx</link><description>Tags: ADO.NET</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Initial POCO Design Screencast</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/24/initial-poco-design-screencast.aspx</link><pubDate>Wed, 25 Jun 2008 04:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8650131</guid><dc:creator>dpblogs</dc:creator><slash:comments>11</slash:comments><comments>http://blogs.msdn.com/efdesign/comments/8650131.aspx</comments><wfw:commentRss>http://blogs.msdn.com/efdesign/commentrss.aspx?PostID=8650131</wfw:commentRss><description>&lt;P&gt;Two guys on the team knocked out&amp;nbsp;&lt;A class="" href="http://download.microsoft.com/download/0/1/f/01fd992a-9c5e-4a33-83a1-56efe19a36b7/POCO%20ChangeTracker.wmv" mce_href="http://download.microsoft.com/download/0/1/f/01fd992a-9c5e-4a33-83a1-56efe19a36b7/POCO ChangeTracker.wmv"&gt;this&lt;/A&gt; quick screencast of some of the prototype work we've been doing around POCO an the State Manager. It's not a long or in depth screencast, but we're hoping to inspire some additional feedback. If you prefer to download a copy of the video, you can download a .zip &lt;A class="" href="http://download.microsoft.com/download/0/1/f/01fd992a-9c5e-4a33-83a1-56efe19a36b7/POCO%20ChangeTracker.zip" mce_href="http://download.microsoft.com/download/0/1/f/01fd992a-9c5e-4a33-83a1-56efe19a36b7/POCO ChangeTracker.zip"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Elisa Flasko&lt;BR&gt;Program Manager, Data Programmability&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8650131" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/efdesign/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/efdesign/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/efdesign/archive/tags/POCO/default.aspx">POCO</category><category domain="http://blogs.msdn.com/efdesign/archive/tags/Entity+Framework+4/default.aspx">Entity Framework 4</category></item><item><title>Initial POCO Design 1-Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/24/initial-poco-design-1-pager.aspx</link><pubDate>Tue, 24 Jun 2008 22:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8648559</guid><dc:creator>dpblogs</dc:creator><slash:comments>26</slash:comments><comments>http://blogs.msdn.com/efdesign/comments/8648559.aspx</comments><wfw:commentRss>http://blogs.msdn.com/efdesign/commentrss.aspx?PostID=8648559</wfw:commentRss><description>&lt;P&gt;Here is a raw cut and paste for our POCO 1-Pager. We are currently working through the design and have some prototype work going on and we would like to hear your feedback. Note this is the "feature design 1-Pager" not the "implementation design 1-Pager" we are still looking at the details for the design and at this point would love to hear feedback on the experience plus thought around state mgmt in general. We will post additional design notes for this feature after the upcoming team design meeting.&lt;/P&gt;
&lt;H3&gt;&lt;A class="" title=_Toc201667368 name=_Toc201667368&gt;&lt;/A&gt;&lt;A class="" title=_Toc119343527 name=_Toc119343527&gt;&lt;/A&gt;&lt;A class="" title=_Toc119169067 name=_Toc119169067&gt;&lt;/A&gt;&lt;A class="" title=_Toc22035656 name=_Toc22035656&gt;&lt;/A&gt;1. Overview&lt;/H3&gt;
&lt;P&gt;Persistence Ignorance refers to being able to allow the developer to write and test domain objects in a way that is entirely independent of fundamental requirements and assumptions that may be made by the infrastructure service (in this case, the Entity Framework). Such requirements / assumptions may often include: 
&lt;UL&gt;
&lt;LI&gt;The need to implement a specific interface (for e.g., IPOCO)&lt;/LI&gt;
&lt;LI&gt;Inheritance from a base class&lt;/LI&gt;
&lt;LI&gt;Providing specific constructors&lt;/LI&gt;
&lt;LI&gt;Object Instantiation/Construction requirements – use a specific factory for instance&lt;/LI&gt;
&lt;LI&gt;The need for metadata or mapping class or property Attributes&lt;/LI&gt;
&lt;LI&gt;The need to use specific relationship mechanisms&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;This amounts to being able to use Plain Old CLR Objects (POCO) so that a developer can author their domain objects free of all assumptions and requirements imposed by the framework. Using this approach, once the domain objects are ready to their satisfaction, the developer can use these classes with the Entity Framework in order for relational database access and persistence. 
&lt;H3&gt;2&lt;A class="" title=_Toc201667369 name=_Toc201667369&gt;&lt;/A&gt;. Context&lt;/H3&gt;
&lt;P&gt;While the customization of entity types has always been a goal with Entity Framework, v1 imposed several restrictions/requirements in terms of how the entity types had to be built – for instance, at the minimum, a few interfaces had to be implemented at a minimum: 
&lt;UL&gt;
&lt;LI&gt;IEntityWithRelationships&lt;/LI&gt;
&lt;LI&gt;IEntityWithChangeTracking&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Pure POCO should eliminate the need to implement these interfaces. 
&lt;P&gt;In addition, POCO shouldn’t require the use of attributes that are required to map object members to the C-space. 
&lt;H3&gt;3&lt;A class="" title=_Toc201667373 name=_Toc201667373&gt;&lt;/A&gt;. Design&lt;/H3&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;When the Entity Framework supports Persistence Ignorance in the form of pure POCO, entity classes that are free of any infrastructure related artifacts can be authored as shown. The following example shows a Customer entity and an Order entity. There is a relationship between Customer and Order – i.e. a Customer can have many Orders. 
&lt;P&gt;O-Space to C-Space mapping is done by convention – i.e. the CLR types of the entities below map to the corresponding entities already defined in the Conceptual Model.&lt;B&gt;&lt;/B&gt;&lt;PRE class=csharpcode&gt;    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; Customer
    {
        &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; _CustomerID;
        &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; _ContactName;
        &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; _City;
        List&amp;lt;Order&amp;gt; _Orders;

        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; CustomerID
        {
            get { &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; _CustomerID; }
            set { _CustomerID = &lt;SPAN class=kwrd&gt;value&lt;/SPAN&gt;; }
        }

        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; ContactName
        {
            get { &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; _ContactName; }
            set { _ContactName = &lt;SPAN class=kwrd&gt;value&lt;/SPAN&gt;; }
        }

        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; City
        {
            get { &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; _City; }
            set { _City = &lt;SPAN class=kwrd&gt;value&lt;/SPAN&gt;; }
        }

        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; List&amp;lt;Order&amp;gt; Orders
        {
            get { &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; _Orders; }
            set { _Orders = &lt;SPAN class=kwrd&gt;value&lt;/SPAN&gt;; }
        }
    }
&lt;/PRE&gt;&lt;PRE class=csharpcode&gt;    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; Order
    {
        &lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt; _OrderID;
        Customer _Customer;
        DateTime _OrderDate;

        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt; OrderID
        {
            get { &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; _OrderID; }
            set { _OrderID = &lt;SPAN class=kwrd&gt;value&lt;/SPAN&gt;; }
        }

        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; Customer CustomerID
        {
            get { &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; _CustomerID; }
            set { _CustomerID = &lt;SPAN class=kwrd&gt;value&lt;/SPAN&gt;; }
        }

        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; DateTime OrderDate
        {
            get { &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; _OrderDate; }
            set { _OrderDate = &lt;SPAN class=kwrd&gt;value&lt;/SPAN&gt;; }
        }
    }
&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;

&lt;P&gt;Once the POCO classes are in place, one can program against them as first class entity objects. 
&lt;P&gt;For instance, query can be used to materialize POCO objects as shown:&lt;PRE class=csharpcode&gt;        var query = from c &lt;SPAN class=kwrd&gt;in&lt;/SPAN&gt; db.Customers.Include(&lt;SPAN class=str&gt;"Orders"&lt;/SPAN&gt;)
                    &lt;SPAN class=kwrd&gt;where&lt;/SPAN&gt; c.City == &lt;SPAN class=str&gt;"London"&lt;/SPAN&gt;
                    select c;
&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;

&lt;P&gt;&lt;B&gt;ObjectContext&lt;/B&gt; can be used for CUD operations much like the usage patterns supported today:&lt;PRE class=csharpcode&gt;        Customer customer = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Customer();
        customer.City = &lt;SPAN class=str&gt;"London"&lt;/SPAN&gt;;
        customer.ContactName = &lt;SPAN class=str&gt;"Steve"&lt;/SPAN&gt;;
        customer.CompanyName = &lt;SPAN class=str&gt;"Acme"&lt;/SPAN&gt;;

        Order order = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Order();
        order.OrderDate = DateTime.Today;

        customer.Orders.Add(order);

        db.AddObject(&lt;SPAN class=str&gt;"Customers"&lt;/SPAN&gt;, customer);
        db.SaveChanges();
&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;

&lt;P&gt;Tim Mallalieu&lt;BR&gt;Program Manager,&lt;BR&gt;Entity Framework Team 
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;This post is part of the transparent design exercise in the Entity Framework Team. To understand how it works and how your feedback will be used please look at &lt;/EM&gt;&lt;/STRONG&gt;&lt;A href="http://blogs.msdn.com/efdesign/archive/2008/06/23/transparency-in-the-design-process.aspx" mce_href="http://blogs.msdn.com/efdesign/archive/2008/06/23/transparency-in-the-design-process.aspx"&gt;&lt;STRONG&gt;&lt;EM&gt;this post&lt;/EM&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;STRONG&gt;&lt;EM&gt;. &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8648559" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/efdesign/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/efdesign/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/efdesign/archive/tags/POCO/default.aspx">POCO</category><category domain="http://blogs.msdn.com/efdesign/archive/tags/Entity+Framework+4/default.aspx">Entity Framework 4</category></item><item><title>Transparency in the design process</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/23/transparency-in-the-design-process.aspx</link><pubDate>Tue, 24 Jun 2008 02:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8644189</guid><dc:creator>dpblogs</dc:creator><slash:comments>51</slash:comments><comments>http://blogs.msdn.com/efdesign/comments/8644189.aspx</comments><wfw:commentRss>http://blogs.msdn.com/efdesign/commentrss.aspx?PostID=8644189</wfw:commentRss><description>&lt;P&gt;Today marks the first day of engineering for the ADO.NET Entity Framework V2.0. V2 of the product is a combination of a continued investment in our greater data platform vision as well as a focus on new and expanded ORM scenarios. Some of the things that we are trying to do in this release are as follows: 
&lt;UL&gt;
&lt;LI&gt;Persistence Ignorance : We are looking at ways to introduce a full POCO solution for state management and interaction with the ObjectContext.&lt;/LI&gt;
&lt;LI&gt;N-Tier Support : Today we support Data Contract serialization of entities or exposing entities via Astoria, in V2 we would like to expand to a DataSet like experience where one can remote graphs and changes to the graphs across the wire using standard WCF services.&lt;/LI&gt;
&lt;LI&gt;Code-First : We want to enable a convention based, code only experience with EF wherein one may start with classes and opt-in to database generation and deployment. We expect that we would provide attributes and external mapping capabilities for people who wanted something beyond the convention based mapping.&lt;/LI&gt;
&lt;LI&gt;TDD Scenarios: With the introduction of POCO classes some of the TDD scenarios get a lot easier, and we are looking at incorporating some other asks to better fill out the scenario, such as making our ObjectQuery&amp;lt;T&amp;gt; and other generated members of our context and classes virtual.&lt;/LI&gt;
&lt;LI&gt;FK's : Today we support bi-directional relationships, and&amp;nbsp;we are looking at introducing model concepts to facilitate the definition of FK like experiences in the model or in one's POCO classes.&lt;/LI&gt;
&lt;LI&gt;Lazy Loading: Today we support explicit lazy loading (calling .Load), and&amp;nbsp;we are looking at various options around LoadOptions as well as outright implicit lazy loading.&lt;/LI&gt;
&lt;LI&gt;Query Tree Re-Writing: This allows framework develolpers to contextualy, vertically and horizontally filter query results.&lt;/LI&gt;
&lt;LI&gt;...&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;We have been looking at various options to ensure that the design of Entity Framework V2 truly reflects the requirements of the day to day challenges that our developer community faces when building real-world applications and services. We would like to start by being as transparent as possible in the design process. The approach we take will be similar to what you have seen on Astoria Team blog (ADO.NET Data Services), but I wanted to briefly describe how we’ll go about it so you know exactly what you are looking at when reading one of our design-related posts. 
&lt;P&gt;&lt;B&gt;How did we get here?&lt;/B&gt; Version 1 of the ADO.NET Entity Framework is set to ship as a part of Visual Studio 2008 SP1 and&amp;nbsp;the&amp;nbsp;.NET Framework 3.5 SP1. This release&amp;nbsp;has been&amp;nbsp;the result of&amp;nbsp;a number of years of&amp;nbsp;effort. During V1 the team was focused on&amp;nbsp;implementing an initial set of scenarios as well as&amp;nbsp;the groundwork&amp;nbsp;necessary to continue to build out the Entity Framework in future versions. 
&lt;P&gt;&lt;B&gt;Where are we now?&lt;/B&gt; Today marks the first day of engineering for ADO.NET Entity Framework V2.0. What this means in practice is that we have a team with developers, testers, program managers, etc., that we have regular design meetings, and that we have a timeline (or more accurately, that we’re required to have a timeline but of course we’re still working on it :). 
&lt;P&gt;&lt;B&gt;Transparency in the design?&lt;/B&gt; Over the years Microsoft has been opening up the engineering processes incrementally. Long ago there were only betas, and that was the only chance to see and give feedback about a product before it shipped. Then we started to do Community Tech Previews (CTPs). CTPs enabled us to provide bits more often and gather feedback frequently. The goal with increasing the transparency of design is to take this one step further: we would like to enable folks that are interested in Entity Framework version 2 to follow the design topics as we discuss them, and have the opportunity to provide feedback right during the time where we are actively discussing a certain aspect and before we have made a final decision. 
&lt;P&gt;&lt;B&gt;What exactly would we make visible?&lt;/B&gt; In short, our design process. To be more concrete, I’m not talking about some fancy set of specifications. What I mean is that as we go through the detailed design of the various aspects of Entity Framework V2, we would post to this blog a) the meeting notes from our design meetings (the team has a design meeting twice a week, plus a lot of impromptu hallway chats), and b) deeper write-ups of specific design challenges where we’d like folks to understand how we’re approaching a problem and provide a channel for deep, detailed feedback. 
&lt;P&gt;&lt;B&gt;How transparent is transparent?&lt;/B&gt;&amp;nbsp;We want to be completely clear about the scope of the information we are sharing. One of the things we need to learn both from the Microsoft side and from the community side is whether the model works within a practical set of restrictions. We will post as much of our discussions as it is practically possible. However, we have to make sure we don’t compromise the interests of Microsoft as a company. There are certain things that can range from ideas to specific implementation details that we could consider trade secrets, high-value Microsoft intellectual property or something along those lines. It *will* happen that in some cases we will not discuss a topic publicly, either for a certain term (e.g. until a proper IP protection mechanism is in place) or until we ship or ever. This is nothing new, but I haven’t seen folks from large companies discuss this explicitly before, so&amp;nbsp;we wanted to make sure it is clear here. 
&lt;P&gt;&lt;B&gt;About your feedback:&lt;/B&gt; We would love to hear your thoughts, be it comments, suggestions, ideas or anything else. However, in the end we are designing a commercial Microsoft product. So we’ll happily take your feedback but you need to understand that by providing us feedback in any form you are agreeing that we may use it to develop our product, that others may use it in connection with the product and that you will not be compensated for any of these things. We may incorporate ideas or make changes based on the comments you make, or we may make changes to the product that are indirectly influenced by discussions that we have with you and other folks in the community. Again, this is nothing new, but instead of having some fancy statement written in legal lingo&amp;nbsp;we wanted to be upfront about this here in this first post on the topic. Of course our legal folks looked at this, and they were cool enough to understand that the informal nature of the process is what makes it work, and they let us get away with this statement in which I think we clearly delineate what will happen with whatever feedback you send our way. 
&lt;P&gt;We will start posting design notes and challenges soon and tweak the process as we go. &lt;/P&gt;
&lt;P&gt;Tim Mallalieu&lt;BR&gt;Program Manager, Entity Framework&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8644189" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/efdesign/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/efdesign/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/efdesign/archive/tags/EDM/default.aspx">EDM</category></item></channel></rss>