/// <summary> /// Constructor. /// </summary> /// <param name="registrations">Registrations.</param> /// <param name="parentContainer">Optional parent container.</param> /// <param name="enableDebugMode">Enable debug mode.</param> public OdysseyContainer(IEnumerable <Registration> registrations, OdysseyContainer parentContainer = null, bool enableDebugMode = false) { // Setup registration process registry. registrationProcessRegistry = new RegistrationProcessRegistry( parentContainer != null ? parentContainer.registrationProcessRegistry : null, enableDebugMode); // Setup object info registry. objectInfoRegistry = new ObjectInfoRegistry(registrations); // Setup service creator. serviceCreator = new ServiceCreator(this, objectInfoRegistry, enableDebugMode); // Setup resolution processor. resolutionProcessor = new ResolutionProcessor(registrationProcessRegistry, serviceCreator, enableDebugMode); // Setup the registration processor. var registrationProcessor = new RegistrationProcessor(serviceCreator, enableDebugMode); AddThisContainerToRegistrationProcessRegistry(registrationProcessor); // Add each registration to the registration process registry. foreach (Registration registration in registrations) { var process = registrationProcessor.CreateProcess(registration); registrationProcessRegistry.AttachProcess(process); } }
/// <summary> /// Constructor. /// </summary> /// <param name="registrationProcessRegistry">Registration process registry.</param> /// <param name="serviceCreator">Service creator.</param> /// <param name="enableDebugMode">Enable debug mode.</param> public ResolutionProcessor(RegistrationProcessRegistry registrationProcessRegistry, ServiceCreator serviceCreator, bool enableDebugMode) { Argument.NotNull(nameof(registrationProcessRegistry), registrationProcessRegistry); Argument.NotNull(nameof(serviceCreator), serviceCreator); this.registrationProcessRegistry = registrationProcessRegistry; this.serviceCreator = serviceCreator; this.enableDebugMode = enableDebugMode; }
/// <summary> /// Constructor. /// </summary> public RegistrationProcessor(ServiceCreator serviceCreator, bool enableDebugMode) { this.serviceCreator = serviceCreator; this.enableDebugMode = enableDebugMode; }