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

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

问题描述



当我点击我的Entity,Model.edmx的设计器,我可以看到某个地方我可以在ConceptualEntityModel属性下更改命名空间:



命名空间



改变了这个命名空间,但没有发生什么。没有工作所以,我从这个链接中看到一些帮助:



http://weblogs.asp.net/zeeshanhirani/struggling-through-namespace-in-entity-framework



说我必须更改属性:自定义工具命名空间



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




  • 自定义工具

  • 文件名

  • 全路径



这里?

解决方案

rainerh 是正确的:



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


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

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

Namespace

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/struggling-through-namespace-in-entity-framework

says that I have to change the property: Custom Tool Namespace

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:

  • Custom Tool
  • File Name
  • Full Path

What am I missing here?

解决方案

rainerh is right:

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天全站免登陆