Why does the assembly namespace appear twice?

I am running a business-level project in a web project. I have added a business-level recovery project on the Web. When I call a class in a BL project, I need to write this namespace twice. I do not know why this is happening.

MyCompanyName.HRHead.DataLayer.MyCompanyName.HRHead.DataLayer.User 

I guess to call

 MyCompanyName.HRHead.DataLayer.User 

In my BL project, I defined all the class namespaces of MyCompanyName.HRHead.DataLayer

Please help me.

Thank you in advance

+4
source share
4 answers

I accept certain things from the tags you use. You are using the assembly written in VB.NET in your other project. The properties of the VB.NET project include the default namespace attribute and can be set with the namespace that you explicitly indicated at the top of your classes. Remove the default namespace (uncheck) in the project properties and recompile the same.

+2
source

In VB, a project has a default namespace - and this applies as a prefix to what you write in the source. This is not like C #, where the default namespace of a project only affects the source code template when adding a new element. So if your default namespace project is Foo.Bar and you also declare the namespace Foo.Bar.Baz , the full namespace will be Foo.Bar.Foo.Bar.Baz .

I suggest that you either change the project settings or simply remove the common prefix from the source code.

+6
source

If you are using C #, you can use this code segment:

 using MyCompanyName.HRHead.DataLayer.User = MyCompanyName.HRHead.DataLayer.MyCompanyName.HRHead.DataLayer.User; 

So you can use the namespace MyCompanyName.HRHead.DataLayer.User instead of MyCompanyName.HRHead.DataLayer.MyCompanyName.HRHead.DataLayer.User

Regards, About

0
source

you can also access the namespace if you start with a global namespace in C # as follows: global::MyCompanyName.HRHead.DataLayer.User

0
source

All Articles