我在多个程序集中包含FluentValidators。在FluentValidation的早期版本中,我可以这样注册:
services.AddMvc()
.AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining<ClassInAssemblyOne>())
.AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining<ClassInAssemblyTwo>());
Run Code Online (Sandbox Code Playgroud)
但是,这现在导致以下错误:
Exception thrown: 'System.InvalidOperationException' in System.Linq.dll
An exception of type 'System.InvalidOperationException' occurred in System.Linq.dll but was not handled in user code
Sequence contains more than one matching element
Run Code Online (Sandbox Code Playgroud)
不再允许了吗?如果没有,执行此操作的正确方法是什么?