Exemplo n.º 1
0
        public virtual object GetService(Type service)
        {
            object serviceInstance = null;

            if (typeof(IDictionaryService) == service)
            {
                serviceInstance = (IDictionaryService)this;
            }

            if (typeof(INestedContainer) == service)
            {
                if (_nestedContainer == null)
                {
                    _nestedContainer = new DesignModeNestedContainer(_component, null);
                }
                serviceInstance = _nestedContainer;
            }

            // Avoid returning the site specific IServiceContainer
            if (serviceInstance == null && service != typeof(IServiceContainer) &&
                _siteSpecificServices != null)
            {
                serviceInstance = _siteSpecificServices.GetService(service);
            }

            if (serviceInstance == null)
            {
                serviceInstance = _serviceProvider.GetService(service);
            }

            return(serviceInstance);
        }
        public void DisposeOwner_Invoke_Success()
        {
            var owner     = new Component();
            var container = new NestedContainer(owner);

            owner.Dispose();
            owner.Dispose();
        }
        public void Ctor_IComponent()
        {
            var owner     = new Component();
            var container = new NestedContainer(owner);

            Assert.Same(owner, container.Owner);
            Assert.Empty(container.Components);
        }
Exemplo n.º 4
0
        public static IContainer CheckForNestedContainer(IContainer container)
        {
            NestedContainer container2 = container as NestedContainer;

            if (container2 != null)
            {
                return(container2.Owner.Site.Container);
            }
            return(container);
        }
Exemplo n.º 5
0
		public virtual object GetService (Type service)
		{
			object serviceInstance = null;

			if (typeof (IDictionaryService) == service)
				serviceInstance = (IDictionaryService) this;

			if (typeof (INestedContainer) == service) {
				if (_nestedContainer == null)
					_nestedContainer = new DesignModeNestedContainer (_component, null);
				serviceInstance = _nestedContainer;
			}

			if (serviceInstance == null && _siteSpecificServices != null)
				serviceInstance = _siteSpecificServices.GetService (service);

			if (serviceInstance == null)
				serviceInstance = _serviceProvider.GetService (service);

			return serviceInstance;
		}
Exemplo n.º 6
0
			public Site (IComponent component, NestedContainer container, string name)
			{
				_component = component;
				_nestedContainer = container;
				_siteName = name;
			}
Exemplo n.º 7
0
 public void CleanUpNestedContainer()
 {
     WebSite?.Close();
     NestedContainer?.Dispose();
 }
 public void CleanupNestedContainer()
 {
     NestedContainer?.Dispose();
     NestedContainer = null;
 }
Exemplo n.º 9
0
 internal Site(IComponent component, NestedContainer container, string?name)
 {
     Component = component;
     Container = container;
     _name     = name;
 }