本文整理汇总了C#中Registry类的典型用法代码示例。如果您正苦于以下问题:C# Registry类的具体用法?C# Registry怎么用?C# Registry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Registry类属于命名空间,在下文中一共展示了Registry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Process
public void Process(Type type, Registry registry)
{
var validatorTypes = type.FindInterfacesThatClose(typeof(IValidator<>));
foreach(var validatorType in validatorTypes)
registry.AddType(validatorType, type);
}
开发者ID:trullock,项目名称:MuonKit,代码行数:7,代码来源:ValidatorRegistrationConvention.cs
示例2: Process
public void Process(Type type, Registry registry)
{
if (type.CanBeCastTo<Controller>() && !type.IsAbstract)
{
registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
}
}
开发者ID:rexdefuror,项目名称:shopapp,代码行数:7,代码来源:Controllers.cs
示例3: Process
private void Process(Type type, Registry registry)
{
if (type.CanBeCastTo(typeof(Controller)) && !type.IsAbstract)
{
registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
}
}
开发者ID:MattHoneycutt,项目名称:HeroicFramework,代码行数:7,代码来源:ControllerConvention.cs
示例4: SetupSingletons
private void SetupSingletons(Registry registry)
{
foreach (Type type in _singletons)
{
registry.For(type).Singleton();
}
}
开发者ID:group6tech,项目名称:noobot,代码行数:7,代码来源:ContainerFactory.cs
示例5: ConfigureModuleSpecificDependencies
private static void ConfigureModuleSpecificDependencies(Registry registry)
{
registry.For<IMasslogConfiguration>().Singleton().Use<LoggingConfiguration>();
registry.For<ILoggingConfiguration>().Singleton().Use<LoggingConfiguration>();
registry.For<IMonitorBehaviorFactory>().Singleton().Use<MonitorBehaviorFactory>();
registry.For<IMonitor>().HttpContextScoped().Use<Monitor>();
}
开发者ID:ByteCarrot,项目名称:Masslog,代码行数:7,代码来源:LoggingModuleIoC.cs
示例6: Process
public void Process(Type type, Registry registry)
{
if(type.GetInterfaces().Contains(typeof(IQuery)) && !type.IsAbstract)
{
registry.For(typeof (IQuery)).Use(type);
}
}
开发者ID:AbdoNile,项目名称:Foundation,代码行数:7,代码来源:QueryRegisterationConventrion.cs
示例7: ScanTypes
public void ScanTypes(TypeSet types, Registry registry)
{
types.FindTypes(TypeClassification.Closed | TypeClassification.Concretes)
.Where(Registry.IsPublicRegistry)
.Each(type => registry.Configure(x => x.ImportRegistry(type)));
}
开发者ID:slahn,项目名称:structuremap,代码行数:7,代码来源:FindRegistriesScanner.cs
示例8: Process
public void Process(Type type, Registry registry)
{
}
开发者ID:ItsJustSean,项目名称:TailBlazer,代码行数:7,代码来源:AppConventions.cs
示例9: Process
public void Process(Type type, Registry registry)
{
if (!type.IsAbstract && typeof(ICommandEvent).IsAssignableFrom(type))
{
registry.AddType(typeof(ICommand), typeof(EventCommand<>).MakeGenericType(type), type.Name);
}
}
开发者ID:ArildF,项目名称:PTB,代码行数:7,代码来源:CommandEventRegistrationConvention.cs
示例10: PluginGraphBuilder
public PluginGraphBuilder(ConfigurationParser[] parsers, Registry[] registries, GraphLog log)
{
_parsers = parsers;
_registries = registries;
_graph = new PluginGraph();
_graph.Log = log;
}
开发者ID:hp4711,项目名称:structuremap,代码行数:7,代码来源:PluginGraphBuilder.cs
示例11: Process
public void Process(Type type, Registry registry)
{
if (type.CanBeCastTo(typeof(Controller)) && !type.IsAbstract)
{
registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());// will create a new instance per request
}
}
开发者ID:hebert26,项目名称:MVC.Training,代码行数:7,代码来源:ControllerConvention.cs
示例12: Generate
public INoobotContainer Generate()
{
var registry = new Registry();
registry.Scan(x =>
{
x.TheCallingAssembly();
x.WithDefaultConventions();
});
registry = _pipelineManager.Initialise(registry);
registry = _pluginManager.Initialise(registry);
registry
.For<ISlackWrapper>()
.Singleton();
registry
.For<IPipelineFactory>()
.Singleton();
Type[] pluginTypes = _pluginManager.ListPluginTypes();
var container = new NoobotContainer(registry, pluginTypes);
IPipelineFactory pipelineFactory = container.GetInstance<IPipelineFactory>();
pipelineFactory.SetContainer(container);
return container;
}
开发者ID:irmbrady,项目名称:noobot,代码行数:29,代码来源:ContainerGenerator.cs
示例13: Application
public Application()
{
_peers = new List<Case42Peer>();
Registry = new Registry();
Registry.Set(new LobbyComponent(this));
}
开发者ID:brookerk,项目名称:case42rpg,代码行数:7,代码来源:Application.cs
示例14: Apply
public void Apply(PluginGraph graph)
{
var registry = new Registry();
_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(t => graph.ConnectedConcretions.Fill(t));
registry.As<IPluginGraphConfiguration>().Configure(graph);
}
开发者ID:goraw,项目名称:structuremap,代码行数:29,代码来源:GenericConnectionScanner.cs
示例15: RegisterCommand
public void RegisterCommand(Registry registry)
{
var openCommandMethodResultType = typeof(CommandResult<>);
var closedCommandMethodResultType = openCommandMethodResultType.MakeGenericType(CommandType);
var openActionMethodInvokerType = typeof(IActionMethodResultInvoker<>);
var closedActionMethodInvokerType =
openActionMethodInvokerType.MakeGenericType(closedCommandMethodResultType);
var closedDomainResultType = typeof(CommandResult);
var openCommandMethodResultInvokerType = typeof(ResultInvoker<,>);
var closedCommandMethodResultInvokerType =
openCommandMethodResultInvokerType.MakeGenericType(closedCommandMethodResultType, closedDomainResultType);
registry.For(closedActionMethodInvokerType).Use(closedCommandMethodResultInvokerType);
var openResultProcessor = typeof(IResultProcessor<,>);
var closedResultProcessor =
openResultProcessor.MakeGenericType(closedCommandMethodResultType, closedDomainResultType);
var openCommandMethodResultProcessorType = typeof(CommandResultProcessor<>);
var closedCommandMethodResultProcessorType =
openCommandMethodResultProcessorType.MakeGenericType(CommandType);
registry.For(closedResultProcessor).Use(closedCommandMethodResultProcessorType);
}
开发者ID:basicdays,项目名称:Guidelines,代码行数:27,代码来源:MvcCommandRegistrar.cs
示例16: FindRegistriesWithinPluginGraphSeal
public void FindRegistriesWithinPluginGraphSeal()
{
var builder = new PluginGraphBuilder();
var registry = new Registry();
registry.Scan(x =>
{
x.AssemblyContainingType(typeof(RedGreenRegistry));
x.LookForRegistries();
});
builder.AddConfiguration(registry);
var graph = builder.Build();
var colors = new List<string>();
PluginFamily family = graph.FindFamily(typeof (IWidget));
family.Instances.Each(instance => colors.Add(instance.Name));
Assert.Contains("Red", colors);
Assert.Contains("Green", colors);
Assert.Contains("Yellow", colors);
Assert.Contains("Blue", colors);
Assert.Contains("Brown", colors);
Assert.Contains("Black", colors);
}
开发者ID:satish860,项目名称:StructureMap3,代码行数:25,代码来源:RegistryIntegratedTester.cs
示例17: Application
public Application()
{
_peers = new List<RunePeer>();
Registry = new Registry();
Registry.Set(new LobbyComponent());
}
开发者ID:cilution,项目名称:RuneSlinger,代码行数:7,代码来源:Application.cs
示例18: Process
public void Process(Type type, Registry registry)
{
if (type.CanBeCastTo<ITeam>() && type != typeof(ITeam))
{
registry.For(typeof(ITeam)).Add(type);
}
}
开发者ID:goraw,项目名称:structuremap,代码行数:7,代码来源:MyRegistry.cs
示例19: Process
public void Process(Type type, Registry registry)
{
if (Registry.IsPublicRegistry(type))
{
registry.Configure(x => x.ImportRegistry(type));
}
}
开发者ID:hp4711,项目名称:structuremap,代码行数:7,代码来源:FindRegistriesScanner.cs
示例20: RegisterStandardInteractionHandlersForEntities
public static void RegisterStandardInteractionHandlersForEntities(Registry registry, StandardInteractionHandlerGenericTypeDefinitions standardInteractionHandlerGenericTypeDefinitions, params Assembly[] assembliesContainingEntities)
{
Argument.IsNotNull(registry, "registry");
Argument.IsNotNull(standardInteractionHandlerGenericTypeDefinitions, "standardInteractionHandlerGenericTypeDefinitions");
Argument.IsNotNull(assembliesContainingEntities, "assembliesContainingEntities");
Argument.IsValid(assembliesContainingEntities.Length > 0,
"The array of assemblies that contain entities is empty. The array must have at least one assembly specified.",
"assembliesContainingEntities");
var entityTypes = assembliesContainingEntities.SelectMany(assembly => assembly.GetTypes().Where(type => type != typeof(Entity) && typeof(Entity).IsAssignableFrom(type)));
foreach (var entityType in entityTypes) // E.g. User.
{
// E.g. IQueryHandler<GetByIdQuery<User>, Option<User>>.
ConnectInteractionHandlerToStandardInteractionForEntityType(registry, typeof(IQueryHandler<,>), typeof(GetByIdQuery<>), typeof(Option<>).MakeGenericType(entityType), standardInteractionHandlerGenericTypeDefinitions.GetByIdQueryHandler, entityType);
// E.g. IQueryHandler<GetOneQuery<User>, Option<User>>.
ConnectInteractionHandlerToStandardInteractionForEntityType(registry, typeof(IQueryHandler<,>), typeof(GetOneQuery<>), typeof(Option<>).MakeGenericType(entityType), standardInteractionHandlerGenericTypeDefinitions.GetOneQueryHandler, entityType);
// E.g. IQueryHandler<GetAllQuery<User>, IPagedEnumerable<User>>.
ConnectInteractionHandlerToStandardInteractionForEntityType(registry, typeof(IQueryHandler<,>), typeof(GetAllQuery<>), typeof(IPagedEnumerable<>).MakeGenericType(entityType), standardInteractionHandlerGenericTypeDefinitions.GetAllQueryHandler, entityType);
// E.g. IQueryHandler<GetTotalCountQuery<User>, int>.
ConnectInteractionHandlerToStandardInteractionForEntityType(registry, typeof(IQueryHandler<,>), typeof(GetTotalCountQuery<>), typeof(int), standardInteractionHandlerGenericTypeDefinitions.GetTotalCountQueryHandler, entityType);
// E.g. IRequestHandler<CanDeleteEntityRequest<User>, Response<Option<User>>>.
ConnectInteractionHandlerToStandardInteractionForEntityType(registry, typeof(IRequestHandler<,>), typeof(CanDeleteEntityRequest<>), typeof(Response<>).MakeGenericType(typeof(Option<>).MakeGenericType(entityType)), standardInteractionHandlerGenericTypeDefinitions.CanDeleteEntityRequestHandler, entityType);
// E.g. ICommandHandler<DeleteEntityCommand<User>, Response>.
ConnectInteractionHandlerToStandardInteractionForEntityType(registry, typeof(ICommandHandler<,>), typeof(DeleteEntityCommand<>), typeof(Response), standardInteractionHandlerGenericTypeDefinitions.DeleteEntityCommandHandler, entityType);
}
}
开发者ID:vipinyadav08,项目名称:Pragmatic,代码行数:29,代码来源:StandardInteractionHandlerRegistration.cs
注:本文中的Registry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论