diff --git a/GerstITS.Examples.Api/Controllers/1.0/ExampleController.cs b/GerstITS.Examples.Api/Controllers/1.0/ExampleController.cs index 48b87b3..a177e26 100644 --- a/GerstITS.Examples.Api/Controllers/1.0/ExampleController.cs +++ b/GerstITS.Examples.Api/Controllers/1.0/ExampleController.cs @@ -1,4 +1,5 @@ -using GerstITS.Examples.Api.Versioning; +using Asp.Versioning; +using GerstITS.Examples.Api.Versioning; using GerstITS.Examples.Logic.Example; using GerstITS.Validation; using GerstITS.Web.Api; diff --git a/GerstITS.Examples.Api/Controllers/1.1/ExampleController.cs b/GerstITS.Examples.Api/Controllers/1.1/ExampleController.cs index 9d75d89..5a7923d 100644 --- a/GerstITS.Examples.Api/Controllers/1.1/ExampleController.cs +++ b/GerstITS.Examples.Api/Controllers/1.1/ExampleController.cs @@ -1,4 +1,5 @@ -using GerstITS.Examples.Api.Versioning; +using Asp.Versioning; +using GerstITS.Examples.Api.Versioning; using GerstITS.Examples.Logic.Example; using GerstITS.Validation; using GerstITS.Web.Api; diff --git a/GerstITS.Examples.Api/GerstITS.Examples.Api.csproj b/GerstITS.Examples.Api/GerstITS.Examples.Api.csproj index b4c5398..3a47a48 100644 --- a/GerstITS.Examples.Api/GerstITS.Examples.Api.csproj +++ b/GerstITS.Examples.Api/GerstITS.Examples.Api.csproj @@ -14,7 +14,7 @@ - net8.0 + net9.0 latest @@ -37,32 +37,31 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - + diff --git a/GerstITS.Examples.Api/Program.cs b/GerstITS.Examples.Api/Program.cs index 58ce567..37f03db 100644 --- a/GerstITS.Examples.Api/Program.cs +++ b/GerstITS.Examples.Api/Program.cs @@ -1,22 +1,43 @@ -using GerstITS.Logging.Serilog; +using System.Diagnostics; +using GerstITS.Web.Api; using GerstITS.Web.Api.Hosting; +using GerstITS.Web.Api.Swagger; +using Microsoft.AspNetCore.Builder; +using Serilog; namespace GerstITS.Examples.Api; -public class Program : ProgramBase +public class Program { #region Methods public static void Main(string[] args) { - BootstrapLogContext.Execute(_ => Run(args)); + HostingStartup.Use(args) + .Host() + .UseSerilog((context, configuration) => { + configuration.ReadFrom.Configuration(context.Configuration); + + if (Common.ApplicationEnvironment.IsEfCoreActionStarted) + Debug.WriteLine("==========>>>>>>> Do NOT start Application!!!!"); + }) + .Services() + .Build() + .IfProduction(app => app.UsePreconfiguredHsts()) + .IfDevelopment(app => app.UseDeveloperExceptionPage() + .UsePreconfiguredSwagger()) + .UsePreconfiguredCors() + .UsePreconfiguredForwardedHeaders() + .UsePreconfiguredHttpsRedirection() + .UseAuthentication() + .UseAuthorization() + .UseRouting() + .UseEndpoints(endpoints => endpoints.MapControllers()) + .UseRewriteUnknownPathsToIndexSite(ApplicationEnvironment.WebApi.BaseUrl) + .UseSystemIndependentStaticFiles() + .UseSerilogRequestLogging() + .Run(); } - - protected override void ConfigureWebHost(IWebHostBuilder webHostBuilder) - { - webHostBuilder.UseLogging() - .UseStartup(); - } - + #endregion } \ No newline at end of file diff --git a/GerstITS.Examples.Api/Startup.cs b/GerstITS.Examples.Api/Startup.cs deleted file mode 100644 index cd6fff1..0000000 --- a/GerstITS.Examples.Api/Startup.cs +++ /dev/null @@ -1,33 +0,0 @@ -using GerstITS.Web.Api; -using GerstITS.Web.Api.Hosting; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Hosting; - -namespace GerstITS.Examples.Api; - -public class Startup : BootstrapperStartupBase -{ - #region Methods - - protected override void ConfigureApplication(IApplicationBuilder applicationBuilder, IWebHostEnvironment webHostEnvironment) - { - if (webHostEnvironment.IsProduction()) - applicationBuilder.UsePreconfiguredHsts(); - else - applicationBuilder.UseDeveloperExceptionPage() - .UseSwagger(); - - applicationBuilder.UsePreconfiguredCors() - .UsePreconfiguredForwardedHeaders() - .UsePreconfiguredHttpsRedirection() - .UseAuthentication() - .UseAuthorization() - .UseRouting() - .UseEndpoints(endpoints => endpoints.MapControllers()) - .UseRewriteUnknownPathsToIndexSite(ApplicationEnvironment.WebApi.BaseUrl) - .UseSystemIndependentStaticFiles(); - } - - #endregion -} \ No newline at end of file diff --git a/GerstITS.Examples.Api/appsettings.json b/GerstITS.Examples.Api/appsettings.json index b51db38..095e0ee 100644 --- a/GerstITS.Examples.Api/appsettings.json +++ b/GerstITS.Examples.Api/appsettings.json @@ -74,7 +74,6 @@ } }, "Serilog": { - "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.RollingFile" ], "MinimumLevel": { "Default": "Debug", "Override": { @@ -90,11 +89,9 @@ } }, { - "Name": "RollingFile", + "Name": "File", "Args": { - "pathFormat": "bin/Debug/net5.0/Logs/{Date}.log.json", - "formatter": "Serilog.Formatting.Compact.CompactJsonFormatter, Serilog", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] [{SourceContext}] [{EventId}] {Message}{NewLine}{Exception}", + "path": "../Logs/.log", "retainedFileCountLimit": 90, "rollingInterval": "Day", "shared": true diff --git a/GerstITS.Examples.Jobs.SayHelloWorld/GerstITS.Examples.Jobs.SayHelloWorld.csproj b/GerstITS.Examples.Jobs.SayHelloWorld/GerstITS.Examples.Jobs.SayHelloWorld.csproj index 03ae824..36b4db0 100644 --- a/GerstITS.Examples.Jobs.SayHelloWorld/GerstITS.Examples.Jobs.SayHelloWorld.csproj +++ b/GerstITS.Examples.Jobs.SayHelloWorld/GerstITS.Examples.Jobs.SayHelloWorld.csproj @@ -13,7 +13,7 @@ - net8.0 + net9.0 latest @@ -32,12 +32,12 @@ - - - - - - + + + + + + diff --git a/GerstITS.Examples.Logic/GerstITS.Examples.Logic.csproj b/GerstITS.Examples.Logic/GerstITS.Examples.Logic.csproj index 62a0e6b..d88c4e9 100644 --- a/GerstITS.Examples.Logic/GerstITS.Examples.Logic.csproj +++ b/GerstITS.Examples.Logic/GerstITS.Examples.Logic.csproj @@ -13,7 +13,7 @@ - net8.0 + net9.0 latest @@ -32,15 +32,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/GerstITS.Examples.WebClient.Console/GerstITS.Examples.WebClient.Console.csproj b/GerstITS.Examples.WebClient.Console/GerstITS.Examples.WebClient.Console.csproj index 9209360..604cd30 100644 --- a/GerstITS.Examples.WebClient.Console/GerstITS.Examples.WebClient.Console.csproj +++ b/GerstITS.Examples.WebClient.Console/GerstITS.Examples.WebClient.Console.csproj @@ -13,7 +13,7 @@ - net8.0 + net9.0 latest Exe @@ -43,15 +43,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/GerstITS.Examples.sln.DotSettings b/GerstITS.Examples.sln.DotSettings index d080d81..2816075 100644 --- a/GerstITS.Examples.sln.DotSettings +++ b/GerstITS.Examples.sln.DotSettings @@ -1,3 +1,5 @@  <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static readonly fields (private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="_" Suffix="" Style="aaBb" /></Policy> + True True \ No newline at end of file diff --git a/GerstITS.WebClients.Example.Api/GerstITS.Examples.WebClients.Examples.Api.csproj b/GerstITS.WebClients.Example.Api/GerstITS.Examples.WebClients.Examples.Api.csproj index 878639e..8c527b6 100644 --- a/GerstITS.WebClients.Example.Api/GerstITS.Examples.WebClients.Examples.Api.csproj +++ b/GerstITS.WebClients.Example.Api/GerstITS.Examples.WebClients.Examples.Api.csproj @@ -13,7 +13,7 @@ - net8.0 + net9.0 latest @@ -32,11 +32,11 @@ - - - - - + + + + +