Created
March 4, 2024 07:08
-
-
Save manoj-choudhari-git/56ad78438937a37d84f668769ff58f00 to your computer and use it in GitHub Desktop.
.NET 8 - Keyed Services Registration Demo
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
public static class DependencyRegistrationBootstrapper | |
{ | |
public static void RegisterDependencies(this IServiceCollection services) | |
{ | |
// Register three implementations | |
services.AddKeyedTransient<IReminderService, SmsReminderService>(ReminderType.Sms); | |
services.AddKeyedTransient<IReminderService, EmailReminderService>("Email"); | |
services.AddKeyedTransient<IReminderService, PushNotificationReminderService>(ReminderType.PushNotifications); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment