Entity framework is the new kid on the block on the ORM realm. It’s Microsoft new technology for data access, and although it didn’t receive very good comments on its first version, things have been greatly improved in its latest release. It now looks really interesting, with some features which surpass the most seasoned ORM frameworks that have been in the game for years.

Here’s what Entity Framework (EF) has to offer:

  • Using EF with the Model First approach, you design a schema of the model you want to implement, and EF generates a database and the code to implement it. Now, that’s what I call saving time! Using this approach, you can get going really really quick.
  • If you already have the code for your model, then EF can generate the database to store this model as well as the rest of the code handling persistance to this database, using the Code First approach.
  • In case you already have the database, EF can generate the code using the Database First approach.
  • EF uses Plain .Net objects (POCOs) with navigational properties to implement your model. Very easy stuff. The way EF lets you interact with the data once it’s retrieved from the DB is piece of cake (not the fact of data retrieval itself, that can get tricky).
  • Automatic code generation with T4 templates. Once you have EF set up in your project, there’s a bunch of templates to generate a lot of code for you. That doesn’t mean you must use it, but it’s there for your convenience, in case you think some templates can help you. Me myself I use some of the T4 templates, but not all of them. There’s some things I actually prefer doing manually.
  • Self-tracking entities will greatly simplify the process of implementing an over-the-wire scenario, in which you have different layers spanning across different systems and you have to serialize and de-serialize your entities. EF makes this really easy.
  • Local caching, to speed up your data access.
  • Lazy loading, which can improve overall application performance.
  • Support for LINQ (both coming from Microsoft, you would expect this, right?).
  • Convention over configuration. The hottest trend in software development. You wouldn’t think EF would miss it, would you? When starting up a new project with EF, the only thing you need to configure are the database server and its name. Nothing else. All other things are taken care of for you. Of course, if you want more control over what EF is doing, you can tweak it to meet your criteria. But that isn’t something you have do right at the beginning. This way, you can be productive much faster.
  • Support for the major databases: MS SQL Server (of course), Oracle, MySQL, PostgreSQL, etc…

And last but not least:

  • Coming from a big player in the industry like Microsoft, Entity Framework has great resources and a great community behind it. If you ever have a problem with EF, or want to tweak its behavior, chances are you’ll be finding what you need really fast. If you’re a seasoned developer, you’ll find this is one of the most important features of EF.

If you haven’t tried it out yet, don’t wait any longer and see for yourself what I’m talking about!