/// <summary> /// Creates a new container, consuming the provided builder. /// </summary> /// <param name="builder"></param> public Container(ContainerBuilder builder) { ContainerScope = new Scoped(this); Registrations = builder.Registrations; Settings = builder.Settings; DependencyGraph = new InstanceFactoryResolver(builder.Registrations, ContainerScope, Settings, null); }
/// <summary> /// Creates a new child container using the provided builder. /// </summary> /// <param name="parentContainer"></param> /// <param name="builder"></param> private Container(Container parentContainer, ContainerBuilder builder) { Settings = parentContainer.Settings; _parentContainer = parentContainer; ContainerScope = new Scoped(this); Registrations = builder.Registrations; DependencyGraph = new InstanceFactoryResolver(builder.Registrations, ContainerScope, Settings, parentContainer.DependencyGraph); }
private Container(Container parentContainer, Action <ContainerBuilder>?builder) { var context = new ContainerBuilder(this); builder?.Invoke(context); _options = parentContainer._options; _containerScope = new Scoped(this); Registrations = context.Registrations; _dependencyGraph = new DependencyGraph(context.Registrations, _containerScope, _options, parentContainer._dependencyGraph); }
/// <summary> /// Creates a new container using the provided builder. /// </summary> /// <param name="builder"></param> /// <param name="options"></param> public Container(Action <ContainerBuilder>?builder = null, SingularitySettings?options = null) { var context = new ContainerBuilder(this); builder?.Invoke(context); _options = options ?? SingularitySettings.Default; _containerScope = new Scoped(this); Registrations = context.Registrations; _dependencyGraph = new DependencyGraph(context.Registrations, _containerScope, _options); }
/// <summary> /// Replaces the <see cref="SingularitySettings"/> /// </summary> /// <param name="settings"></param> public void ConfigureSettings(SingularitySettings settings) { Settings = settings; }