public static IConveyBuilder AddConvey(this IServiceCollection services, string appOptionsSectionName = "app") { var builder = ConveyBuilder.Create(services); var options = builder.GetOptions <AppOptions>(appOptionsSectionName); services.AddSingleton(options); services.AddSingleton <IServiceId, ServiceId>(); if (options.DisplayBanner && !string.IsNullOrWhiteSpace(options.Name)) { Console.WriteLine(Figgle.FiggleFonts.Doom.Render(options.Name)); } return(builder); }
public static IConveyBuilder AddConvey(this IServiceCollection services, string sectionName = SectionName) { if (string.IsNullOrWhiteSpace(sectionName)) { sectionName = SectionName; } var builder = ConveyBuilder.Create(services); var options = builder.GetOptions <AppOptions>(sectionName); builder.Services.AddMemoryCache(); services.AddSingleton(options); services.AddSingleton <IServiceId, ServiceId>(); if (options.DisplayBanner && !string.IsNullOrWhiteSpace(options.Name)) { Console.WriteLine(Figgle.FiggleFonts.Doom.Render($"{options.Name} {options.Version}")); } return(builder); }