本文整理汇总了C#中Registry类的典型用法代码示例。如果您正苦于以下问题:C# Registry类的具体用法?C# Registry怎么用?C# Registry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Registry类属于命名空间,在下文中一共展示了Registry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: Process
public void Process(Type type, Registry registry)
{
if (type.CanBeCastTo<Controller>() && !type.IsAbstract)
{
registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
}
}
示例3: Process
private void Process(Type type, Registry registry)
{
if (type.CanBeCastTo(typeof(Controller)) && !type.IsAbstract)
{
registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
}
}
示例4: SetupSingletons
private void SetupSingletons(Registry registry)
{
foreach (Type type in _singletons)
{
registry.For(type).Singleton();
}
}
示例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>();
}
示例6: Process
public void Process(Type type, Registry registry)
{
if(type.GetInterfaces().Contains(typeof(IQuery)) && !type.IsAbstract)
{
registry.For(typeof (IQuery)).Use(type);
}
}
示例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)));
}
示例8: Process
public void Process(Type type, Registry registry)
{
}
示例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);
}
}
示例10: PluginGraphBuilder
public PluginGraphBuilder(ConfigurationParser[] parsers, Registry[] registries, GraphLog log)
{
_parsers = parsers;
_registries = registries;
_graph = new PluginGraph();
_graph.Log = log;
}
示例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
}
}
示例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;
}
示例13: Application
public Application()
{
_peers = new List<Case42Peer>();
Registry = new Registry();
Registry.Set(new LobbyComponent(this));
}
示例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);
}
示例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);
}