public Container Build() { if (hasBeenBuilt) { throw new InvalidOperationException("The container has been built."); } #region Please implement the code to pass the test /* * Since all the build operation can be considered as constructing the * ComponentRegistry. Please create a component registry and construct * its data. Then attach the registry to Container. * */ var componentResitry = new ComponentRegistry(); foreach (var callback in callbacks) { callback(componentResitry); } hasBeenBuilt = true; return(new Container(componentResitry)); #endregion }
public LifetimeScope(ComponentRegistry componentRegistry, ILifetimeScope parent) { if (componentRegistry == null) { throw new ArgumentNullException(nameof(componentRegistry)); } this.componentRegistry = componentRegistry; RootScope = parent?.RootScope ?? this; }
public LifetimeScope(ComponentRegistry componentRegistry, ILifetimeScope parent) { if (componentRegistry == null) { throw new ArgumentNullException(nameof(componentRegistry)); } this.componentRegistry = componentRegistry; #region Please initialize root scope RootScope = parent?.RootScope ?? parent; #endregion }
public LifetimeScope(ComponentRegistry componentRegistry, ILifetimeScope parent) { if (componentRegistry == null) { throw new ArgumentNullException(nameof(componentRegistry)); } this.componentRegistry = componentRegistry; #region Please initialize root scope throw new NotImplementedException(); #endregion }
public Container Build() { if (hasBeenBuilt) { throw new InvalidOperationException("The container has been built."); } var componentRegistry = new ComponentRegistry(); foreach (Action <ComponentRegistry> callback in callbacks) { callback(componentRegistry); } hasBeenBuilt = true; return(new Container(componentRegistry)); }
public LifetimeScope(ComponentRegistry componentRegistry) { this.componentRegistry = componentRegistry; }
public LifetimeScope(ComponentRegistry componentRegistry) : this(componentRegistry, null) { }
internal Container(ComponentRegistry componentRegistry) { this.componentRegistry = componentRegistry; }