Fix exapmples
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()}";
|
||||
|
||||
|
||||
@@ -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()}";
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -17,7 +17,7 @@ internal class ExampleStartupTask : IStartupTask
|
||||
#region Construtcors
|
||||
|
||||
public ExampleStartupTask(IExampleProvider provider,
|
||||
IJsonConvert jsonConvert)
|
||||
IJsonConvert jsonConvert)
|
||||
{
|
||||
_jsonConvert = jsonConvert;
|
||||
_provider = provider;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ExampleController : FluentApiControllerBase
|
||||
#region Constructors
|
||||
|
||||
public ExampleController(IExampleProvider provider,
|
||||
IValidator validator)
|
||||
IValidator validator)
|
||||
: base(validator)
|
||||
{
|
||||
_provider = provider;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
RegisterExceptionHandling(container);
|
||||
RegisterMvc(container);
|
||||
RegisterStartupTasks(container);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public class Program : ProgramBase<Program>
|
||||
protected override void ConfigureWebHost(IWebHostBuilder webHostBuilder)
|
||||
{
|
||||
webHostBuilder.UseLogging()
|
||||
.UseStartup<Startup>();
|
||||
.UseStartup<Startup>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public class Startup : BootstrapperStartupBase
|
||||
applicationBuilder.UsePreconfiguredHsts();
|
||||
else
|
||||
applicationBuilder.UseDeveloperExceptionPage()
|
||||
.UseSwagger();
|
||||
.UseSwagger();
|
||||
|
||||
applicationBuilder.UsePreconfiguredCors()
|
||||
.UsePreconfiguredForwardedHeaders()
|
||||
|
||||
Reference in New Issue
Block a user