コード例 #1
0
ファイル: AbpBootstrapper.cs プロジェクト: llenroc/MyPassword
 private void AddInterceptorRegistrars()
 {
     ValidationInterceptorRegistrar.Initialize(IocManager);
     AuditingInterceptorRegistrar.Initialize(IocManager);
     UnitOfWorkRegistrar.Initialize(IocManager);
     AuthorizationInterceptorRegistrar.Initialize(IocManager);
 }
コード例 #2
0
        public override void PreInitialize()
        {
            IocManager.AddConventionalRegistrar(new BasicConventionalRegistrar());

            ValidationInterceptorRegistrar.Initialize(IocManager);
            FeatureInterceptorRegistrar.Initialize(IocManager);
            AuditingInterceptorRegistrar.Initialize(IocManager);
            UnitOfWorkRegistrar.Initialize(IocManager);
            AuthorizationInterceptorRegistrar.Initialize(IocManager);

            Configuration.Auditing.Selectors.Add(
                new NamedTypeSelector(
                    "Abp.ApplicationServices",
                    type => typeof(IApplicationService).IsAssignableFrom(type)
                    )
                );

            Configuration.Localization.Sources.Add(
                new DictionaryBasedLocalizationSource(
                    AbpConsts.LocalizationSourceName,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        Assembly.GetExecutingAssembly(), "Abp.Localization.Sources.AbpXmlSource"
                        )));

            Configuration.Settings.Providers.Add <LocalizationSettingProvider>();
            Configuration.Settings.Providers.Add <EmailSettingProvider>();
            Configuration.Settings.Providers.Add <NotificationSettingProvider>();
            Configuration.Settings.Providers.Add <TimingSettingProvider>();

            Configuration.UnitOfWork.RegisterFilter(AbpDataFilters.SoftDelete, true);
            Configuration.UnitOfWork.RegisterFilter(AbpDataFilters.MustHaveTenant, true);
            Configuration.UnitOfWork.RegisterFilter(AbpDataFilters.MayHaveTenant, true);

            ConfigureCaches();
        }
コード例 #3
0
        public override void PreInitialize()
        {
            IocManager.AddConventionalRegistrar(new BasicConventionalRegistrar());

            ValidationInterceptorRegistrar.Initialize(IocManager);

            //TODO: Consider to change order of Uow and Auth interceptors..?
            UnitOfWorkRegistrar.Initialize(IocManager);
            AuthorizationInterceptorRegistrar.Initialize(IocManager);

            _auditingInterceptorRegistrar = new AuditingInterceptorRegistrar(IocManager.Resolve <IAuditingConfiguration>(), IocManager);
            _auditingInterceptorRegistrar.Initialize();

            Configuration.Auditing.Selectors.Add(
                new NamedTypeSelector(
                    "Abp.ApplicationServices",
                    type => typeof(IApplicationService).IsAssignableFrom(type)
                    )
                );

            Configuration.Settings.Providers.Add <EmailSettingProvider>();

            Configuration.UnitOfWork.RegisterFilter(AbpDataFilters.SoftDelete, true);
            Configuration.UnitOfWork.RegisterFilter(AbpDataFilters.MustHaveTenant, true);
            Configuration.UnitOfWork.RegisterFilter(AbpDataFilters.MayHaveTenant, true);
        }
コード例 #4
0
 public virtual void Initialize()
 {
     IocManager.IocContainer.Install(new OwnCoreInstaller());
     //领域事件的注册必须在其他的注册之前,这样才能够扫描所有的注册的类,并找到实现的IEventHandler的事件进行注册
     IocManager.IocContainer.Install(new EventBusInstaller(IocManager));
     UnitOfWorkRegistrar.Initialize(IocManager);
     ValidationInterceptorRegistrar.Initialize(IocManager);
     if (ConventionalRegistrarConfig.RegistrarForInterface)
     {
         IocManager.AddConventionalRegistrar(new BasicConventionalRegistrar());
     }
     if (ConventionalRegistrarConfig.Assembly == null)
     {
         var assemblies = ConventionalRegistrarConfig.IsWebApp ? BuildManager.GetReferencedAssemblies().Cast <Assembly>() : AppDomain.CurrentDomain.GetAssemblies();
         assemblies = FilterSystemAssembly(assemblies);
         foreach (var assemblie in assemblies)
         {
             IocManager.RegisterAssemblyByConvention(assemblie);
         }
     }
     else
     {
         IocManager.RegisterAssemblyByConvention(ConventionalRegistrarConfig.Assembly);
     }
 }
コード例 #5
0
        private void AddInterceptorRegistrars(
            AbpBootstrapperInterceptorOptions options)
        {
            if (!options.DisableValidationInterceptor)
            {
                ValidationInterceptorRegistrar.Initialize(IocManager);
            }

            if (!options.DisableAuditingInterceptor)
            {
                AuditingInterceptorRegistrar.Initialize(IocManager);
            }

            if (!options.DisableEntityHistoryInterceptor)
            {
                EntityHistoryInterceptorRegistrar.Initialize(IocManager);
            }

            if (!options.DisableUnitOfWorkInterceptor)
            {
                UnitOfWorkRegistrar.Initialize(IocManager);
            }

            if (!options.DisableAuthorizationInterceptor)
            {
                AuthorizationInterceptorRegistrar.Initialize(IocManager);
            }
        }
コード例 #6
0
ファイル: AbpKernelModule.cs プロジェクト: nozerowu/ABP
        public override void PreInitialize <TTenantId, TUserId>()
        {
            IocManager.AddConventionalRegistrar(new BasicConventionalRegistrar());

            ValidationInterceptorRegistrar.Initialize(IocManager);

            //TODO: Consider to change order of Uow and Auth interceptors..?
            UnitOfWorkRegistrar.Initialize <TTenantId, TUserId>(IocManager);
            AuthorizationInterceptorRegistrar <TTenantId, TUserId> .Initialize(IocManager);

            _auditingInterceptorRegistrar = new AuditingInterceptorRegistrar(IocManager.Resolve <IAuditingConfiguration>(), IocManager);
            _auditingInterceptorRegistrar.Initialize <TTenantId, TUserId>();

            Configuration.Auditing.Selectors.Add(
                new NamedTypeSelector(
                    "Abp.ApplicationServices",
                    type => typeof(IApplicationService).IsAssignableFrom(type)
                    )
                );

            Configuration.Localization.Sources.Add(
                new DictionaryBasedLocalizationSource(
                    AbpConsts.LocalizationSourceName,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        Assembly.GetExecutingAssembly(), "Abp.Localization.Sources.AbpXmlSource"
                        )));

            Configuration.Settings.Providers.Add <EmailSettingProvider>();

            Configuration.UnitOfWork.RegisterFilter(AbpDataFilters.SoftDelete, true);
            Configuration.UnitOfWork.RegisterFilter(AbpDataFilters.MustHaveTenant, true);
            Configuration.UnitOfWork.RegisterFilter(AbpDataFilters.MayHaveTenant, true);
        }
コード例 #7
0
ファイル: AbpKernelModule.cs プロジェクト: 19900623/ABPStudy
        /// <summary>
        /// 这是应用启动调用的第一个事件,这里面的代码,会在依赖注入注册之前运行
        /// </summary>
        public override void PreInitialize()
        {
            //注册基本的约定注册器
            IocManager.AddConventionalRegistrar(new BasicConventionalRegistrar());

            //注册IScopedIocResolver
            IocManager.Register <IScopedIocResolver, ScopedIocResolver>(DependencyLifeStyle.Transient);

            //初始化验证拦截器
            ValidationInterceptorRegistrar.Initialize(IocManager);

            //初始化审计拦截器
            AuditingInterceptorRegistrar.Initialize(IocManager);

            //工作单元拦截器初始化
            UnitOfWorkRegistrar.Initialize(IocManager);

            //授权拦截器拦截器
            AuthorizationInterceptorRegistrar.Initialize(IocManager);

            //添加审计的选择器
            Configuration.Auditing.Selectors.Add(
                //应用服务(IApplicationService)需要记录审计日志
                new NamedTypeSelector(
                    "Abp.ApplicationServices",
                    type => typeof(IApplicationService).IsAssignableFrom(type)
                    )
                );

            Configuration.Localization.Sources.Add(
                new DictionaryBasedLocalizationSource(
                    AbpConsts.LocalizationSourceName,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        Assembly.GetExecutingAssembly(), "Abp.Localization.Sources.AbpXmlSource"
                        )));

            //添加本地化源
            Configuration.Settings.Providers.Add <LocalizationSettingProvider>();
            //添加邮件设置服务
            Configuration.Settings.Providers.Add <EmailSettingProvider>();
            Configuration.Settings.Providers.Add <NotificationSettingProvider>();
            Configuration.Settings.Providers.Add <TimingSettingProvider>();

            Configuration.UnitOfWork.RegisterFilter(AbpDataFilters.SoftDelete, true);
            Configuration.UnitOfWork.RegisterFilter(AbpDataFilters.MustHaveTenant, true);
            Configuration.UnitOfWork.RegisterFilter(AbpDataFilters.MayHaveTenant, true);

            ConfigureCaches();
            AddIgnoredTypes();
        }
コード例 #8
0
 public virtual void Initialize()
 {
     UnitOfWorkRegistrar.Initialize(IocManager);
     ValidationInterceptorRegistrar.Initialize(IocManager);
     if (ConventionalRegistrarConfig.RegistrarForInterface)
     {
         IocManager.AddConventionalRegistrar(new BasicConventionalRegistrar());
     }
     if (ConventionalRegistrarConfig.Assembly == null)
     {
         var assemblies = ConventionalRegistrarConfig.IsWebApp ? BuildManager.GetReferencedAssemblies().Cast <Assembly>() : AppDomain.CurrentDomain.GetAssemblies();
         assemblies = FilterSystemAssembly(assemblies);
         foreach (var assemblie in assemblies)
         {
             IocManager.RegisterAssemblyByConvention(assemblie);
         }
         return;
     }
     IocManager.RegisterAssemblyByConvention(ConventionalRegistrarConfig.Assembly);
 }
コード例 #9
0
 public void AddInterceptorRegistrars()
 {
     ValidationInterceptorRegistrar.Initialize(IocManager);
     UnitOfWorkRegistrar.Initialize(IocManager);
 }