Ejemplo n.º 1
0
        /// <summary>Initialises this object.</summary>
        ///
        /// <returns>A ServiceManager.</returns>
        public ServiceManager Init()
        {
            typeFactory = new ContainerResolveCache(this.Container);

            this.ServiceController.Register(typeFactory);

            this.Container.RegisterAutoWiredTypes(this.Metadata.ServiceTypes);

            return(this);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FunqControllerFactory" /> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="assemblies">The assemblies to reflect for IController discovery.</param>
        public FunqControllerFactory(Container container, params Assembly[] assemblies)
		{
			this.funqBuilder = new ContainerResolveCache(container);

            // aggregate the local and external assemblies for processing (unless ignored)
            IEnumerable<Assembly> targetAssemblies = assemblies.Concat(new[] { Assembly.GetCallingAssembly() });

            foreach (var assembly in targetAssemblies)
            {
                // Also register all the controller types as transient
                var controllerTypes =
                    (from type in assembly.GetTypes()
                     where typeof(IController).IsAssignableFrom(type)
                     select type).ToList();

                container.RegisterAutoWiredTypes(controllerTypes);
            }
		}
Ejemplo n.º 3
0
        /// <summary>Initializes a new instance of the NServiceKit.Mvc.FunqValidatorFactory class.</summary>
        ///
        /// <param name="container">The container.</param>
		public FunqValidatorFactory(Container container=null)
		{
			this.funqBuilder = new ContainerResolveCache(container ?? AppHostBase.Instance.Container);
		}