在实体框架中更改命名空间 [英] Changing Namespaces in Entity Framework

查看:18
本文介绍了在实体框架中更改命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更改类的实体框架生成器使用的命名空间.

I am trying to change the Namespace used by Entity Framework Generator of classes.

当我单击我的实体的设计器 Model.edmx 时,我可以看到可以更改命名空间的地方:

When I click the designer of my Entity, Model.edmx, I can see somewhere where I can change the namespace:

命名空间

在 ConceptualEntityModel 属性下.更改了该名称空间,但什么也没发生.没用.所以,我从这个链接中阅读了一些帮助:

under ConceptualEntityModel properties. Changed that namespace, but nothing happened. Didn't work. So, I read some help from this link:

http://weblogs.asp.net/zeeshanhirani/在实体框架中的命名空间中挣扎

说我要改属性:自定义工具命名空间

很好,当我在控制台应用程序中单击 .edmx 的属性时,那里有属性.但是当我在 Web 应用程序 中使用相同的东西时,该属性不存在.只有一个名为 Web File Properties 的属性文件只有 3 个属性:

That's nice, when I click property of .edmx in console application, there property is there. But when I am using the same thing in a Web Application, the property is not there. There is only a property file called Web File Properties that simply has 3 properties:

  • 自定义工具
  • 文件名
  • 完整路径

我在这里错过了什么?

推荐答案

rainerh是对的:

我尝试设置 *.edmx 自定义工具命名空间 属性 - 这没有帮助.
我试图设置 *.Context.tt 属性 - 这也没有帮助.
但是,当我设置 *.tt 文件的 Custom Tool Namespace 属性(右键单击文件 -> 属性)时,会自动为之前生成的所有类设置命名空间.

I tried to set *.edmx Custom Tool Namespace property - this did not help.
I tried to set *.Context.tt property - this did not help too.
But when I set Custom Tool Namespace property of *.tt file (right-click on the file -> Properties) - namespace was set automatically for all the classes genereated before.

这篇关于在实体框架中更改命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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