本文整理汇总了C#中IServiceFactory.GetInstance方法的典型用法代码示例。如果您正苦于以下问题:C# IServiceFactory.GetInstance方法的具体用法?C# IServiceFactory.GetInstance怎么用?C# IServiceFactory.GetInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServiceFactory
的用法示例。
在下文中一共展示了IServiceFactory.GetInstance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProcessors
private IEnumerable<IModuleProcessor> GetProcessors(IServiceFactory factory)
{
var processors = new IModuleProcessor[]
{
factory.GetInstance<CommandAttributeScanner>(),
factory.GetInstance<DelegateCommandClassInjectionProcessor>(),
factory.GetInstance<ModuleTypesProcessor>(),
factory.GetInstance<AttributeCleanerProcessor>(),
factory.GetInstance<ReferenceCleanerProcessor>()
};
return processors;
}
示例2: DefineProxyType
private void DefineProxyType(IServiceFactory servicefactory, ProxyDefinition proxyDefinition)
{
//container.Register<ILogFactory, LogFactory>();
//container.Register<ILogBase,log.Logger>();
proxyDefinition.Implement(() => servicefactory.GetInstance<IInterceptor>("LogInterceptor"));
}
示例3: Create
private static BarWithFooDependency Create(IServiceFactory factory)
{
return new BarWithFooDependency(factory.GetInstance<IFoo>());
}
示例4: CreateRecursive
private static FooWithRecursiveDependency CreateRecursive(IServiceFactory factory)
{
return new FooWithRecursiveDependency(factory.GetInstance<IFoo>());
}
示例5: CreateFooWithDependency
private IFoo CreateFooWithDependency(IServiceFactory factory)
{
return new FooWithDependency(factory.GetInstance<IBar>());
}
示例6: CreateFoo
private IFoo CreateFoo(IServiceFactory sf)
{
return sf.GetInstance<IFooFactory>().CreateFoo();
}
示例7: GetInstance
private static object GetInstance(IServiceFactory factory, ParameterInfo parameter)
{
var instance = factory.TryGetInstance(parameter.ParameterType);
if (instance == null)
{
instance = factory.GetInstance(parameter.ParameterType, parameter.Name);
}
return instance;
}
示例8: CreateMySqlConnection
private static MySqlConnection CreateMySqlConnection(IServiceFactory factory)
{
var connection = new MySqlConnection(factory.GetInstance<IConfiguration>().ConnectionString);
connection.Open();
return connection;
}