public void ScanTypes(TypeSet types, Registry registry)
 {
     foreach (var type in types.AllTypes())
     {
         registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
     }
 }
 public void ScanTypes(TypeSet types, Registry registry)
 {
     foreach (var type in types.AllTypes())
     {
         Process(type, registry);
     }
 }
Пример #3
0
        public void ScanTypes(TypeSet types, Registry registry)
        {
            types.FindTypes(TypeClassification.Closed | TypeClassification.Concretes)
                .Where(Registry.IsPublicRegistry)
                .Each(type => registry.Configure(x => x.ImportRegistry(type)));

        }
Пример #4
0
 public void ScanTypes(TypeSet types, Registry registry)
 {
     types.FindTypes(TypeClassification.Concretes).Where(Matches).Each(type =>
     {
         var name = _getName(type);
         registry.AddType(GetLeastSpecificButValidType(_pluginType, type), type, name);
     });
 }
 public void ScanTypes(TypeSet types, Registry registry)
 {
     // Only work on concrete types
     types.FindTypes(TypeClassification.Concretes | TypeClassification.Closed).Each(type =>
     {
         // Register against all the interfaces implemented
         // by this concrete class
         type.GetInterfaces().Each(@interface => registry.For(@interface).Use(type));
     });
 }
Пример #6
0
 public void ScanTypes(TypeSet types, Registry registry)
 {
     foreach (var type in types.AllTypes())
     {
         if (type.CanBeCastTo<Controller>() && !type.IsAbstract)
         {
             registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
         }
     }
 }
Пример #7
0
        public void ScanTypes(TypeSet types, Registry registry)
        {
            var matches = types.FindTypes(TypeClassification.Concretes | TypeClassification.Closed)
                .Where(type => type.CanBeCastTo<ITeam>());

            foreach (var type in matches)
            {
                registry.For(typeof (ITeam)).Add(type);
            }
        }
Пример #8
0
        public void ScanTypes(TypeSet types, Registry registry)
        {
            // Only work on concrete types
            types.FindTypes(TypeClassification.Concretes | TypeClassification.Closed).ForEach(type =>
            {

                if (type.Name.EndsWith("Job"))
                    registry.For(type).Singleton();
            });
        }
Пример #9
0
 public void ScanTypes(TypeSet types, Registry registry)
 {
     types.AllTypes().ToList().ForEach(type =>
     {
         if (type.CanBeCastTo<Controller>() && !type.IsAbstract)
         {
             registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
         }
     });
 }
Пример #10
0
 public void ScanTypes(TypeSet types, Registry registry)
 {
     types.FindTypes(TypeClassification.Concretes | TypeClassification.Closed).ForEach(type =>
     {
         if (type.CanBeCastTo<ControllerBase>())
         {
             registry.For(type).LifecycleIs(new UniquePerRequestLifecycle()).Use(type);
         }
     });
 }
Пример #11
0
		public void ScanTypes(TypeSet types, Registry registry)
		{
			var controllerTypes =
				types.FindTypes(TypeClassification.Concretes | TypeClassification.Closed)
					.Where(t => t.CanBeCastTo<Controller>());
			foreach (var type in controllerTypes)
			{
				registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());

			}
		}
Пример #12
0
 public override void ScanTypes(TypeSet types, Registry registry)
 {
     types.FindTypes(TypeClassification.Concretes).Where(type => type.HasConstructors()).Each(type =>
     {
         var pluginType = FindPluginType(type);
         if (pluginType != null)
         {
             registry.AddType(pluginType, type);
             ConfigureFamily(registry.For(pluginType));
         }
     });
 }
Пример #13
0
        public override void ScanTypes(TypeSet types, Registry registry)
        {
            types.FindTypes(TypeClassification.Concretes).Where(x => x.HasConstructors()).Each(type =>
            {
                var interfaceType = type.AllInterfaces().FirstOrDefault();
                if (interfaceType != null)
                {
                    registry.AddType(interfaceType, type);
                    ConfigureFamily(registry.For(interfaceType));
                }
            });

        }
Пример #14
0
 public void ScanTypes(TypeSet types, Registry registry)
 {
     foreach(var type in types.FindTypes(TypeClassification.Concretes | TypeClassification.Closed))
     {
         if (type.CanBeCastTo<Controller>() && !type.IsAbstract)
         {
             registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
         }
         else if (type.CanBeCastTo<ApiController>() && !type.IsAbstract)
         {
             registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
         }
     }
 }
Пример #15
0
        public void ScanTypes(TypeSet types, Registry registry)
        {
            // Only work on concrete types
            types.FindTypes(TypeClassification.Concretes | TypeClassification.Closed).ForEach(type =>
            {

                type.GetInterfaces()
                    .Where(@interface => @interface.Name == $"I{type.Name}")
                    .ForEach(@interface => registry.For(@interface).Use(type).Singleton());

                if (type.Name.EndsWith("Job"))
                    registry.For(type).Singleton();
            });
        }
Пример #16
0
        public override void ScanTypes(TypeSet types, Registry registry)
        {
            var interfaces = types.FindTypes(TypeClassification.Interfaces);
            var concretes = types.FindTypes(TypeClassification.Concretes).Where(x => x.HasConstructors()).ToArray();

            interfaces.Each(@interface =>
            {
                var implementors = concretes.Where(x => x.CanBeCastTo(@interface)).ToArray();
                if (implementors.Count() == 1)
                {
                    registry.AddType(@interface, implementors.Single());
                    ConfigureFamily(registry.For(@interface));
                }
            });
        }
Пример #17
0
        /// <summary>
        /// Registers found Rebus handler types in the container
        /// </summary>
        public void ScanTypes(TypeSet types, global::StructureMap.Registry registry)
        {
            var messageHandlers = types.FindTypes(TypeClassification.Concretes)
                .Where(t => t.CanBeCastTo(typeof(IHandleMessages)));

            foreach (var handlerType in messageHandlers)
            {
                var handlerInterfaces = handlerType.GetInterfaces().Where(IsHandler).ToList();

                foreach (var handlerInterface in handlerInterfaces)
                {
                    registry
                        .For(handlerInterface)
                        .Use(handlerType)
                        .LifecycleIs<UniquePerRequestLifecycle>();
                }
            }
        }
Пример #18
0
        public override void ScanTypes(TypeSet types, Registry registry)
        {
            types.AllTypes().Each(type =>
            {
                IEnumerable<Type> interfaceTypes = type.FindInterfacesThatClose(_openType);
                if (!interfaceTypes.Any()) return;

                if (type.IsConcrete())
                {
                    _concretions.Add(type);
                }

                foreach (Type interfaceType in interfaceTypes)
                {
                    _interfaces.Fill(interfaceType);
                }
            });



            _interfaces.Each(@interface =>
            {
                var expression = registry.For(@interface);
                ConfigureFamily(expression);

                var exactMatches = _concretions.Where(x => x.CanBeCastTo(@interface)).ToArray();
                if (exactMatches.Length == 1)
                {
                    expression.Use(exactMatches.Single());
                }
                else
                {
                    exactMatches.Each(type => expression.Add(type));
                }


                if ([email protected]())
                {
                    addConcretionsThatCouldBeClosed(@interface, expression);
                }
            });

            _concretions.Each(type => registry.Configure(graph => graph.ConnectedConcretions.Fill(type)));
        }
Пример #19
0
        public void ScanTypes(TypeSet types, Registry registry)
        {

            // Only work on concrete types
            types.FindTypes(TypeClassification.Concretes | TypeClassification.Closed).ForEach(type =>
            {

                // Only work on concrete types
             //   if (!type.IsConcrete() || type.IsGenericType) return;

                // Add against all the interfaces implemented
                // by this concrete class
                type.GetInterfaces()
                    .Where(@interface => @interface.Name == $"I{type.Name}")
                    .ForEach(@interface => registry.For(@interface).Use(type).Singleton());

                if (type.Name.EndsWith("Job"))
                    registry.For(type).Singleton();
            });

        }
Пример #20
0
 public void ScanTypes(TypeSet types, Registry registry)
 {
     throw new NotImplementedException();
 }
Пример #21
0
		public void ScanTypes(TypeSet types, Registry registry)
	    {
		    types.AllTypes().ForEach(t => Process(t, registry));
	    }
 public void ScanTypes(TypeSet types, Registry registry)
 {
     types.FindTypes(TypeClassification.Concretes | TypeClassification.Closed).ToList()
         .ForEach(service => RegisterInterfaces(registry, service));
 }
Пример #23
0
 public void ScanTypes(TypeSet types, Registry registry)
 {
     types.AllTypes().Where(predicate).ToList()
          .ForEach(t => registry.ForSingletonOf(serviceSelector.Invoke(t)).Use(t));
 }
 public abstract void ScanTypes(TypeSet types, Registry registry);