All the time, in my INFRASTRUCTURE
module set the interfaces which work as service. And each module create a concrete class of that service.
But this time, I need a service which will have to use all the modules
In infrastructure I have:
public interface IApplicationMenuRegistry
{
void RegisterMenuItem(string menuItemName, string description, Type viewType);
}
Each moduleInit receive this interface, and it registers a menu item.
Where should I have to create the concrete service ApplicationMenuRegistry
? In Infrastructure? Or in another module?
The most correct answer will be: "it depends". Sometimes you should create the concrete service in the "infrastructure", sometimes somewhere else. But I would suggest you to look at the DI frameworks, there are a lot of different .NET implementations. Let DI framework care about providing IApplicationMenuRegistry
implementation to the target objects.