Question

So I'm developing a very cool (and very large) n-tier application.

Basically I have the following assemblies:

Domain
Domain.Contracts

Services
Services.Contracts

Presentation.Admin
Presentation.Web
Presentation.Core (shared between Admin & Web)
I may implement Presentation.Core.Contracts

My main issue I'm wrestling with are name collisions between the different layers. Ie.

Services.Contracts.AccountServicesRequest
Domain.Contracts.AccountServicesRequest

I had the same issue with Service names (in this case I am just using classes as services rather than WCF, etc). Ie:

Services.Contracts.IAccountService
Domain.Contracts.IAccountService

I resolved this by now making all "service handlers" in the domain layer IxxxServiceHandler which gives me this:

Services.Contracts.IAccountService
Domain.Contracts.IAccountServiceHandler

However, I haven't been able to resolve this issue with the objects that are passed back and forth between layers. This seems to be sprinkled in a bunch of places through my solution(s). I was just curious to see if anyone has had the same issues. If so, how did you resolve them?

Was it helpful?

Solution

Yes, I have run into this problem, but I have fixed it soon enough every time.

A good class naming convention can help. Avoid using the same name in classes across multiple layers.

Alternatively, you can use namespace aliases, so that you would be using, for example:

services::IAccountService
domain::IAccountService

Does this help?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top