实体框架-仅edmx,无模板 [英] Entity Framework - only edmx without templates
问题描述
我们只想添加.EDMX文件,而没有为上下文和实体添加相应的.tt文件.造成这种情况的原因有很多,但总的来说很短-我们希望能够拥有.EDMX并在需要时能够从数据库中刷新它.
We would like to add only .EDMX files without corresponding .tt files for context and entities. There is multiple reasons for this, but long story short - we would like to be able to have .EDMX and be able to refresh it from DB when needed.
当前,如果我每次从数据库更新"时都删除.tt文件,它将重新生成我们不需要的.tt文件和实体.
Currently if I delete .tt files every time I "Update from DB" it will regenerate .tt files and entitites which we don't need.
推荐答案
如果只包含两个空的.tt
文件的.edmx
就足够了,您可以这样做:
If it's enough to have only the .edmx
with two empty .tt
files you can do that:
- 添加实体数据模型(数据库中的EF Designer)
- 取消工具的初始执行 每个
- 空
Custom Tool
值 - 如果需要,删除
.tt
文件的内容 - 删除
.diagram
文件
.tt
文件和.edmx
文件上的- Add the Entity Data Model (EF Designer from database)
- Cancel initial execution of the tools
- Empty
Custom Tool
value on each.tt
file and on the.edmx
file - Delete contents of the
.tt
files if you want - Delete
.diagram
file
完成此步骤后,您可以更新您的.edmx
文件,没有任何反应.
After this steps, you can update your .edmx
file and nothing happens.
这篇关于实体框架-仅edmx,无模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!