如何在不知道确切泛型的情况下使用AddTransient

时间:2020-06-02 17:25:04

标签: c# asp.net-core .net-core

我该如何重写下面的代码来调用services.AddTransient<IPipelineBehavior<?, ?>, ValidationBehaviour<?, ?>>

services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));

这可能真的很简单,但是我无法绕开它。我已经尝试过services.AddTransient<IPipelineBehavior<_, _>, ValidationBehaviour<_, _>>之类的东西,但是编译器没有。这有可能吗?

0 个答案:

没有答案