public virtual IRegistration Build() { var injector = InjectorCache.GetOrBuild(ImplementationType); return(new Registration( ImplementationType, Lifetime, InterfaceTypes, Parameters, injector)); }
public override IRegistration Build() { var injector = InjectorCache.GetOrBuild(ImplementationType); return(new SystemRegistration( ImplementationType, InterfaceTypes, Parameters, injector, worldName, systemGroupType)); }
public override IRegistration Build() { var injector = InjectorCache.GetOrBuild(ImplementationType); var destination = new ComponentDestination(prefab, parent, parentFinder, gameObjectName); return(new ComponentRegistration( ImplementationType, Lifetime, InterfaceTypes, Parameters, injector, destination)); }
public void CircularDependency() { var builder = new ContainerBuilder(); builder.Register <HasCircularDependency1>(Lifetime.Transient); builder.Register <HasCircularDependency2>(Lifetime.Transient); var injector = InjectorCache.GetOrBuild(typeof(HasCircularDependency1)); // Only reflection mode can detect circular dependency errors at runtime. if (injector is ReflectionInjector) { // Assert.Throws<AggregateException>(() => builder.Build()); Assert.Throws <VContainerException>(() => builder.Build(), "Circular dependency detected! type: VContainer.Tests.HasCircularDependency1"); } }
public void Inject(object instance, params IInjectParameter[] parameters) { var injector = InjectorCache.GetOrBuild(instance.GetType()); injector.Inject(instance, this, parameters); }
public void Inject(object instance) { var injector = InjectorCache.GetOrBuild(instance.GetType()); injector.Inject(instance, this, null); }