Esempio n. 1
0
 public static void AddScoped <TInterface, TService>([NotNull] this IKeyedServiceRegistrar registrar, object key)
     where TInterface : class
     where TService : class, TInterface
 {
     registrar.Services.AddScoped <TService>();
     registrar.Services.AddScoped <TInterface, TService>();
     registrar.Add <TInterface, TService>(key);
 }
Esempio n. 2
0
 public static void AddTransient <TInterface, TService>([NotNull] this IKeyedServiceRegistrar registrar, object key, Func <IServiceProvider, TService> implementationFactory)
     where TInterface : class
     where TService : class, TInterface
 {
     registrar.Services.AddTransient(implementationFactory);
     registrar.Services.AddTransient <TInterface, TService>(s => s.GetService <TService>());
     registrar.Add <TInterface, TService>(key);
 }
Esempio n. 3
0
 public static void Add <TInterface, TService>([NotNull] this IKeyedServiceRegistrar registrar, object key)
     where TService : class, TInterface
 {
     registrar.Add(typeof(TInterface), typeof(TService), key);
 }