You need a service locator with automated dependency injection support? No need for heavyweight IoC Containers with so many options and functionalities? This library provides exactly this!!!
public class TestAppMap : ServiceMap
{
public override void Load()
{
For<INavigationRepository>().Use<NavigationCassandraRepository>();
For<ITracker>().Use<Tracking>(new ConstructorDependency(typeof(INavigationRepository)));
}
}
ServiceLocator.Current.For<INavigationRepository>().Use<NavigationMsSqlRepository>();
ServiceLocator.Current.For<INavigationRepository>("sql").Use<NavigationMsSqlRepository>();
ServiceLocator.Current.Use<TestAppMap>();
ServiceLocator.Current.LoadServiceMap<TestAppMap>();
ServiceLocator.Current.GetService<INavigationRepository>("sql");
- Support to named instance injection
- Support to property injection
- JSON mapping