当前位置: 首页>>代码示例>>C#>>正文


C# IServiceFactory.GetInstance方法代码示例

本文整理汇总了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;
 }
开发者ID:brainoffline,项目名称:Commander.Fody,代码行数:12,代码来源:ModuleWeaver.cs

示例2: DefineProxyType

        private void DefineProxyType(IServiceFactory servicefactory, ProxyDefinition proxyDefinition)
        {
            //container.Register<ILogFactory, LogFactory>();
            //container.Register<ILogBase,log.Logger>();

            proxyDefinition.Implement(() => servicefactory.GetInstance<IInterceptor>("LogInterceptor"));
        }
开发者ID:GNewsCo,项目名称:DrawPub,代码行数:7,代码来源:CompositionRoot.cs

示例3: Create

 private static BarWithFooDependency Create(IServiceFactory factory)
 {
     return new BarWithFooDependency(factory.GetInstance<IFoo>());
 }
开发者ID:vitamink,项目名称:LightInject,代码行数:4,代码来源:ConstructorInjectionTests.cs

示例4: CreateRecursive

 private static FooWithRecursiveDependency CreateRecursive(IServiceFactory factory)
 {
     return new FooWithRecursiveDependency(factory.GetInstance<IFoo>());
 }
开发者ID:vitamink,项目名称:LightInject,代码行数:4,代码来源:ConstructorInjectionTests.cs

示例5: CreateFooWithDependency

 private IFoo CreateFooWithDependency(IServiceFactory factory)
 {
     return new FooWithDependency(factory.GetInstance<IBar>());
 }
开发者ID:jarlef,项目名称:LightInject,代码行数:4,代码来源:DecoratorTests.cs

示例6: CreateFoo

 private IFoo CreateFoo(IServiceFactory sf)
 {
     return sf.GetInstance<IFooFactory>().CreateFoo();
 }
开发者ID:vitamink,项目名称:LightInject,代码行数:4,代码来源:WebApiTests.cs

示例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;
        }
开发者ID:vitamink,项目名称:LightInject,代码行数:10,代码来源:LightInject.Xunit.cs

示例8: CreateMySqlConnection

 private static MySqlConnection CreateMySqlConnection(IServiceFactory factory)
 {
     var connection = new MySqlConnection(factory.GetInstance<IConfiguration>().ConnectionString);
     connection.Open();
     return connection;
 }
开发者ID:Yazurka,项目名称:IconKeeper,代码行数:6,代码来源:CompositionRoot.cs


注:本文中的IServiceFactory.GetInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。