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 (Type registeredType in typesToRegister)
            {
                var item = new RegistrationItem(registeredType);

                registrationContainer.Registrations.Add(new KeyValuePair<Type, RegistrationItem>(registeredType, item));
            }

            return registrationContainer;
        }
Пример #4
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 (Type 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);
        }
        private ResolutionContext GetContext()
        {
            var registrationContainer = new RegistrationContainer();

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