0
votes

Maybe its just me but I am not a big fan of using the DBContext Generator as it adds overhead to development.

I like using the Entity Framework DBContext API but want to get rid of the hand coding of POCO classes. I am wondering if there are any T4 templates out there that can connect to MySQL or SqlServer and Generate the POCO classes from the database. Using the DBContext Generator template you have to update your database, update your model, re-run the T-4 templates to generate POCO classes. I would like to cut the steps down so that I don't have to generate and maintain a model.

Are there any T4 alternatives to the DBContext Generator that create the POCO classes and don't require an edmx model file?

1

1 Answers

2
votes

There was alternative in EF Power Tools CTP1 but that is far away from power of DbContext Generator. Moreover those generations features from power tools were only for initial class generation. It didn't include any possibility for updates once you do any changes in the database.

You have probably missed point of DbContext generator. This generator creates classes from mapping defined in EDMX. It is very easy to use - it has just single additional step with updating model. If you have model and T4 template in the same project you will even not need to regenerate classes yourselves - it will happen automatically once you save changes in EDMX (so it will be only two steps).

What you are looking for would still have two steps (updating model and running the template) so the difference is "none". What you are looking for would not provide any significant boost to your process. It will only make all mapping more complex because you will have to hardcode it into template - that is also reason why such template probably doesn't exist.