How to cleanly generate POCO classes from existing database using Entity Framework 4.3 Code First approach?

♀尐吖头ヾ 提交于 2019-12-11 09:37:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!