简体   繁体   English

System。*名称空间与自定义名称空间冲突

[英]System.* namespace collide with custom namespace

I have a problem with a custom namespace that collide with the namespace System.* 我的自定义命名空间与命名空间System。*相冲突。

Setup 设定

I have a custom library with the namespace Powerdoo.System it hold multiple tools and Extension of mine. 我有一个带有名称空间Powerdoo.System的自定义库,其中包含多个工具和我的Extension。

I have a Application that reference my custom tool library and includes a Entity Framework model. 我有一个引用我的自定义工具库的应用程序,其中包括一个实体框架模型。 The namespace of the application is Powerdoo.Model.MSSQL . 应用程序的名称空间是Powerdoo.Model.MSSQL

Problem 问题

My custom namespace collides with the .Net default namespace System.* . 我的自定义名称空间与.Net默认名称空间System。*冲突。

Like here the "using System" is interpreted as "using Powerdoo.System": 像这里一样,“使用系统”被解释为“使用Powerdoo.System”:

在此处输入图片说明

Question

Why is this happening and how can I avoid this problem without rename my tool library namespace or my application namespace. 为什么会发生这种情况,以及如何在不重命名我的工具库名称空间或应用程序名称空间的情况下避免此问题。

Update 1 更新1

Here is the reference tree of the application: 这是应用程序的参考树:

在此处输入图片说明

Update 2 更新2

If I use rigth-click > auto name space the reference using global::System.Data.Entity; 如果我使用rigth-click>自动命名空间,使用global :: System.Data.Entity;引用 is added. 被添加。

在此处输入图片说明

How can I bring Entity Framework to use global:: usings on auto generated classes? 如何使Entity Framework在自动生成的类上使用global :: usings?

You can use "global::System" for the .net System namespace. 您可以对.net系统名称空间使用“ global :: System”。 For your case, you have to alter the EF template. 对于您的情况,您必须更改EF模板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM