Exemplo n.º 1
0
        /// <summary>
        /// 应用模块服务
        /// </summary>
        /// <param name="provider">服务提供者</param>
        public override void UsePack(IServiceProvider provider)
        {
            IModuleHandler moduleHandler = provider.GetService <IModuleHandler>();

            moduleHandler.Initialize();

            //初始化各种缓存
            IFunctionHandler functionHandler = provider.GetService <IFunctionHandler>();

            functionHandler.RefreshCache();

            IEntityInfoHandler entityInfoHandler = provider.GetService <IEntityInfoHandler>();

            entityInfoHandler.RefreshCache();

            IFunctionAuthCache functionAuthCache = provider.GetService <IFunctionAuthCache>();

            functionAuthCache.BuildRoleCaches();

            IDataAuthCache dataAuthCache = provider.GetService <IDataAuthCache>();

            dataAuthCache.BuildCaches();

            IsEnabled = true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 应用模块服务
        /// </summary>
        /// <param name="provider">服务提供者</param>
        public override void UsePack(IServiceProvider provider)
        {
            IEntityInfoHandler entityInfoHandler = provider.GetService <IEntityInfoHandler>();

            entityInfoHandler.RefreshCache();

            IFunctionAuthCache functionAuthCache = provider.GetService <IFunctionAuthCache>();

            functionAuthCache.BuildRoleCaches();

            IDataAuthCache dataAuthCache = provider.GetService <IDataAuthCache>();

            dataAuthCache.BuildCaches();

            IsEnabled = true;
        }
        /// <summary>
        /// 应用功能权限授权
        /// </summary>
        public static IApplicationBuilder UseFunctionAuthorization(this IApplicationBuilder app)
        {
            app.UseAuthorization();

            IServiceProvider provider = app.ApplicationServices;

            IModuleHandler moduleHandler = provider.GetService <IModuleHandler>();

            moduleHandler.Initialize();

            IFunctionHandler functionHandler = provider.GetService <IFunctionHandler>();

            functionHandler.RefreshCache();

            IFunctionAuthCache functionAuthCache = provider.GetService <IFunctionAuthCache>();

            functionAuthCache.BuildRoleCaches();

            return(app);
        }