public static void ConfigureContacts(this IServiceCollection services, LBHTenancyAPI.Settings.ConfigurationSettings settings) { services.AddTransient <IDynamics365AuthenticationService>(s => new Dynamics365AuthenticationService(settings.Dynamics365Settings)); services.AddSingleton <IDynamics365ClientFactory>(s => new Dynamics365ClientFactory(settings.Dynamics365Settings, s.GetService <IDynamics365AuthenticationService>())); services.AddTransient <IContactsGateway, Dynamics365RestApiContactsGateway>(); services.AddTransient <IGetContactsForTenancyUseCase, GetContactsForTenancyUseCase>(); }
public static void ConfigureLogging(this IServiceCollection services, IConfiguration configuration, LBHTenancyAPI.Settings.ConfigurationSettings settings) { services.AddLogging(configure => { configure.AddConfiguration(configuration.GetSection("Logging")); configure.AddConsole(); configure.AddDebug(); //logs errors to sentry if configured if (!string.IsNullOrEmpty(settings.SentrySettings?.Url)) { configure.AddProvider(new SentryLoggerProvider(settings.SentrySettings?.Url, settings.SentrySettings?.Environment)); } }); }