实体框架-仅edmx,无模板 [英] Entity Framework - only edmx without templates

查看:84
本文介绍了实体框架-仅edmx,无模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们只想添加.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:

  1. 添加实体数据模型(数据库中的EF Designer)
  2. 取消工具的初始执行
  3. 每个.tt文件和.edmx文件上的
  4. Custom Tool
  5. 如果需要,删除.tt文件的内容
  6. 删除.diagram文件
  1. Add the Entity Data Model (EF Designer from database)
  2. Cancel initial execution of the tools
  3. Empty Custom Tool value on each .tt file and on the .edmx file
  4. Delete contents of the .tt files if you want
  5. Delete .diagram file

完成此步骤后,您可以更新您的.edmx文件,没有任何反应.

After this steps, you can update your .edmx file and nothing happens.

这篇关于实体框架-仅edmx,无模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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