Last active
September 17, 2022 00:25
-
-
Save benjaminvanrenterghem/d7911a616a68ccb993a7eed288d247a7 to your computer and use it in GitHub Desktop.
ServiceCollectionExtensions snippet 1
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
// [i] Bestand terug te vinden onder project: Logic.Extensions.ServiceCollectionExtensions.AddMediation | |
public static void AddMediation(this IServiceCollection services) { | |
// #1 Mediatr registreren | |
services.AddMediatR(Assembly.GetExecutingAssembly()); | |
// #2 We wensen als eerste PipelineBehavior de logging | |
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingBehavior<,>)); | |
services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly(), ServiceLifetime.Scoped); | |
// #3 We wensen na de logging pas de data te valideren | |
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment