Install-Package ExistsForAll.Shepherd.SimpleInjector
SimpleInjector is a great IoC Container, over the years it became my go to DI for every project.
Thus we've developed methodologies to register infrastructure and domain services quickly.
Shepherd should act as your Composition Root in your application startup.
- Getting started
- SimpleInjector Configuration
- Assemblies
- Modules
- Auto-Registration
var shepherd = new Shepherd();
var container = shepherd.AddPublicTypesAssemblies(Assemblies)
.AddModule(LoggingModule, DataAccessModule, ConfigurationModule)
.Herd();Shepherd will gather all the types from the given assemblies (all or only public), iterate over all the modules by order of insertion and auto-register all remaining domain services. The return value from the Herd() method is SimpleInjector container.
- The first thing
Shepherddoes after validation and configuration is to gather all the types from the given assemblies. - Then
ShepherdWill iterate over all theModulesin the order of insertion, after thatShepherdwill index. Shepherdwill index all interfaces to matching implementation and will register them as explained in the Auto-Registration section.
