w0051977
w0051977

Reputation: 15817

Namespaces and projects

I am trying to introduce namespaces to a solution.

I have three projects in one solution:

Business Logic Layer
Data Access Layer
User Interface Layer

The namespaces of the classes in the business logic layer and data access layer are as follows:

companyname.applicationname.layername

If I want to access a class in the Data Logic Layer then I have to include the following statement:

Imports DataAccessLayer.companyname.applicationname.layername

I don't want to have DataAccessLayer as the first node. Is there a way around this or am I misunderstanding something fundamental about namespaces?

Upvotes: 0

Views: 68

Answers (3)

indiPy
indiPy

Reputation: 8072

First you need to define that class inside the desired namespace like,

Namespace companyname.applicationname
  Public Class layername

  End  Class
End Namespace

Or can make default namespace by changing property, enter image description here

Upvotes: 0

Kapil Khandelwal
Kapil Khandelwal

Reputation: 16144

For Namespace Naming Guidelines Check this:

Namespace Naming Guidelines

Try setting: Assembly Name & Default Namespace

enter image description here

Upvotes: 2

sj1900
sj1900

Reputation: 422

I'm not entirely sure of exactly what you're after, but here's a few options:

Import DataAccessLayer, then referring to the sub-namespaces directly:

Imports DataAccessLayer
...
companyname.applicationname.layername.mymethod(abc)

Make your assembly namespace in the project properties "DataAccessLayer". Then you won't need to import DataAccessLayer, just import companyname... or refer to companyname... directly.

Upvotes: 0

Related Questions