From 09da3dd50a59f98fce2a0da7e701d1df984ead7d Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 23 Oct 2019 21:51:57 +0000 Subject: [PATCH] --- devdocs/todo.txt | 2 ++ server/AyaNova/Startup.cs | 30 ++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/devdocs/todo.txt b/devdocs/todo.txt index 307041bb..dc392c6a 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -10,6 +10,8 @@ UPDATE all the things before commencing work - API explorer should fill in v8 automatically to save typing + - doesn't appear to be a changed setting, probably changed how it works. + - Look into issues with project and how to specify - Add automated test to retrieve a manual page to ensure it's working - Add automated test to retrieve metrics to know it's working - Add automated test to retrieve apiroot page to know it's working diff --git a/server/AyaNova/Startup.cs b/server/AyaNova/Startup.cs index 779ea95c..1fcf023b 100644 --- a/server/AyaNova/Startup.cs +++ b/server/AyaNova/Startup.cs @@ -34,20 +34,20 @@ namespace AyaNova { ///////////////////////////////////////////////////////////// // - public Startup( Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment) + public Startup(Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment) {//ILogger logger, ILoggerFactory logFactory, - // Get the factory for ILogger instances. - var nlogLoggerProvider = new NLogLoggerProvider(); + // Get the factory for ILogger instances. + var nlogLoggerProvider = new NLogLoggerProvider(); - // Create an ILogger. - _newLog = nlogLoggerProvider.CreateLogger(typeof(Startup).FullName); + // Create an ILogger. + _newLog = nlogLoggerProvider.CreateLogger(typeof(Startup).FullName); //x_log = logger; _hostingEnvironment = hostingEnvironment; //AyaNova.Util.ApplicationLogging.LoggerFactory = logFactory; //AyaNova.Util.ApplicationLogging.theLogger = _newLog; - AyaNova.Util.ApplicationLogging.LoggerProvider=nlogLoggerProvider; + AyaNova.Util.ApplicationLogging.LoggerProvider = nlogLoggerProvider; //this must be set here ServerBootConfig.AYANOVA_CONTENT_ROOT_PATH = hostingEnvironment.ContentRootPath; @@ -56,7 +56,7 @@ namespace AyaNova private readonly ILogger _newLog; - // private readonly ILoggerx_log; + // private readonly ILoggerx_log; private string _connectionString = ""; private readonly Microsoft.AspNetCore.Hosting.IWebHostEnvironment _hostingEnvironment; @@ -77,7 +77,7 @@ namespace AyaNova _newLog.LogDebug("BOOT: init controllers"); var MvcBuilder = services.AddControllers(config => { - // config.Filters.Add(new AyaNova.Api.ControllerHelpers.ApiCustomExceptionFilter(AyaNova.Util.ApplicationLogging.LoggerFactory)); + // config.Filters.Add(new AyaNova.Api.ControllerHelpers.ApiCustomExceptionFilter(AyaNova.Util.ApplicationLogging.LoggerFactory)); config.Filters.Add(new AyaNova.Api.ControllerHelpers.ApiCustomExceptionFilter(_newLog)); }); @@ -181,7 +181,17 @@ namespace AyaNova options.DefaultApiVersion = Microsoft.AspNetCore.Mvc.ApiVersion.Parse("8.0"); options.ReportApiVersions = true; }); - services.AddVersionedApiExplorer(options => options.GroupNameFormat = "'v'VVV"); + services.AddVersionedApiExplorer(options => + { + + // add the versioned api explorer, which also adds IApiVersionDescriptionProvider service + // note: the specified format code will format the version as "'v'major[.minor][-status]" + options.GroupNameFormat = "'v'VVV"; + + // note: this option is only necessary when versioning by url segment. the SubstitutionFormat + // can also be used to control the format of the API version in route templates + options.SubstituteApiVersionInUrl = true; + }); services.AddTransient, ConfigureSwaggerOptions>(); services.AddSwaggerGen( c => @@ -396,7 +406,7 @@ namespace AyaNova // ******************** TESTING WIPE DB ***************************** // //Set this to true to wipe the db and reinstall a trial license and re-seed the data - var TESTING_REFRESH_DB = true;//####################################################################################### + var TESTING_REFRESH_DB = false;//####################################################################################### #if (DEBUG) //TESTING