• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IIocManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IIocManager的典型用法代码示例。如果您正苦于以下问题:C# IIocManager类的具体用法?C# IIocManager怎么用?C# IIocManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IIocManager类属于命名空间,在下文中一共展示了IIocManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Test_Way_3

 private static void Test_Way_3(IIocManager iocManager)
 {
     iocManager.Using<Tester>(tester =>
     {
         tester.Test();
     });
 }
开发者ID:ChEhrhard,项目名称:aspnetboilerplate-samples,代码行数:7,代码来源:Program.cs


示例2: Initialize

        public static void Initialize(IIocManager manager,List<Assembly> assemblys)
        {
            assemblys.ForEach(m =>
                {
                    ////多实例
                    //manager.IocContainer.Register(
                    //    Classes.FromAssembly(m)
                    //        .IncludeNonPublicTypes()
                    //        .BasedOn<IMultipleDependency>()
                    //        .WithService.Self()
                    //        .WithService.DefaultInterfaces()
                    //        .LifestyleTransient()
                    //    );

                    ////单例
                    //manager.IocContainer.Register(
                    //    Classes.FromAssembly(m)
                    //        .IncludeNonPublicTypes()
                    //        .BasedOn<ISingleDependency>()
                    //        .WithService.Self()
                    //        .WithService.DefaultInterfaces()
                    //        .LifestyleSingleton()
                    //    );

                    ////拦截器
                    //manager.IocContainer.Register(
                    //    Classes.FromAssembly(m)
                    //        .IncludeNonPublicTypes()
                    //        .BasedOn<IInterceptor>()
                    //        .WithService.Self()
                    //        .LifestyleTransient()
                    //    );
                    Registrants.ForEach(r => r(m));
                });
        }
开发者ID:dingsongjie,项目名称:LancheProject,代码行数:35,代码来源:BasicConventionalRegistrar.cs


示例3: AbpNHibernateInterceptor

        public AbpNHibernateInterceptor(IIocManager iocManager)
        {
            _iocManager = iocManager;

            _abpSession =
                new Lazy<IAbpSession>(
                    () => _iocManager.IsRegistered(typeof(IAbpSession))
                        ? _iocManager.Resolve<IAbpSession>()
                        : NullAbpSession.Instance,
                    isThreadSafe: true
                    );
            _guidGenerator =
                new Lazy<IGuidGenerator>(
                    () => _iocManager.IsRegistered(typeof(IGuidGenerator))
                        ? _iocManager.Resolve<IGuidGenerator>()
                        : SequentialGuidGenerator.Instance,
                    isThreadSafe: true
                    );

            _eventBus =
                new Lazy<IEventBus>(
                    () => _iocManager.IsRegistered(typeof(IEventBus))
                        ? _iocManager.Resolve<IEventBus>()
                        : NullEventBus.Instance,
                    isThreadSafe: true
                );
        }
开发者ID:vytautask,项目名称:aspnetboilerplate,代码行数:27,代码来源:AbpNHibernateInterceptor.cs


示例4: AbpModuleManager

 public AbpModuleManager(IIocManager iocManager, IModuleFinder moduleFinder)
 {
     _modules = new AbpModuleCollection();
     _iocManager = iocManager;
     _moduleFinder = moduleFinder;
     Logger = NullLogger.Instance;
 }
开发者ID:Zbun,项目名称:Gld.Activity.Project,代码行数:7,代码来源:AbpModuleManager.cs


示例5: DefaultModuleManager

 public DefaultModuleManager(IIocManager iocManager, IModuleFinder moduleFinder, IConfigurationManager configurationManager)
 {
     _modules = new ModuleCollection();
     _iocManager = iocManager;
     _moduleFinder = moduleFinder;
     _configurationManager = configurationManager;
 }
开发者ID:dingsongjie,项目名称:LancheProject,代码行数:7,代码来源:DefaultModuleManager.cs


示例6: PermissionManager

        /// <summary>
        /// Constructor.
        /// </summary>
        public PermissionManager(IIocManager iocManager, IAuthorizationConfiguration authorizationConfiguration)
        {
            _iocManager = iocManager;
            _authorizationConfiguration = authorizationConfiguration;

            AbpSession = NullAbpSession.Instance;
        }
开发者ID:RichieYang,项目名称:ABP,代码行数:10,代码来源:PermissionManager.cs


示例7: RegisterForDbContext

        public static void RegisterForDbContext(Type dbContextType, IIocManager iocManager)
        {
            foreach (var entityType in dbContextType.GetEntityTypes())
            {
                foreach (var interfaceType in entityType.GetInterfaces())
                {
                    if (interfaceType.IsGenericType && interfaceType.GetGenericTypeDefinition() == typeof(IEntity<>))
                    {
                        var primaryKeyType = interfaceType.GenericTypeArguments[0];
                        if (primaryKeyType == typeof(Guid))
                        {
                            var genericRepositoryType = typeof(IRepository<>).MakeGenericType(entityType);
                            if (!iocManager.IsRegistered(genericRepositoryType))
                            {
                                iocManager.Register(
                                    genericRepositoryType,
                                    typeof(EfRepositoryBase<,>).MakeGenericType(dbContextType, entityType),
                                    DependencyLifeStyle.Transient
                                    );
                            }
                        }

                        var genericRepositoryTypeWithPrimaryKey = typeof(IRepository<,>).MakeGenericType(entityType, primaryKeyType);
                        if (!iocManager.IsRegistered(genericRepositoryTypeWithPrimaryKey))
                        {
                            iocManager.Register(
                                genericRepositoryTypeWithPrimaryKey,
                                typeof(EfRepositoryBase<,,>).MakeGenericType(dbContextType, entityType, primaryKeyType),
                                DependencyLifeStyle.Transient
                                );
                        }
                    }
                }
            }
        }
开发者ID:lukaaaaaaaay,项目名称:aspnetboilerplate,代码行数:35,代码来源:EntityFrameworkGenericRepositoryRegistrar.cs


示例8: Test_Way_2

 private static void Test_Way_2(IIocManager iocManager)
 {
     using (var tester = iocManager.ResolveAsDisposable<Tester>())
     {
         tester.Object.Test();
     }
 }
开发者ID:ChEhrhard,项目名称:aspnetboilerplate-samples,代码行数:7,代码来源:Program.cs


示例9: LanguageManagementConfig

        public LanguageManagementConfig(IIocManager iocManager, IAbpStartupConfiguration configuration)
        {
            _iocManager = iocManager;
            _configuration = configuration;

            Logger = NullLogger.Instance;
        }
开发者ID:Zbun,项目名称:Gld.Activity.Project,代码行数:7,代码来源:LanguageManagementConfig.cs


示例10: RegisterForDbContext

        public static void RegisterForDbContext(Type dbContextType, IIocManager iocManager)
        {
            var autoRepositoryAttr = dbContextType.GetSingleAttributeOrNull<AutoRepositoryTypesAttribute>();
            if (autoRepositoryAttr == null)
            {
                autoRepositoryAttr = AutoRepositoryTypesAttribute.Default;
            }

            foreach (var entityType in dbContextType.GetEntityTypes())
            {

                var genericRepositoryType = autoRepositoryAttr.RepositoryInterface.MakeGenericType(entityType);
                if (!iocManager.IsRegistered(genericRepositoryType))
                {
                    var implType = autoRepositoryAttr.RepositoryImplementation.GetGenericArguments().Length == 1
                            ? autoRepositoryAttr.RepositoryImplementation.MakeGenericType(entityType)
                            : autoRepositoryAttr.RepositoryImplementation.MakeGenericType(dbContextType, entityType);

                    iocManager.Register(
                        genericRepositoryType,
                        implType,
                        DependencyLifeStyle.Multiple
                        );
                }

            }
        }
开发者ID:dingsongjie,项目名称:LancheProject,代码行数:27,代码来源:EntityFrameworkGenericRepositoryRegistrar.cs


示例11: AbpModuleManager

 public AbpModuleManager(IIocManager iocManager, IAbpPlugInManager abpPlugInManager)
 {
     _modules = new AbpModuleCollection();
     _iocManager = iocManager;
     _abpPlugInManager = abpPlugInManager;
     Logger = NullLogger.Instance;
 }
开发者ID:vytautask,项目名称:aspnetboilerplate,代码行数:7,代码来源:AbpModuleManager.cs


示例12: RegisterForDbContext

        public static void RegisterForDbContext(Type dbContextType, IIocManager iocManager)
        {
            var repositoryType = dbContextType.Assembly.GetTypes().Where(type => !string.IsNullOrEmpty(type.Namespace))
                .Where(type => type.BaseType != null && type.BaseType.IsGenericType && (type.BaseType.GetGenericTypeDefinition() == typeof(IRepository<>) || type.BaseType.GetGenericTypeDefinition() == typeof(IRepository<,>) || type.BaseType.GetGenericTypeDefinition() == typeof(EfRepositoryBase<,>) || type.BaseType.GetGenericTypeDefinition() == typeof(EfRepositoryBase<,,>)));

            foreach (var entityType in dbContextType.GetEntityTypes())//从dataset中获取所有的实体
            {
                foreach (var interfaceType in entityType.GetInterfaces())//获取所有实体实现的接口
                {
                    if (interfaceType.IsGenericType && interfaceType.GetGenericTypeDefinition() == typeof(IEntity<>))
                    {
                        var primaryKeyType = interfaceType.GenericTypeArguments[0];//获取所有的实体的主键

                        foreach (var maprepositoryType in repositoryType)
                        {
                            if (!iocManager.IsRegistered(maprepositoryType))
                            {
                                var implType = maprepositoryType.GetGenericArguments().Length == 2
                                            ? maprepositoryType.MakeGenericType(entityType, primaryKeyType)
                                            : maprepositoryType.MakeGenericType(dbContextType, entityType, primaryKeyType);
                                iocManager.Register(
                                maprepositoryType,
                                implType,
                                DependencyLifeStyle.Transient
                                );
                            }
                        }
                    }
                }

            }
        }
开发者ID:mlkj,项目名称:201509YL,代码行数:32,代码来源:EntityFrameworkGenericRepositoryRegistrar.cs


示例13: Test_Way_1

        private static void Test_Way_1(IIocManager iocManager)
        {
            var tester = iocManager.Resolve<Tester>();

            tester.Test();

            iocManager.Release(tester);
        }
开发者ID:ChEhrhard,项目名称:aspnetboilerplate-samples,代码行数:8,代码来源:Program.cs


示例14: UnitOfWorkManager

 public UnitOfWorkManager(
     IIocManager iocManager,
     IUnitOfWorkProvider currentUnitOfWorkProvider,
     IUnitOfWorkDefaultOptions defaultOptions)
 {
     _iocManager = iocManager;
     _currentUnitOfWorkProvider = currentUnitOfWorkProvider;
     _defaultOptions = defaultOptions;
 }
开发者ID:dingsongjie,项目名称:LancheProject,代码行数:9,代码来源:UnitOfWorkManager.cs


示例15: DynamicAuthorizationManager

 /// <summary>
 /// Constructor.
 /// </summary>
 public DynamicAuthorizationManager(
     IIocManager iocManager,
     IPermissionDefinitionContext permissionContext,
     IAuthorizationConfiguration authorizationConfiguration
     )
 {
     _iocManager = iocManager;
     _permissionContext = permissionContext;
     _authorizationConfiguration = authorizationConfiguration;
 }
开发者ID:a9512648,项目名称:JYcms,代码行数:13,代码来源:DynamicAuthorizationManager.cs


示例16: AbpNHibernateInterceptor

 public AbpNHibernateInterceptor(IIocManager iocManager)
 {
     _iocManager = iocManager;
     _abpSession =
         new Lazy<IAbpSession>(
             () => _iocManager.IsRegistered(typeof(IAbpSession))
                 ? _iocManager.Resolve<IAbpSession>()
                 : NullAbpSession.Instance
             );
 }
开发者ID:lukaaaaaaaay,项目名称:aspnetboilerplate,代码行数:10,代码来源:AbpNHibernateInterceptor.cs


示例17: PermissionManager

        /// <summary>
        /// Constructor.
        /// </summary>
        public PermissionManager(IIocManager iocManager, IAuthorizationConfiguration authorizationConfiguration)
        {
            PermissionGrantStore = NullPermissionGrantStore.Instance;
            Logger = NullLogger.Instance;

            _iocManager = iocManager;
            _authorizationConfiguration = authorizationConfiguration;

            _rootGroups = new Dictionary<string, PermissionGroup>();
            _permissions = new PermissionDictionary();
        }
开发者ID:lukaaaaaaaay,项目名称:aspnetboilerplate,代码行数:14,代码来源:PermissionManager.cs


示例18: Initialize

 public static void Initialize(IIocManager iocManager)
 {
     var auditingConfiguration = iocManager.Resolve<IAuditingConfiguration>();
     iocManager.IocContainer.Kernel.ComponentRegistered += (key, handler) =>
     {
         if (ShouldIntercept(auditingConfiguration, handler.ComponentModel.Implementation))
         {
             handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(AuditingInterceptor)));
         }
     };
 }
开发者ID:vytautask,项目名称:aspnetboilerplate,代码行数:11,代码来源:AuditingInterceptorRegistrar.cs


示例19: Initialize

        public static void Initialize(IIocManager iocManager)
        {
            _auditingConfiguration = iocManager.Resolve<IAuditingConfiguration>();

            if (!_auditingConfiguration.IsEnabled)
            {
                return;
            }

            iocManager.IocContainer.Kernel.ComponentRegistered += Kernel_ComponentRegistered;
        }
开发者ID:Zbun,项目名称:Gld.Activity.Project,代码行数:11,代码来源:AuditingInterceptorRegistrar.cs


示例20: RegisterForService

        public static void RegisterForService(IIocManager iocManager)
        {
            var typetoMap = Assembly.GetExecutingAssembly().GetTypes()
                .Where(type => !string.IsNullOrEmpty(type.Namespace))
                .Where(type => type.BaseType != null && type.BaseType.IsInterface && type.BaseType == typeof(IApplicationService));

            foreach (var mapType in typetoMap)
            {
                iocManager.Register(mapType, DependencyLifeStyle.Transient);
            }
        }
开发者ID:mlkj,项目名称:YL,代码行数:11,代码来源:ServiceRegistrar.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IIrcMessageSource类代码示例发布时间:2022-05-24
下一篇:
C# IInvoiceService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap