public void RegisterObject(object instance, Type targetType) { AssemblyRegistrar.RegisterIfNotExist(Storage.Assemblies, targetType); IEnumerable <IService> services = ServicesGenerator.GenerateServices(targetType, Storage.Assemblies, null, null, instance); ServiceRegistrar.Register(Storage.Services, services); }
public void RegisterAssembly(Assembly assembly) { AssemblyRegistrar.RegisterIfNotExist(Storage.Assemblies, assembly); foreach (Type type in assembly.GetTypes()) { ServiceRegistrar.Register(Storage.Services, ServicesGenerator.GenerateServices(type, Storage.Assemblies, null)); } }
public void RegisterObject <TKey>(object instance) { Type type = TypeGetter.GetType(instance); AssemblyRegistrar.RegisterIfNotExist(Storage.Assemblies, type); IEnumerable <IService> services = ServicesGenerator.GenerateServices(type, Storage.Assemblies, null, null, instance); ServiceRegistrar.Register(Storage.Services, services); }
public T ResolveOrDefault <T>() { Type type = TypeGetter.GetType <T>(); AssemblyRegistrar.RegisterIfNotExist(Storage.Assemblies, type); IService service = ServiceFinder.Find(Storage.Services, type); if (service == null) { return(default);
public void RegisterAssembly <T>() { Type tType = TypeGetter.GetType <T>(); AssemblyRegistrar.RegisterIfNotExist(Storage.Assemblies, tType); foreach (Type type in tType.Assembly.GetTypes()) { ServiceRegistrar.Register(Storage.Services, ServicesGenerator.GenerateServices(type, Storage.Assemblies, null)); } }
public void Register(Type type) { AssemblyRegistrar.RegisterIfNotExist(Storage.Assemblies, type); IEnumerable <IService> services = ServicesGenerator.GenerateServices(type, Storage.Assemblies, null); foreach (IService service in services) { if (ServiceIsAutoValueChecker.Check(service)) { ServiceInitializer.Initialize(service, this); } } ServiceRegistrar.Register(Storage.Services, services); }
public object ResolveOrAuto(Type type) { AssemblyRegistrar.RegisterIfNotExist(Storage.Assemblies, type); IService service = ServiceFinder.Find(Storage.Services, type); if (service == null) { IEnumerable <IService> services = ServicesGenerator.GenerateServices(type, Storage.Assemblies, this); ServiceRegistrar.Register(Storage.Services, services); return(ServiceInstanceResolver.ResolveInstance(ServiceFinder.Find(Storage.Services, type), this)); } return(ServiceInstanceResolver.ResolveInstance(service, this)); }