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.
这篇关于在实体框架中更改命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在实体框架中更改命名空间
基础教程推荐
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 将数据集转换为列表 2022-01-01
- 如果条件可以为空 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 获取C#保存对话框的文件路径 2022-01-01
