/// <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);
        }
Beispiel #2
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();

            base.UsePack(provider);
        }