While EF5 did not bring a huge amount of change to Entity Framework, one small change in the EF Designer in Visual Studio 2012 made a huge difference for people getting started with Entity Framework. The designer now uses a code generator that spits out POCO entity classes managed by a DbContext by default rather than the EntityObject based classes managed by the ObjectCpntext as it did for VS2008 and VS2010. It’s a VERY good change but because almost all of the training materials out there for EF newbies is based on VS2010, it is pretty confusing to get started with EF5 and VS2012.
The advanced materials are still completely valid.
While this is driving me a little crazy with respect to the 2nd edition of Programming Entity Framework – a huge undertaking to update, I was able to fix the problem by creating a brand new course on Pluralsight.
It’s just been released today and is called “Getting Started with Entity Framework 5”.
It’s got 6 modules.
Entity Framework 5: Planning Ahead
This is a good overview for newbies but also highlights “what’s new” which will be really helpful for people coming from EF4 or even EF4.1, 4.2 or 4.3.
Database First Modeling
Like using the designer and starting with an existing database? Database First is for you. Also, there are plenty of new designer features so if you’re experienced with EF but moving to VS2012, you’ll want to learn about the new features (including creating enums from database fields and supporting geography data types).
Model First Modeling
Like the designer but no database yet? You may prefer to go this route of designing your model in the designer and letting the designer generate database schema for you. While I touch on some of the new designer features in this module, I don’t pay as much attention to them as I do in the DB First module because it would just be much too repetitive. But you will also see here how to define enums and geography data that will properly map the database schema that the designer creates.
For both model first and database first, you can learn more about customizing your model in the course Designer Supported EDM Customization.
Code First Modeling
If this is you: “eew designers stink” then you probably want to just use code to define your model. This gives highlights of Code FIrst along with the new enums & spatial data support. You can then continue your education in the EF 4.1 Code First course and the Code First Migrations course.
Interacting with your Data Model
Whether you’ve created your model with Database First, Model First or Code First, using the model is almost always the same. (“Almost” because code first does not yet support mapping to stored procedures so that’s the only real difference.) This module uses a simple console application to get you going with the basics of querying and updating your database using the DbContext. Once you’ve got an understanding of these basics, the dedicated DbContext, Querying and Validation courses that I’ve created in the past few years will get you the in-depth info you need for more advanced work.
Using EF in Your Solutions
I didn’t want to leave you with the impression that what you saw in the previous module is as far as EF can go. This last module introduces you to some good architectural practices and then I use EF (along with these basic architecture patterns) in a client side application (WPF), a web app (MVC) and a data service so you can see how the pieces fit together. I have a much more advanced course called “Entity Framework in the Enterprise” that you can watch after this. That course was created using Visual Studio 2010 and Code First and the DbContext and everything in there will be applicable to EF5.
Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!