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


C# IIocManager类代码示例

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


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


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