public static IServiceCollection AddServicesDependencies(this IServiceCollection collection) { ProviderTypeStorage.Initialize(); var types = ProviderTypeStorage.GetAll(); foreach (var type in types) { collection.AddTransient(type); } collection.AddTransient <IProviderFactory, ProviderFactory>(); return(collection); }
public IProvider GetProvider(string url) { return(_serviceProvider.GetRequiredService(ProviderTypeStorage.GetByUrl(url)) as IProvider); }