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)); } }); }
public void ScanTypes(TypeSet types, Registry registry) { types.FindTypes(TypeClassification.Closed | TypeClassification.Concretes) .Where(Registry.IsPublicRegistry) .Each(type => registry.Configure(x => x.ImportRegistry(type))); }
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).ForEach(type => { if (type.Name.EndsWith("Job")) registry.For(type).Singleton(); }); }
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)); }); }
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); } }
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); } }); }
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()); } }
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)); } }); }
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)); } }); }
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(); }); }
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()); } } }
/// <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>(); } } }
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(); }); }
public void ScanTypes(TypeSet types, Registry registry) { types.FindTypes(TypeClassification.Concretes | TypeClassification.Closed).ToList() .ForEach(service => RegisterInterfaces(registry, service)); }