在实体框架中更改命名空间

2

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

问题描述

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

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.

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

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

参数计数与调用不匹配?
Parameter count mismatch with Invoke?(参数计数与调用不匹配?)...
2023-11-11 C#/.NET开发问题
26

如何将代表存储在列表中
How to store delegates in a List(如何将代表存储在列表中)...
2023-11-11 C#/.NET开发问题
6

代表如何工作(在后台)?
How delegates work (in the background)?(代表如何工作(在后台)?)...
2023-11-11 C#/.NET开发问题
5

没有 EndInvoke 的 C# 异步调用?
C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)...
2023-11-11 C#/.NET开发问题
2

Delegate.CreateDelegate() 和泛型:错误绑定到目标方法
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11 C#/.NET开发问题
14