使用Power Tools的实体框架逆向工程师-无主键 [英] Entity Framework Reverse Engineer using Power Tools - No Primary Keys

查看:117
本文介绍了使用Power Tools的实体框架逆向工程师-无主键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了Entity Framework Power Tools Beta 2对我的模型类进行反向工程. 但是,没有在数据注释中声明任何主键. 有办法吗?

I've used the Entity Framework Power Tools Beta 2 to reverse engineer my model classes. However no primary keys have been declared in the data annotations. Is there a way to do this?

推荐答案

默认情况下,映射是通过fluent完成的.

By default, the mapping done via fluent.

如果要更改此设置,可以自定义用于生成模型的TT文件.将其从mapping.tt中删除的位置,然后将数据注释添加到entity.tt中. Rowan Miller提出了很棒的帖子.

If you want to change that, you can customize the TT files used to generate the model. Where you would remove it from the mapping.tt and then add the data annotation to entity.tt. Rowan Miller made a great post about that.

这篇关于使用Power Tools的实体框架逆向工程师-无主键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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