public AuthService(CentronWebService webService, UsersService usersService, string applicationGuid) { Guard.IsNotNull(webService, nameof(webService)); Guard.IsNotNull(usersService, nameof(usersService)); Guard.IsNotNullOrWhiteSpace(applicationGuid, nameof(applicationGuid)); this._centronWebService = webService; this._usersService = usersService; this._applicationGuid = applicationGuid; }
public static void AddHelpoServices(this IServiceCollection self, IConfiguration configuration) { Guard.IsNotNull(self, nameof(self)); Guard.IsNotNull(configuration, nameof(configuration)); self.AddRavenDB( configuration.GetValue <string>("RavenDB:Url"), configuration.GetValue <string>("RavenDB:DatabaseName")); self.AddScoped <IdFactory>(); self.AddScoped(serviceProvider => { var url = configuration.GetValue <string>("CentronWebService:Url"); var applicationGuid = configuration.GetValue <string>("CentronWebService:ApplicationGuid"); var webService = new CentronWebService(url); return(ActivatorUtilities.CreateInstance <AuthService>(serviceProvider, webService, applicationGuid)); }); self.AddScoped <UsersService>(); self.AddScoped <CurrentUserService>(); }