Reputation: 932
I would dearly love to get rid of the hideous EDMX blob that we are currently wrestling with in our project. Our project is database first, and currently we create the EDMX file using the awful and buggy EDM designer, from whence we generate DbContext and POCO entities using T4 templates.
As the project has matured we find that we have very little difference between our database model and our entity model, essentially a 1-to-1 entity to table mapping which seems to be the mode that EF most prefers. Our only deviation from this is a single use of Table-per-Type inheritance between four of our entities. This in itself has not prooved to be a good design and could well be disgarded.
My question then is - we have no need of the EDMX file, we should be able to drive creation of our DbContext and entity classes directly from the database model, is there a T4 template that can do that?
I have found this post from Oleg Sych from a couple of years ago which provided T4 templates to accomplish this but the output is for ObjectContext not DbContext. I could of course look to enhance what has been done here, but I don't want to reinvent the wheel if someone already has got this working.
Any suggestions?
Upvotes: 0
Views: 308
Reputation: 29130
I've used the Entity Framework Power Tools extension to generate POCO models, mapping classes and dbContext from the database.
Upvotes: 1