问题
I'm following the EF Code-First approach in a project that works against an existing database, to which I'm adding tables as needed.
This database has a number of tables for which I need to generate POCO classes for, and so I was wondering if there was a straight-forward, clean approach, to generating simple POCO classes from the database ... from which I can continue to work with using the general Code-First paradigm?
回答1:
You can use the Entity Framework Power Tools for that.
回答2:
If you want just the simple Poco classes without any relations use this T4 template
Generate entity class from database table
来源:https://stackoverflow.com/questions/11636359/how-to-cleanly-generate-poco-classes-from-existing-database-using-entity-framewo