Changing Namespaces in Entity Framework(在实体框架中更改命名空间)
问题描述
我正在尝试更改类的实体框架生成器使用的命名空间.
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.
这篇关于在实体框架中更改命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在实体框架中更改命名空间


基础教程推荐
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01