public static DefaultAppStatusService Create(IConfigurationRoot configuration) { var srv = new DefaultAppStatusService(); SetName(srv._status); SetHost(srv._status); SetVersion(srv._status); srv._status.StartAt = DateTime.Now; srv._status.StartAt = DateTime.Now; return(srv); }
/// <summary> /// Integrates <see cref="IAppStatusService"/> singleton service for API /// </summary> public static IServiceCollection AddAppStatusProviding(this IServiceCollection services, IConfigurationRoot configuration = null) { if (services == null) { throw new ArgumentNullException(nameof(services)); } var logHolder = new StatusProviderLogHolder(); return(services .AddSingleton <IAppStatusService>(DefaultAppStatusService.Create(configuration)) .AddLogging(logBuilder => logBuilder.AddProvider(new StatusProviderLoggerProvider(logHolder))) .AddSingleton(logHolder)); }