internal IRegistrationSource GetLazyRegistrationSource(Type typeToRegister)
        {
            var registrationContainer = new RegistrationContainer();

            registrationContainer.AddRegistration(new RegistrationItem(typeToRegister));

            return(new LightCore.Registration.RegistrationSource.LazyRegistrationSource(registrationContainer));
        }
        internal IRegistrationSource GetOpenGenericRegistrationSource(Type contractType, Type implementationType)
        {
            var registrationContainer = new RegistrationContainer();

            registrationContainer.AddRegistration(new RegistrationItem(contractType)
            {
                ImplementationType = implementationType,
                Lifecycle          = new TransientLifecycle()
            });

            return(new LightCore.Registration.RegistrationSource.OpenGenericRegistrationSource(registrationContainer));
        }
예제 #3
0
        /// <summary>
        /// Gets a fake registration container with given registered types.
        /// </summary>
        /// <param name="typesToRegister">The types to register.</param>
        /// <returns>The registration container with registered types.</returns>
        internal static RegistrationContainer GetRegistrationContainerFor(Type[] typesToRegister)
        {
            var registrationContainer = new RegistrationContainer();

            foreach (var registeredType in typesToRegister)
            {
                var item = new RegistrationItem(registeredType);

                registrationContainer.AddRegistration(item);
            }

            return(registrationContainer);
        }
        private ResolutionContext GetContext(Type contractType, Type implementationType)
        {
            var registrationContainer = new RegistrationContainer();

            var registration = new RegistrationItem(contractType)
            {
                Activator =
                    new LightCore.Activation.Activators.ReflectionActivator
                    (
                        implementationType,
                        new LightCore.Activation.Components.ConstructorSelector(),
                        new LightCore.Activation.Components.ArgumentCollector()
                    ),
                Lifecycle = new TransientLifecycle()
            };

            registrationContainer.AddRegistration(registration);

            return(new ResolutionContext(new Container(registrationContainer), registrationContainer));
        }