使用实体框架生成POCO类和现有数据库的映射 [英] Generate POCO classes and the mapping for an existing database using Entity Framework

查看:106
本文介绍了使用实体框架生成POCO类和现有数据库的映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以自动生成POCO类和使用Fluent API(而不是注释)为现有数据库单独定义的数据库的映射?而不是手动对所有这些实体类进行编码,如果它们是自动生成的,我会发现它更容易,如果名称不正确(复数或单数)或某些关系没有正确映射等等,那么我可以根据需要更改它们。相对于从头开始编写所有实体类和关系,我将节省大量的时间,而且我不熟悉流畅的API语法。

Is it possible to auto generate the POCO classes and the mapping with the database defined separately using Fluent API (instead of annotations) for an existing database? Instead of coding all these entity classes manually, I find it easier if they are auto generated and then I can change them as required if the names are not incorrect (plural or singular) or the some of the relationships are not correctly mapped etc. This will save lot of time for me compared to coding all the entity classes and relationships from scratch and I am not that familiar with the fluent API syntax as well.

推荐答案

是的,我鼓励您使用实体框架权力工具CTP1


逆向工程师代码首先 - 为现有数据库生成POCO类,派生DbContext和Code First映射。 p>

Reverse Engineer Code First - Generates POCO classes, derived DbContext and Code First mapping for an existing database.

希望这有助于

这篇关于使用实体框架生成POCO类和现有数据库的映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆