St. Louis Day of .NET – Entity Framework 4.1

This is part of a series of posts containing my notes from the sessions I attended at the 2011 St. Louis Day of .NET conference.

This series does not attempt to give complete accounts of the information presented in each session; it is just a way to capture the bullet points, notes, and opinions that I recorded while attending the conference. I have previously posted a list of all of the session materials and sample code that I have been able to find online, so if you are looking for a more precise account of a session, try looking there.

Brad Tutterow presented The Tasty Flavors of Entity Framework 4.1, which introduced the various ways (Code-First, Model-First, and Database-First) to develop with the latest version of Entity Framework.  Here are my (rather brief) notes from the session.

  • More information about Entity Framework on Julie Lerman’s blog:
  • A very good decision tree for which "flavor" (database-first, model-first, code-first)  of Entity Framework 4.1 to use can be found at
  • The ‘DbContext’ object was added in Entity Framework 4.1, and is the preferred object for interacting with Entity Framework.  Previously, the only option was ‘ObjectContext’.
  • If you have existing data access classes that represent your data model, you can use the code-first method for EF.  (This is Interesting… worth trying out to see how it works.  Perhaps offers another way to migrate to EF from existing code.)
  • Code-first requires *manual* creation of the DBContext class.  Then, add a connection string with a name that matches the name of the DBContext class.  On the first run of the code-first application, the database will be created automatically.  (Whoa, really?  Will have to think about how this can work in a controlled production environment.)
  • With the code-first approach, use the Fluent API if your entities (classes) differ from the data model.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: