コード例 #1
0
        public GlobalFunqControllerFactory(Container container)
        {
            this.funqBuilder = new ContainerResolveCache(container);

            // Also register all the controller types as transient
            var controllerTypes =
                AppDomain.CurrentDomain
                    .GetAssemblies()
                    .SelectMany(ass =>
                    {
                        try
                        {
                            return ass.GetTypes();
                        }
                        catch (ReflectionTypeLoadException ex)
                        {
                            return ex.Types.Where(t => t != null);
                        }
                    })
                    .Where(type =>
                    {
                        try
                        {
                            return typeof(IController).IsAssignableFrom(type);
                        }
                        catch (TypeLoadException ex)
                        {
                            return false;
                        }
                    })
                    .ToList();

            container.RegisterAutoWiredTypes(controllerTypes, ReuseScope.None);
        }
コード例 #2
0
        public void Init()
        {
            typeFactory = new ContainerResolveCache(this.Container);

            this.ServiceController.Register(typeFactory);

            this.Container.RegisterAutoWiredTypes(this.Metadata.ServiceTypes);
        }
コード例 #3
0
        public void Init()
        {
            typeFactory = new ContainerResolveCache(this.Container);

            this.ServiceController.Register(typeFactory);

            ReloadServiceOperations();

            this.Container.RegisterAutoWiredTypes(this.ServiceController.ServiceTypes);
        }
コード例 #4
0
        public FunqControllerFactory(Container container)
        {
            this.funqBuilder = new ContainerResolveCache(container);

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

            container.RegisterAutoWiredTypes(controllerTypes);
        }
コード例 #5
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);
            }
		}
コード例 #6
0
 public FunqValidatorFactory(Container container=null)
 {
     this.funqBuilder = new ContainerResolveCache(container ?? AppHostBase.Instance.Container);
 }