Welcome to MSDN Blogs Sign in | Join | Help

system.data.objects dev guy

Ramblings about ADO.Net, the Entity Framework, and other random things from a dev guy.
Entity Framework FAQ

Entity Framework FAQ

Version 1.2 – 12/18/2008

New in this version of the FAQ…

·         Updated: 1.2.    Where else should I go to learn more about the EF?

·         Updated: 1.6.    Where can I learn about plans for the next release of the EF?

·         Added:    4.2.    Is there any way to use public, easily modifiable templates for EF code generation?

·         Updated: 13.6.  Does the EDM/EF support enums?

·         Updated: 17.1.  Does the Entity Framework support server-generated key values?

·         Added:    17.5.  If I use guids for my keys, can I generate them on the client rather than the server?

Contents

1..................... Introduction

Entity Classes & Architecture Patterns

2..................... Architecture and Patterns

3..................... Business Logic

4..................... Code Generation

5..................... Data Classes

Query

6..................... Query

7..................... LINQ to Entities

8..................... Entity SQL and ObjectQuery Builder Methods

Object Services & Using the APIs

9..................... Object Services

10.................... Lazy Load and Eager Load

11.................... Serialization and Web Services

12. .................. Databinding

Entity Services, Metadata & Mapping

13.................... EDM

14.................... Mapping

15.................... Metadata

16.................... EntityClient

17.................... EntityKey

Miscellaneous

18.................... Multi-threading

19.................... Performance

20.................... Resource Management

1.   Introduction

1.1.   About this FAQ…

You can find the latest version of the EF FAQ at http://blogs.msdn.com/dsimmons/pages/entity-framework-faq.aspx.  This FAQ which was culled from a number of existing blog and forum posts.  There’s no question that there is lots more data which belongs here.  If you have further questions (or even better yet contributions), please don’t hesitate to add a comment here so that we can evolve this doc to be an increasingly valuable resource.  I don’t have as much time as I’d like to update and add to this document myself, but I’m more than happy to coordinate the process if folks have contributions.

1.2.   Where else should I go to learn more about the EF?

There are a number of good resources on the web, but here are a few good starting points:

·         The MSDN Getting Started with the EF page: http://msdn.microsoft.com/en-us/data/aa937723.aspx

·         The MSDN docs: http://msdn.microsoft.com/en-us/library/bb399572.aspx

·         The EF forum: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=533&SiteID=1

·         Samples: http://code.msdn.microsoft.com/adonetefx

·         DataDeveloper.net: http://www.datadeveloper.net/

·         dnrTV episodes which provide an intro to the EF:

o    http://www.dnrtv.com/default.aspx?showNum=117

o    http://www.dnrtv.com/default.aspx?showNum=118

 

·         Blogs from the EF team:

o    EF Design: http://blogs.msdn.com/efdesign/

o    ADO.Net: http://blogs.msdn.com/adonet/

o    Alex: http://blogs.msdn.com/alexj/

o    Colin: http://blogs.msdn.com/meek/

o    Danny: http://blogs.msdn.com/dsimmons/

o    Diego: http://blogs.msdn.com/diego/

o    Jarek: http://blogs.msdn.com/jkowalski/

o    Ju-Yi: http://blogs.msdn.com/juyik/

o    Tim: http://blogs.msdn.com/timmall/

 

·         Blogs and other resources from outside Microsoft with EF topics:

o    John Papa: http://johnpapa.net/

o    Julie Lerman: http://www.thedatafarm.com/blog/

o    Oakleaf Systems: http://oakleafblog.blogspot.com/

o    Zeeshan Hirani created an Entity Framework Learning Guide.

1.3.   Why use EDM? How does the EDM help?

The Entity Framework enables developers to reason about and write queries in terms of the EDM model rather than the logical schema of tables, joins, foreign keys, and so on. Many enterprise systems have multiple applications/databases with varying degrees of normalization, different schema styles depending on the group that developed it, and different naming conventions for tables and columns. Furthermore, in complex systems the entities of interest may be scattered across multiple rows in multiple tables, and changes to the logical schema can be painful to track within applications. By adding an additional level of abstraction, the EDM insulates the developer from the low level details of the logical model, and frees them to focus on the essential aspects of the application/problem at hand. For more information, see Introducing the Entity Framework.

 

Pasted from < http://blogs.msdn.com/adonet/archive/2007/05/30/entitysql.aspx >

 

1.4.   How can I get the bits?

Step 1: Install .Net 3.5 RTM / VS 2008 RTM.

Step 2: Download and install SP1: http://msdn.microsoft.com/en-us/vstudio/products/cc533448.aspx

1.5.   When will the Entity Framework be released?

The first release of the EF (v3.5sp1) is available now.  It shipped as part of .Net 3.5 SP1 / VS 2008 SP1.

1.6.   Where can I learn about plans for the next release of the EF?

The next release of the EF (v4.0) will ship with .Net 4.0 / VS 2010.

The EF Design blog is intended to significantly increase the transparency of design for the EF.  From the first post to the blog:

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.

Another good resource is the EF Futures talk which Tim Mallalieu gave at PDC 2008.

 

Posted: Thursday, November 08, 2007 10:25 AM by dsimmons@microsoft.com

Comments

Guy Burstein [MVP] said:

Frequently Asked Questions and Answers about ADO.Net Entity Framework The ADO.Net Entity Framework team

# November 8, 2007 6:50 AM

Noticias externas said:

One of the PMs on the team, Asad Khan, sent me a list of questions and answers which he culled from looking

# November 8, 2007 6:50 AM

Diego's Data Access Blog said:

One of the best learning resources I have found since I joined my team at Microsoft is this page Danny

# November 9, 2007 7:11 PM

Noticias externas said:

One of the best learning resources I have found since I joined my team at Microsoft is this page Danny

# November 9, 2007 7:46 PM

system.data.objects dev guy said:

I've not spent near as much time on this as I would like, but this morning, I decided to do a quick update.

# January 4, 2008 12:31 PM

Noticias externas said:

I&#39;ve not spent near as much time on this as I would like, but this morning, I decided to do a quick

# January 4, 2008 1:07 PM

Mike Taulty's Blog said:

Whilst digesting some blogs today I came across; Kaxaml - this is looking like a better and better "XAMLPad"...

# January 7, 2008 8:19 AM

markscottjohnson said:

Daniel,

Have been toying with the EF for a while now and this is the most succint and useful article I have seen on some of the more contentious and advanced scenarios - thx.

Am a big fan of nhibernate (and the POCO approach), can you recommned any good guidance/examples on implementing a codegen free approach you alude to in section 2.

# May 11, 2008 2:20 AM

dsimmons@microsoft.com said:

Mark,

I’m glad you found it helpful.  For more information about building classes from scratch, I recommend looking at the following link to part of the MSDN docs:

http://msdn.microsoft.com/en-us/library/bb738559.aspx

There’s some pretty good explanation there as well as a fair amount of sample code.  If you have additional questions, don’t hesitate to ask.

- Danny

# May 11, 2008 2:33 AM

rodrigo benin said:

Daniel,

Have been exploring the EF and a friend at Microsoft Brasil pointed me this blog. Nice work! It's a pretty good FAQ.

I still got one question: the lastest EF version shipped with de VS 2008 SP1 Beta still doesn't support entity inheritance? (such as Contact <- Person <- Customer for example) as posted in this FAQ at Question 7.2?

Thanks!

Rodrigo

# May 13, 2008 11:44 AM

dsimmons@microsoft.com said:

Entity inheritance is supported and has been from the first CTP of the EF.  What question 7.2 is talking about is the idea of a property of an entity which is not itself an entity (it doesn't have identity, it can't participate in a relationship, etc.) but which does have some structure.  We call those complex types.  Complex types do not support inheritance and won't for v1, but entities do support it.

# May 14, 2008 4:44 AM

system.data.objects dev guy said:

Just a quick note to point out a few interesting things about the updated version of the EF which shipped

# May 14, 2008 4:55 AM

Matthieu MEZIL said:

Daniel Simmons vient de publier sur son blog une FAQ de l'Entity Framework mise à jour avec la nouvelle

# May 14, 2008 8:34 AM

Arquitetura de Soluções said:

Olá pessoal, tudo certo? Para quem anda acompanhando a evolução do Entity Framework, componente importante

# May 16, 2008 6:08 PM

Jorge Serrano - MVP Visual Developer - Visual Basic said:

Danny Simmons , el cual trabaja en el equipo de Entity Framework y al cual tuve la oportunidad de conocer

# May 21, 2008 2:56 AM

Matthieu MEZIL said:

Daniel Simmons updated EF FAQ .

# May 21, 2008 8:11 AM

Mohammad Tajari said:

As I recall in traditional ADO.NET, it was possible to update a portion of a dataset in order to split persistance operations. Here if SaveChange method of ObjectContext has the ability of persisting some portions of modified and disconnected entities it would be great if I extend my created entities to Save themeself.

As entities here are in disconnected mode so it might not all other entities receive the reflected changes by database and some exceptions might be thrown. But It is acceptable and I think it would be still great to be able to Save only a desired portion of entities.

# May 30, 2008 5:40 AM

dsimmons@microsoft.com said:

The EF does not have the ability to persist part of the changes to a context.  There are several reasons for this:

1) The EF model includes entities and relationships as largely separate things while in the CLR object model they overlap quite a bit such that an entity has references to other entities which imply relationships.  If you were to save just an entity, for instance, there are some difficult questions about what that means to the relationships--especially once you look at concurrency checks, relationships which can be modeled either as foreign keys inline in a row or out in link tables, etc.

2) The idea behind the context is a bit different from the dataset.  It's not intended as a big in memory cache so much as something which represents a unit of work.  So if you have multiple changes to entities which you want to persist separately, the general recommendation would be to use separate contexts.

- Danny

# May 30, 2008 9:56 AM

Jorge Serrano - MVP Visual Developer - Visual Basic said:

Danny Simmons , del equipo de Entity Framework ha publicado una nueva actualización de su ya interesante

# June 6, 2008 3:10 AM

Matthieu MEZIL said:

Daniel Simmons updated EF FAQ . What are the changes? (from Daniel &#39;s post ). Updated: 1.2 Where

# June 6, 2008 4:05 AM

江南白衣 said:

The Entity Framework enables developers to reason about and write queries in terms of the EDM model rather than the logical schema of tables, joins, foreign keys, and so on. Many enterprise systems have multiple applications/databases with varying degrees

# June 11, 2008 12:07 PM

Jo-wen Mei said:

veel handige info over Entity Framework

# August 1, 2008 8:53 AM

Florian S. said:

How to use Stored Procedures that only return simple data types like double, float and so on?

Thanks in advance!

# August 5, 2008 10:26 AM

system.data.objects dev guy said:

Entity Classes &amp; Architecture Patterns Part of the Entity Framework FAQ . 2. Architecture and Patterns

# August 10, 2008 4:09 AM

system.data.objects dev guy said:

Entity Classes &amp; Architecture Patterns Part of the Entity Framework FAQ . 2. Architecture and Patterns

# August 10, 2008 4:12 AM

system.data.objects dev guy said:

Part of the Entity Framework FAQ . 6. Query 6.1. How is Span used? What is Span? (aka. How does the EF

# August 10, 2008 4:19 AM

system.data.objects dev guy said:

Part of the Entity Framework FAQ . 9. Object Services 9.1. What is ObjectContext.Detach() method used

# August 10, 2008 4:22 AM

system.data.objects dev guy said:

Part of the Entity Framework FAQ . 13. EDM 13.1. Does Entity Framework support Abstract types in EDM

# August 10, 2008 4:27 AM

system.data.objects dev guy said:

Part of the Entity Framework FAQ . 18. Multi-threading 18.1. What is the recommendation for running a

# August 10, 2008 4:30 AM

system.data.objects dev guy said:

# August 12, 2008 3:06 AM

Eric and the .NET Framework said:

As promised, the links from my session today on the new data stuff on 3.5 and 3.5 SP1. Thanks for listening.

# September 17, 2008 6:00 PM

UK Developer Events - Post Event Resources said:

Presentation: Data and Data Access - State of the Nation Presenter: Eric Nelson http://blogs.msdn.com/ericnel

# September 26, 2008 4:26 PM

UK Developer Events - Post Event Resources said:

Presentation: Presenter: Mike Ormond Presentation: Whats new in Data Presenter: Eric Nelson http://blogs.msdn.com/ericnel

# October 2, 2008 2:28 PM

Beth Massi - Sharing the goodness that is VB said:

I've had a lot of questions lately on how to display data from two separate tables in the database into

# October 15, 2008 9:31 PM

罗爱军 said:

VisualStudio2008发布时,微软给我们带来了LinQtoSQL,解决所谓

# October 20, 2008 5:41 AM

UK Developer Events - Post Event Resources said:

Session 1 ADO.NEXT – Entity Framework &amp; Data Services Speaker: Eric Nelson http://blogs.msdn.com/ericnel

# October 24, 2008 9:29 AM

system.data.objects dev guy said:

I made a round of updates to the EF FAQ a while back but then had some trouble with the blog software

# January 8, 2009 11:56 AM

Coffee, smoke and techilicious burps at 3.47 AM said:

Lately everyone in my team and around my bay have been talking about Entity Framework. Well since I have

# January 9, 2009 2:14 AM

Coffee, smoke and techilicious burps at 3.47 AM said:

Lately everyone in my team and around my bay have been talking about Entity Framework. Well since I have

# January 9, 2009 2:14 AM

Waldemir Cambiucci Solutions Architect Microsoft Brasil said:

Olá pessoal, tudo certo? Aqui no blog tenho aproveitado para falar bastante sobre os vários cenários

# May 27, 2009 3:35 PM
Anonymous comments are disabled
Page view tracker