Name collisions between layers
So I'm developing a very cool (and very large) n-tier application.
Basically I have the following assemblies:
Domain
Domain.ContractsServices
Services.ContractsPresentation.Admin
Presentation.Web Presentation.Core (shared between Admin & Web) I may implement Presentation.Core.ContractsMy main issue I'm wrestling with are name collisions between the different layers. Ie.
Services.Contracts.AccountServicesRequest
Domain.Contracts.AccountServicesRequestI 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.IAccountServiceI resolved this by now making all "service handlers" in the domain layer IxxxServiceHandler which gives me this:
Services.Contracts.IAccountService
Domain.Contracts.IAccountServiceHandlerHowever, I haven't been able to resolv开发者_如何学运维e 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?
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?
精彩评论