Exemplo n.º 1
0
        public override void PreConfigureServices(ServiceConfigurationContext context)
        {
            DynamicProxyIgnoreTypes.Add <ControllerBase>();
            DynamicProxyIgnoreTypes.Add <PageModel>();

            context.Services.AddConventionalRegistrar(new AbpAspNetCoreMvcConventionalRegistrar());
        }
Exemplo n.º 2
0
 private static bool ShouldIntercept(Type type)
 {
     // 拦截器的要求
     // 1、继承自IBasicRepository的仓储
     // 2、继承自INeedRule接口的实体
     return(!DynamicProxyIgnoreTypes.Contains(type) &&
            type.IsAssignableTo(typeof(IBasicRepository <>)) &&
            type.GetGenericTypeDefinition().IsAssignableTo(typeof(INeedRule)));
 }
Exemplo n.º 3
0
 public override void PreConfigureServices(ServiceConfigurationContext context)
 {
     context.Services.OnRegistred(onServiceRegistredContext =>
     {
         if (typeof(IMyAppService).IsAssignableFrom(onServiceRegistredContext.ImplementationType) &&
             !DynamicProxyIgnoreTypes.Contains(onServiceRegistredContext.ImplementationType))
         {
             onServiceRegistredContext.Interceptors.TryAdd <ValidationInterceptor>();
         }
     });
 }
        private static bool ShouldIntercept(Type type)
        {
            if (DynamicProxyIgnoreTypes.Contains(type))
            {
                return(false);
            }

            if (type.GetMethods().Any(m => m.IsDefined(typeof(LocalCacheAttribute), true)))
            {
                return(true);
            }

            return(false);
        }
        public override void PreConfigureServices(ServiceConfigurationContext context)
        {
            DynamicProxyIgnoreTypes.Add <ComponentBase>();

            context.Services.AddConventionalRegistrar(new AbpWebAssemblyConventionalRegistrar());

            PreConfigure <AbpHttpClientBuilderOptions>(options =>
            {
                options.ProxyClientBuildActions.Add((_, builder) =>
                {
                    builder.AddHttpMessageHandler <AbpBlazorClientHttpMessageHandler>();
                });
            });
        }
        /// <summary>
        /// Shoulds the intercept.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        private static bool ShouldIntercept(Type type)
        {
            if (DynamicProxyIgnoreTypes.Contains(type))
            {
                return(false);
            }
            // 首先判断类型上面是否使用了辅助类型。
            if (ShouldAuditTypeByDefault(type))
            {
                return(true);
            }
            //如果任意方法上面标注了 AuditedAttribute 特性,则仍然为该类型注入拦截器。
            if (type.GetMethods().Any(m => m.IsDefined(typeof(AuditedAttribute), true)))
            {
                return(true);
            }

            return(false);
        }
        private static bool ShouldIntercept(Type type)
        {
            if (DynamicProxyIgnoreTypes.Contains(type))
            {
                return(false);
            }

            if (ShouldAuditTypeByDefaultOrNull(type) == true)
            {
                return(true);
            }

            if (type.GetMethods().Any(m => m.IsDefined(typeof(AuditedAttribute), true)))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 8
0
 public override void PreConfigureServices(ServiceConfigurationContext context)
 {
     DynamicProxyIgnoreTypes.Add <ComponentBase>();
     context.Services.AddConventionalRegistrar(new AbpWebAssemblyConventionalRegistrar());
 }
Exemplo n.º 9
0
 private static bool ShouldIntercept(Type type)
 {
     return(!DynamicProxyIgnoreTypes.Contains(type) &&
            (type.IsDefined(typeof(RequiresLimitFeatureAttribute), true) ||
             AnyMethodHasRequiresLimitFeatureAttribute(type)));
 }
Exemplo n.º 10
0
 private static bool ShouldIntercept(Type type)
 {
     return(!DynamicProxyIgnoreTypes.Contains(type) && typeof(IValidationEnabled).IsAssignableFrom(type));
 }
Exemplo n.º 11
0
 public override void PreConfigureServices(ServiceConfigurationContext context)
 {
     DynamicProxyIgnoreTypes.Add <ControllerBase>();
 }
Exemplo n.º 12
0
 private static bool ShouldIntercept(Type type)
 {
     return(!DynamicProxyIgnoreTypes.Contains(type) && UnitOfWorkHelper.IsUnitOfWorkType(type.GetTypeInfo()));
 }
Exemplo n.º 13
0
 private static bool ShouldIntercept(Type type)
 {
     return(!DynamicProxyIgnoreTypes.Contains(type) && typeof(IGlobalFeatureCheckingEnabled).IsAssignableFrom(type));
 }