public static CoolServiceBusHostingService Host(this CoolServiceBusHostingService coolBusHostingService, IServiceCollection serviceCollection) { var adaptor = new MsServiceLocatorAdapter(serviceCollection); CommonServiceLocator.ServiceLocator.SetLocatorProvider(() => adaptor); return(coolBusHostingService); }
public CoolServiceBusHostingService Host(IServiceProvider serviceProvider) { var adapter = new MsServiceLocatorAdapter(serviceProvider); CommonServiceLocator.ServiceLocator.SetLocatorProvider(() => adapter); return(this); }
private void RegisterDependencies(IServiceCollection services) { services.AddSingleton <ILog, LogUsingSerilog>(); services.AddScoped <IRepository, Repository>(); services.AddScoped <IReadOnlyRepository, Repository>(); var contextBuilder = new DbContextOptionsBuilder(); contextBuilder.UseSqlServer(this.Configuration.GetSection("dbConnectionString").Value); services.AddSingleton(contextBuilder.Options); services.AddScoped <BaseContext, OnlineCourseContext>(); var adapter = new MsServiceLocatorAdapter(services); CommonServiceLocator.ServiceLocator.SetLocatorProvider(() => adapter); }