ServiceFilter 是利用ioc 容器获取实例
public IFilterMetadata CreateInstance(IServiceProvider serviceProvider) if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)) ; var filter = (IFilterMetadata)serviceProvider.GetRequiredService(ServiceType);if (filter is IFilterFactory filterFactory) filter = filterFactory.CreateInstance(serviceProvider) ; return filter;
}
typeFilter 是利用反射CreateInstance 创建对象实例 所以在标记特性的类型,serviceFileter 需要配置映射关系,而typeFilter 不需要的