예제 #1
0
        /// <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);
            }
        }
예제 #2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public ServiceCreator(IContainer container, ObjectInfoRegistry objectInfoRegistry, bool enableDebugMode)
 {
     this.container = container;
     this.objectInfoRegistry = objectInfoRegistry;
     this.enableDebugMode = enableDebugMode;
 }