Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public void Init()
        {
            typeFactory = new ContainerResolveCache(this.Container);

            this.ServiceController.Register(typeFactory);

            this.Container.RegisterAutoWiredTypes(this.Metadata.ServiceTypes);
        }
Exemplo n.º 3
0
        public void Init()
        {
            typeFactory = new ContainerResolveCache(this.Container);

            this.ServiceController.Register(typeFactory);

            ReloadServiceOperations();

            this.Container.RegisterAutoWiredTypes(this.ServiceController.ServiceTypes);
        }
        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);
        }
        /// <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);
            }
		}
Exemplo n.º 6
0
 public FunqValidatorFactory(Container container=null)
 {
     this.funqBuilder = new ContainerResolveCache(container ?? AppHostBase.Instance.Container);
 }