Created
June 1, 2020 19:29
-
-
Save timdows/e54455063552f9dc95fe2300708e685d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add all the assemblies to MediatR | |
services.AddMediatR(typeof(DABBaseRequest).GetTypeInfo().Assembly); | |
// For all the validators, register them with dependency injection as scoped | |
AssemblyScanner.FindValidatorsInAssembly(typeof(DABBaseRequest).Assembly) | |
.ForEach(item => services.AddScoped(item.InterfaceType, item.ValidatorType)); | |
// Add the custome pipeline validation to DI | |
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(MyCustomPipelineValidationBehavior<,>)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment