Last active
September 13, 2018 15:09
-
-
Save bayological/5edfb5d0ba6149a14fa77e520b2ffbc4 to your computer and use it in GitHub Desktop.
Extension method to get the specific registered type
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 IServiceCollection Named<TService, TImplementation>(this IServiceCollection services, string name) | |
{ | |
var implementationToBeNamed = services.FirstOrDefault(s => s.ImplementationType == typeof(TImplementation) && | |
s.ServiceType == typeof(TService)); | |
return services; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment