Friday, January 18, 2013

POCO entities in EF 5.0

A small tip.
how to separate the edmx from the entites so we can share the entites as POCO classes?

Create a project with your model and another empty class library project to contain your entities.

Step 1: Add to your 'entities' project a new EF 5.x DBContext Generator.

Step 2: In the template '' change the 'inputfile' parameter to point to the 'entities' project.

Step 3: Delte & from your 'edmx' project.

Step 4: Add a reference from the 'edmx' project to the 'entities' project (you can also delete the ef references from the entities project).

Your entities are now separated from the edmx.
Good Luck!

No comments:

Post a Comment