public bool TryAddScoped <TService>() where TService : class { var serviceName = $"{typeof(TService)}"; if (!Scoped.Contains(serviceName)) { Scoped.Add(serviceName); ServiceCollection.TryAddScoped <TService>(); return(true); } return(false); }
public bool TryAddScoped <TService, TImplementation>(TService tservice, TImplementation tImplementation) where TService : Type where TImplementation : Type { var serviceName = $"{tservice}{tImplementation}"; if (!Scoped.Contains(serviceName)) { Scoped.Add(serviceName); ServiceCollection.TryAddScoped(tservice, tImplementation); return(true); } return(false); }
public bool TryAddScoped <TService, TImplementation>() where TService : class where TImplementation : class, TService { var serviceName = $"{typeof(TService)}{typeof(TImplementation)}"; if (!Scoped.Contains(serviceName)) { Scoped.Add(serviceName); ServiceCollection.TryAddScoped <TService, TImplementation>(); return(true); } return(false); }