我们在开发中经常遇到对方的接口请求有频率限制,比如当前接口每秒的请求不能大于100,不能大于1000,对于这样的,我们作为请求方,如何做限定?
贴代码
var handlers = typeof(EventBaseModelHandler)
.Assembly
.GetTypes()
.Where(t => !t.IsAbstract && !t.IsGenericType && t.GetInterfaces()
.Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IEventHandler<>)));
if (handlers?.Any() == true)
{
foreach (var handler in handlers)
{
var interfaceType = handler.GetInterfaces()
.First(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IEventHandler<>));
context.Services.AddScoped(interfaceType, handler);
}
} 已经升级了,主要是left join的查询的时候没有过滤,其实这个问题,多租户也是一样的!