Fix exapmples
This commit is contained in:
@@ -14,8 +14,8 @@ public static class IConfigurationExtensions
|
|||||||
ThrowsAnExceptionIfTypeIsNotAnEnumeration<TEnum>();
|
ThrowsAnExceptionIfTypeIsNotAnEnumeration<TEnum>();
|
||||||
|
|
||||||
return (TEnum)(object)(configuration.GetSection(key)?
|
return (TEnum)(object)(configuration.GetSection(key)?
|
||||||
.Get<TEnum[]>() ?? Enumerable.Empty<TEnum>())
|
.Get<TEnum[]>() ?? Enumerable.Empty<TEnum>())
|
||||||
.Sum(i => (int)(object)i);
|
.Sum(i => (int)(object)i);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ThrowsAnExceptionIfTypeIsNotAnEnumeration<TEnum>() where TEnum : struct, IConvertible
|
private static void ThrowsAnExceptionIfTypeIsNotAnEnumeration<TEnum>() where TEnum : struct, IConvertible
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ internal class OpenIdConfiguration : IOpenIdConfiguration
|
|||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public OpenIdConfiguration(string parentPrefix,
|
public OpenIdConfiguration(string parentPrefix,
|
||||||
Microsoft.Extensions.Configuration.IConfiguration configuration)
|
Microsoft.Extensions.Configuration.IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var prefix = $"{parentPrefix}:{this.ToConfigurationPrefix()}";
|
var prefix = $"{parentPrefix}:{this.ToConfigurationPrefix()}";
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ internal sealed class SwaggerConfiguration : ISwaggerConfiguration
|
|||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public SwaggerConfiguration(string parentPrefix,
|
public SwaggerConfiguration(string parentPrefix,
|
||||||
Microsoft.Extensions.Configuration.IConfiguration configuration)
|
Microsoft.Extensions.Configuration.IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var prefix = $"{parentPrefix}:{this.ToConfigurationPrefix()}";
|
var prefix = $"{parentPrefix}:{this.ToConfigurationPrefix()}";
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ internal sealed class WebApiConfiguration : IConfiguration
|
|||||||
var prefix = this.ToConfigurationPrefix();
|
var prefix = this.ToConfigurationPrefix();
|
||||||
|
|
||||||
EntityFrameworkMigration = new EntityFrameworkMigrationConfiguration(prefix, configuration);
|
EntityFrameworkMigration = new EntityFrameworkMigrationConfiguration(prefix, configuration);
|
||||||
OpenId = new OpenIdConfiguration(prefix, configuration);
|
//OpenId = new OpenIdConfiguration(prefix, configuration);
|
||||||
Server = new ServerConfiguration(prefix, configuration);
|
Server = new ServerConfiguration(prefix, configuration);
|
||||||
Swagger = new SwaggerConfiguration(prefix, configuration);
|
Swagger = new SwaggerConfiguration(prefix, configuration);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,13 +6,17 @@ namespace GerstITS.Examples.Api.ExceptionHandling;
|
|||||||
|
|
||||||
public class EntityNotFoundExceptionTransformation : ExceptionTransformationBase<EntityNotFoundException>
|
public class EntityNotFoundExceptionTransformation : ExceptionTransformationBase<EntityNotFoundException>
|
||||||
{
|
{
|
||||||
|
#region Methods
|
||||||
|
|
||||||
protected override ExceptionTransformationInfo CreateExceptionTransformationInfo(EntityNotFoundException exception, string ticketId)
|
protected override ExceptionTransformationInfo CreateExceptionTransformationInfo(EntityNotFoundException exception, string ticketId)
|
||||||
{
|
{
|
||||||
return new ExceptionTransformationInfo
|
return new ExceptionTransformationInfo
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCode.NotFound,
|
StatusCode = HttpStatusCode.NotFound,
|
||||||
ReasonPhrase = "Enitity nicht gefunden",
|
ReasonPhrase = "Enitity nicht gefunden",
|
||||||
Details = exception.Message
|
Details = exception.Message
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -11,11 +11,11 @@ internal sealed class ValidationExceptionTransformation : ExceptionTransformatio
|
|||||||
protected override ExceptionTransformationInfo CreateExceptionTransformationInfo(ValidationException exception, string ticketId)
|
protected override ExceptionTransformationInfo CreateExceptionTransformationInfo(ValidationException exception, string ticketId)
|
||||||
{
|
{
|
||||||
return new ExceptionTransformationInfo
|
return new ExceptionTransformationInfo
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCode.BadRequest,
|
StatusCode = HttpStatusCode.BadRequest,
|
||||||
ReasonPhrase = "Validierungsfehler",
|
ReasonPhrase = "Validierungsfehler",
|
||||||
Details = exception.Message
|
Details = exception.Message
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ internal class ExampleStartupTask : IStartupTask
|
|||||||
#region Construtcors
|
#region Construtcors
|
||||||
|
|
||||||
public ExampleStartupTask(IExampleProvider provider,
|
public ExampleStartupTask(IExampleProvider provider,
|
||||||
IJsonConvert jsonConvert)
|
IJsonConvert jsonConvert)
|
||||||
{
|
{
|
||||||
_jsonConvert = jsonConvert;
|
_jsonConvert = jsonConvert;
|
||||||
_provider = provider;
|
_provider = provider;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class ExampleController : FluentApiControllerBase
|
|||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public ExampleController(IExampleProvider provider,
|
public ExampleController(IExampleProvider provider,
|
||||||
IValidator validator)
|
IValidator validator)
|
||||||
: base(validator)
|
: base(validator)
|
||||||
{
|
{
|
||||||
_provider = provider;
|
_provider = provider;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class ExampleController : FluentApiControllerBase
|
|||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public ExampleController(IExampleProvider provider,
|
public ExampleController(IExampleProvider provider,
|
||||||
IValidator validator)
|
IValidator validator)
|
||||||
: base(validator)
|
: base(validator)
|
||||||
{
|
{
|
||||||
_provider = provider;
|
_provider = provider;
|
||||||
@@ -44,7 +44,7 @@ public class ExampleController : FluentApiControllerBase
|
|||||||
public IActionResult Get(int id)
|
public IActionResult Get(int id)
|
||||||
{
|
{
|
||||||
return Api().Use(id)
|
return Api().Use(id)
|
||||||
.Get(_provider.GetById_v1_1);
|
.Get(_provider.GetById_v1_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -37,10 +37,10 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<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.Common" Version="2023.8.4" />
|
||||||
<PackageReference Include="GerstITS.Data" 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" Version="2023.8.4" />
|
||||||
<PackageReference Include="GerstITS.IoC.DotNetCore" Version="2023.8.4" />
|
<PackageReference Include="GerstITS.IoC.DotNetCore" Version="2023.8.4" />
|
||||||
<PackageReference Include="GerstITS.Job" 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.Mapping.AutoMapper" Version="2023.8.4" />
|
||||||
<PackageReference Include="GerstITS.Search" Version="2023.8.4" />
|
<PackageReference Include="GerstITS.Search" Version="2023.8.4" />
|
||||||
<PackageReference Include="GerstITS.System" 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" 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.Api.Swagger" Version="2023.8.4" />
|
||||||
<PackageReference Include="GerstITS.Web.Rest" 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.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.10">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -74,4 +75,8 @@
|
|||||||
<ProjectCapability Include="ConfigurableFileNestingFeatureEnabled" />
|
<ProjectCapability Include="ConfigurableFileNestingFeatureEnabled" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="wwwroot\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,6 @@ public sealed partial class Module : IIoCModule<IServiceCollection>
|
|||||||
{
|
{
|
||||||
RegisterConfigurations(container);
|
RegisterConfigurations(container);
|
||||||
RegisterExceptionHandling(container);
|
RegisterExceptionHandling(container);
|
||||||
RegisterMvc(container);
|
|
||||||
RegisterStartupTasks(container);
|
RegisterStartupTasks(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class Program : ProgramBase<Program>
|
|||||||
protected override void ConfigureWebHost(IWebHostBuilder webHostBuilder)
|
protected override void ConfigureWebHost(IWebHostBuilder webHostBuilder)
|
||||||
{
|
{
|
||||||
webHostBuilder.UseLogging()
|
webHostBuilder.UseLogging()
|
||||||
.UseStartup<Startup>();
|
.UseStartup<Startup>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -14,6 +14,14 @@
|
|||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"GerstITS.Examples.Api": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": false,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"applicationUrl": "https://localhost:5001;http://localhost:5000"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ public class Startup : BootstrapperStartupBase
|
|||||||
applicationBuilder.UsePreconfiguredHsts();
|
applicationBuilder.UsePreconfiguredHsts();
|
||||||
else
|
else
|
||||||
applicationBuilder.UseDeveloperExceptionPage()
|
applicationBuilder.UseDeveloperExceptionPage()
|
||||||
.UseSwagger();
|
.UseSwagger();
|
||||||
|
|
||||||
applicationBuilder.UsePreconfiguredCors()
|
applicationBuilder.UsePreconfiguredCors()
|
||||||
.UsePreconfiguredForwardedHeaders()
|
.UsePreconfiguredForwardedHeaders()
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<PackageReference Include="GerstITS.IoC.DotNetCore" Version="2023.8.4" />
|
<PackageReference Include="GerstITS.IoC.DotNetCore" Version="2023.8.4" />
|
||||||
<PackageReference Include="GerstITS.Job" Version="2023.8.4" />
|
<PackageReference Include="GerstITS.Job" Version="2023.8.4" />
|
||||||
<PackageReference Include="GerstITS.Job.Scheduling" 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>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using GerstITS.Data;
|
|
||||||
using GerstITS.Examples.Jobs.SayHelloWorld.Configurations;
|
using GerstITS.Examples.Jobs.SayHelloWorld.Configurations;
|
||||||
using GerstITS.Job;
|
using GerstITS.Job;
|
||||||
using GerstITS.System.Environment;
|
using GerstITS.System.Environment;
|
||||||
|
|||||||
@@ -33,14 +33,14 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper" Version="12.0.1" />
|
<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.Data" Version="2023.8.4" />
|
||||||
<PackageReference Include="GerstITS.IoC" Version="2023.8.4" />
|
<PackageReference Include="GerstITS.IoC" Version="2023.8.4" />
|
||||||
<PackageReference Include="GerstITS.IoC.DotNetCore" 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.Mapping.AutoMapper" Version="2023.8.4" />
|
||||||
<PackageReference Include="GerstITS.Search" Version="2023.8.4" />
|
<PackageReference Include="GerstITS.Search" Version="2023.8.4" />
|
||||||
<PackageReference Include="GerstITS.Validation" Version="2023.8.4" />
|
<PackageReference Include="GerstITS.Validation" Version="2023.10.2" />
|
||||||
<PackageReference Include="GerstITS.Web.Api" Version="2023.8.4" />
|
<PackageReference Include="GerstITS.Web.Api" Version="2023.12.8" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user