We've created some domain services. On top of our services, we've added a Web Api layer on top to allow RESTFUL interactions with our services. We are using StructureMap for IOC. To get this to work I had to reference the domain and repository projects to our Web Api project. I want to avoid this.
With these references, it could allow developers to start referencing domain objects or repositories in our service layer. Through code reviews we can prevent that but I'd prefer to remove the references completely.
Our container is registered in this manner:
IContainer container = IoC.Initialize();
GlobalConfiguration.Configuration.DependencyResolver = new StructureMapDependencyResolver(container);
[Service Layer] --> [Domain Services] -- >[Domain Models] and [Repositories]
How do I register these dependencies in our Domain Services but not the Web Api Service Layer? Or have an IoC container for the Web Api Layer and then one for the Domain Services? Domain Services is nothing more than a Façade/Orchestration. It can be consumed by a Web Api Service Layer, WCF Service, or directly from applications like WPF or WinForms.
Thoughts?