Esempio n. 1
0
        /// <summary>
        /// Create a new container.
        /// </summary>
        internal Container()
        {
            _componentRegistry = new ComponentRegistry();

            _componentRegistry.Register(new ComponentRegistration(
                LifetimeScope.SelfRegistrationId,
                new DelegateActivator(typeof(LifetimeScope), (c, p) =>
                {
                    throw new InvalidOperationException("The container's self-registration of context interfaces should never be activated as it is hard-wired into the LifetimeScope class.");
                }),
                new CurrentScopeLifetime(),
                InstanceSharing.Shared,
                InstanceOwnership.ExternallyOwned,
                new Service[] { new TypedService(typeof(ILifetimeScope)), new TypedService(typeof(IComponentContext)) },
                new Dictionary<string, object>()));

            _rootLifetimeScope = new LifetimeScope(_componentRegistry);
        }
Esempio n. 2
0
		/// <summary>
		/// Create a new container.
		/// </summary>
		internal Container()
		{
			_componentRegistry = new ComponentRegistry();

			_componentRegistry.Register(new ComponentRegistration(
				LifetimeScope.SelfRegistrationId,
				new DelegateActivator(typeof(LifetimeScope), (c, p) =>
				{
					throw new InvalidOperationException(ContainerResources.SelfRegistrationCannotBeActivated);
				}),
				new CurrentScopeLifetime(),
				InstanceSharing.Shared,
				InstanceOwnership.ExternallyOwned,
				new Service[] { new TypedService(typeof(ILifetimeScope)), new TypedService(typeof(IComponentContext)) },
				new Dictionary<string, object>()));

			_rootLifetimeScope = new LifetimeScope(_componentRegistry);
		}