Fix exapmples

This commit is contained in:
2023-12-18 12:10:34 +01:00
parent e390644d35
commit 3d034f3d4d
18 changed files with 51 additions and 56 deletions

View File

@@ -14,8 +14,8 @@ public static class IConfigurationExtensions
ThrowsAnExceptionIfTypeIsNotAnEnumeration<TEnum>();
return (TEnum)(object)(configuration.GetSection(key)?
.Get<TEnum[]>() ?? Enumerable.Empty<TEnum>())
.Sum(i => (int)(object)i);
.Get<TEnum[]>() ?? Enumerable.Empty<TEnum>())
.Sum(i => (int)(object)i);
}
private static void ThrowsAnExceptionIfTypeIsNotAnEnumeration<TEnum>() where TEnum : struct, IConvertible

View File

@@ -9,7 +9,7 @@ internal class OpenIdConfiguration : IOpenIdConfiguration
#region Constructors
public OpenIdConfiguration(string parentPrefix,
Microsoft.Extensions.Configuration.IConfiguration configuration)
Microsoft.Extensions.Configuration.IConfiguration configuration)
{
var prefix = $"{parentPrefix}:{this.ToConfigurationPrefix()}";

View File

@@ -11,7 +11,7 @@ internal sealed class SwaggerConfiguration : ISwaggerConfiguration
#region Constructors
public SwaggerConfiguration(string parentPrefix,
Microsoft.Extensions.Configuration.IConfiguration configuration)
Microsoft.Extensions.Configuration.IConfiguration configuration)
{
var prefix = $"{parentPrefix}:{this.ToConfigurationPrefix()}";

View File

@@ -24,7 +24,7 @@ internal sealed class WebApiConfiguration : IConfiguration
var prefix = this.ToConfigurationPrefix();
EntityFrameworkMigration = new EntityFrameworkMigrationConfiguration(prefix, configuration);
OpenId = new OpenIdConfiguration(prefix, configuration);
//OpenId = new OpenIdConfiguration(prefix, configuration);
Server = new ServerConfiguration(prefix, configuration);
Swagger = new SwaggerConfiguration(prefix, configuration);
}

View File

@@ -6,13 +6,17 @@ namespace GerstITS.Examples.Api.ExceptionHandling;
public class EntityNotFoundExceptionTransformation : ExceptionTransformationBase<EntityNotFoundException>
{
#region Methods
protected override ExceptionTransformationInfo CreateExceptionTransformationInfo(EntityNotFoundException exception, string ticketId)
{
return new ExceptionTransformationInfo
{
StatusCode = HttpStatusCode.NotFound,
ReasonPhrase = "Enitity nicht gefunden",
Details = exception.Message
};
{
StatusCode = HttpStatusCode.NotFound,
ReasonPhrase = "Enitity nicht gefunden",
Details = exception.Message
};
}
#endregion
}

View File

@@ -11,11 +11,11 @@ internal sealed class ValidationExceptionTransformation : ExceptionTransformatio
protected override ExceptionTransformationInfo CreateExceptionTransformationInfo(ValidationException exception, string ticketId)
{
return new ExceptionTransformationInfo
{
StatusCode = HttpStatusCode.BadRequest,
ReasonPhrase = "Validierungsfehler",
Details = exception.Message
};
{
StatusCode = HttpStatusCode.BadRequest,
ReasonPhrase = "Validierungsfehler",
Details = exception.Message
};
}
#endregion

View File

@@ -17,7 +17,7 @@ internal class ExampleStartupTask : IStartupTask
#region Construtcors
public ExampleStartupTask(IExampleProvider provider,
IJsonConvert jsonConvert)
IJsonConvert jsonConvert)
{
_jsonConvert = jsonConvert;
_provider = provider;

View File

@@ -24,7 +24,7 @@ public class ExampleController : FluentApiControllerBase
#region Constructors
public ExampleController(IExampleProvider provider,
IValidator validator)
IValidator validator)
: base(validator)
{
_provider = provider;

View File

@@ -24,7 +24,7 @@ public class ExampleController : FluentApiControllerBase
#region Constructors
public ExampleController(IExampleProvider provider,
IValidator validator)
IValidator validator)
: base(validator)
{
_provider = provider;
@@ -44,7 +44,7 @@ public class ExampleController : FluentApiControllerBase
public IActionResult Get(int id)
{
return Api().Use(id)
.Get(_provider.GetById_v1_1);
.Get(_provider.GetById_v1_1);
}
#endregion

View File

@@ -37,10 +37,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GerstITS.Authentication.OpenId" Version="2023.8.4" />
<PackageReference Include="GerstITS.Authentication.OpenId" Version="2023.12.9" />
<PackageReference Include="GerstITS.Common" Version="2023.8.4" />
<PackageReference Include="GerstITS.Data" Version="2023.8.4" />
<PackageReference Include="GerstITS.Data.EntityFramework" Version="2023.8.4" />
<PackageReference Include="GerstITS.Data.EntityFramework" Version="2023.10.2" />
<PackageReference Include="GerstITS.IoC" Version="2023.8.4" />
<PackageReference Include="GerstITS.IoC.DotNetCore" Version="2023.8.4" />
<PackageReference Include="GerstITS.Job" Version="2023.8.4" />
@@ -49,19 +49,20 @@
<PackageReference Include="GerstITS.Mapping.AutoMapper" Version="2023.8.4" />
<PackageReference Include="GerstITS.Search" Version="2023.8.4" />
<PackageReference Include="GerstITS.System" Version="2023.8.4" />
<PackageReference Include="GerstITS.Validation" Version="2023.8.4" />
<PackageReference Include="GerstITS.Validation" Version="2023.10.2" />
<PackageReference Include="GerstITS.Web" Version="2023.8.4" />
<PackageReference Include="GerstITS.Web.Api" Version="2023.8.4" />
<PackageReference Include="GerstITS.Web.Api" Version="2023.12.8" />
<PackageReference Include="GerstITS.Web.Api.Swagger" Version="2023.8.4" />
<PackageReference Include="GerstITS.Web.Rest" Version="2023.8.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.10">
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
</ItemGroup>
<ItemGroup>
@@ -74,4 +75,8 @@
<ProjectCapability Include="ConfigurableFileNestingFeatureEnabled" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
</Project>

View File

@@ -1,20 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
namespace GerstITS.Examples.Api;
public sealed partial class Module
{
#region Methods
private static void RegisterMvc(IServiceCollection container)
{
//container.AddTransient<IConfigureOptions<MvcOptions>, ApiMvcOptions>();
//container.AddTransient<IConfigureOptions<MvcNewtonsoftJsonOptions>, MvcJsonOptions>();
container.AddMvc()
.AddNewtonsoftJson();
}
#endregion
}

View File

@@ -11,7 +11,6 @@ public sealed partial class Module : IIoCModule<IServiceCollection>
{
RegisterConfigurations(container);
RegisterExceptionHandling(container);
RegisterMvc(container);
RegisterStartupTasks(container);
}

View File

@@ -15,7 +15,7 @@ public class Program : ProgramBase<Program>
protected override void ConfigureWebHost(IWebHostBuilder webHostBuilder)
{
webHostBuilder.UseLogging()
.UseStartup<Startup>();
.UseStartup<Startup>();
}
#endregion

View File

@@ -14,6 +14,14 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"GerstITS.Examples.Api": {
"commandName": "Project",
"launchBrowser": false,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}

View File

@@ -16,7 +16,7 @@ public class Startup : BootstrapperStartupBase
applicationBuilder.UsePreconfiguredHsts();
else
applicationBuilder.UseDeveloperExceptionPage()
.UseSwagger();
.UseSwagger();
applicationBuilder.UsePreconfiguredCors()
.UsePreconfiguredForwardedHeaders()

View File

@@ -37,7 +37,7 @@
<PackageReference Include="GerstITS.IoC.DotNetCore" Version="2023.8.4" />
<PackageReference Include="GerstITS.Job" Version="2023.8.4" />
<PackageReference Include="GerstITS.Job.Scheduling" Version="2023.8.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,6 +1,5 @@
using System.Diagnostics;
using System.Threading;
using GerstITS.Data;
using GerstITS.Examples.Jobs.SayHelloWorld.Configurations;
using GerstITS.Job;
using GerstITS.System.Environment;

View File

@@ -33,14 +33,14 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="FluentValidation" Version="11.7.1" />
<PackageReference Include="FluentValidation" Version="11.8.1" />
<PackageReference Include="GerstITS.Data" Version="2023.8.4" />
<PackageReference Include="GerstITS.IoC" Version="2023.8.4" />
<PackageReference Include="GerstITS.IoC.DotNetCore" Version="2023.8.4" />
<PackageReference Include="GerstITS.Mapping.AutoMapper" Version="2023.8.4" />
<PackageReference Include="GerstITS.Search" Version="2023.8.4" />
<PackageReference Include="GerstITS.Validation" Version="2023.8.4" />
<PackageReference Include="GerstITS.Web.Api" Version="2023.8.4" />
<PackageReference Include="GerstITS.Validation" Version="2023.10.2" />
<PackageReference Include="GerstITS.Web.Api" Version="2023.12.8" />
</ItemGroup>
<ItemGroup>