在网上找了许多例子但是放在.net8就不好使了比如在Program中配置IInterceptor或者 services.ConfigureDynamicProxy,网上说的对但是也不全对 //通过单元测试(MSTest) //创建IServiceCollection IServiceCollectionservices=newServiceCollection(); 是能调用AbstractInterceptorAttribute,但是用WebAPI就失效,断点都不进 尝试了网上大神的方法,发现通过配置失败 //ConfigureDynamicProxy(失败) buil...
场景:在不动业务逻辑的情况下,实现读写缓存 这里使用的AOP的方式在方法上加注解,这目前有个弊端不能传数组,涉及到排序问题 ///<summary> ///JsonRedis缓存 ///</summary> publicclassRedisInterceptorAttribute:AbstractInterceptorAttribute { readonlystring_cacheKey; bool_isDb=false;//是否走缓存 int_expireSeconds=-1; publicRedisInterceptorAttribute(st...