Initial commit

This commit is contained in:
2021-06-15 10:59:47 +02:00
commit 8e156ba356
65 changed files with 1786 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
using System.Net;
using GerstITS.Data;
using GerstITS.Web.Api.ExceptionHandling;
namespace GerstITS.Examples.Api.ExceptionHandling
{
public class EntityNotFoundExceptionTransformation : ExceptionTransformationBase<EntityNotFoundException>
{
protected override ExceptionTransformationInfo CreateExceptionTransformationInfo(EntityNotFoundException exception, string ticketId)
{
return new ExceptionTransformationInfo
{
StatusCode = HttpStatusCode.NotFound,
ReasonPhrase = "Enitity nicht gefunden",
Details = exception.Message
};
}
}
}

View File

@@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations;
using System.Net;
using GerstITS.Web.Api.ExceptionHandling;
namespace GerstITS.Examples.Api.ExceptionHandling
{
internal sealed class ValidationExceptionTransformation : ExceptionTransformationBase<ValidationException>
{
#region Methods
protected override ExceptionTransformationInfo CreateExceptionTransformationInfo(ValidationException exception, string ticketId)
{
return new ExceptionTransformationInfo
{
StatusCode = HttpStatusCode.BadRequest,
ReasonPhrase = "Validierungsfehler",
Details = exception.Message
};
}
#endregion
}
}

View File

@@ -0,0 +1,39 @@
using System.Diagnostics;
using GerstITS.Examples.Logic.Example;
using GerstITS.IoC;
using GerstITS.System.Json;
namespace GerstITS.Examples.Api.StartupTasks
{
internal class ExampleStartupTask : IStartupTask
{
#region Fields#
private readonly IExampleProvider _provider;
private readonly IJsonConvert _jsonConvert;
#endregion
#region Construtcors
public ExampleStartupTask(IExampleProvider provider,
IJsonConvert jsonConvert)
{
_jsonConvert = jsonConvert;
_provider = provider;
}
#endregion
#region IStartupTask
public StartupPriorities Priority => StartupPriorities.Normal;
public void Execute()
{
Debug.WriteLine($"---> {nameof(ExampleStartupTask)}: {_jsonConvert.Serialize(_provider.GetById(123))}");
}
#endregion
}
}

View File

@@ -0,0 +1,15 @@
using System;
using GerstITS.Web.Api.Swagger;
namespace GerstITS.Examples.Api.Swagger
{
internal class LicenseConfiguration : ILicense
{
#region Properties
public string Name { get; set; }
public Uri Url { get; set; }
#endregion
}
}

View File

@@ -0,0 +1,19 @@
using GerstITS.Web.Api.Swagger;
using Microsoft.OpenApi.Models;
namespace GerstITS.Examples.Api.Swagger
{
internal sealed class SwaggerSecurityConfiguration : IOpenApiSecuritySchemeConfiguration
{
#region Properties
public bool AllowAnonymous { get; set; }
public string HttpHeaderKey { get; set; }
public string Scheme { get; set; }
public SecuritySchemeType SchemeType { get; set; }
public ParameterLocation ParameterLocation { get; set; }
public string Description { get; set; }
#endregion
}
}

View File

@@ -0,0 +1,49 @@
using System;
using System.Diagnostics;
using GerstITS.System.Configurations;
using GerstITS.Web.Api.Swagger;
namespace GerstITS.Examples.Api.Swagger
{
internal class WebApiConfiguration : ISwaggerConfiguration, IConfiguration
{
#region Constructors
public WebApiConfiguration()
{
var currentAssembly = typeof(WebApiConfiguration).Assembly;
var fileVersionInfo = FileVersionInfo.GetVersionInfo(currentAssembly.Location);
Company = fileVersionInfo.CompanyName;
Name = fileVersionInfo.ProductName;
Release = currentAssembly.GetName().Version;
TermsOfService = new Uri("https://en.wikipedia.org/wiki/Terms_of_service");
License = new LicenseConfiguration
{
Name = "MIT",
Url = new Uri("https://opensource.org/licenses/MIT")
};
SupportEMail = "info@examples.net";
Security = new SwaggerSecurityConfiguration
{
AllowAnonymous = true
};
}
#endregion
#region ISwaggerConfiguration
public string Name { get; }
public string Company { get; }
public string SupportEMail { get; }
public Uri TermsOfService { get; }
public ILicense License { get; }
public Version Release { get; }
public IOpenApiSecuritySchemeConfiguration Security { get; }
#endregion
}
}

View File

@@ -0,0 +1,12 @@
namespace GerstITS.Examples.Api.Versioning
{
public static class Versions
{
#region Versions
public const string _1_0 = "1.0";
public const string _1_1 = "1.1";
#endregion
}
}

View File

@@ -0,0 +1,52 @@
using GerstITS.Examples.Api.Versioning;
using GerstITS.Examples.Logic.Example;
using GerstITS.Validation;
using GerstITS.Web.Api;
using GerstITS.Web.Api.FluentApi;
using Microsoft.AspNetCore.Mvc;
namespace GerstITS.Examples.Api.Controllers
{
/// <summary>
/// Controller is deprecated use newer version.
/// </summary>
[ApiController,
ApiVersion(Versions._1_0, Deprecated = true),
Route(ApplicationEnvironment.WebApi.ControllerRouteTemplate)]
public class ExampleController : FluentApiControllerBase
{
#region Fields
private readonly IExampleProvider _provider;
#endregion
#region Constructors
public ExampleController(IExampleProvider provider,
IValidator validator)
: base(validator)
{
_provider = provider;
}
#endregion
#region Methods
/// <summary>
/// Gets the example data by id.
/// </summary>
/// <param name="id"></param>
/// <returns>Returns Example data.</returns>
[HttpGet,
Route("{id}")]
public IActionResult Get(int id)
{
return Api().Use(id)
.Get(_provider.GetById);
}
#endregion
}
}

View File

@@ -0,0 +1,52 @@
using GerstITS.Examples.Api.Versioning;
using GerstITS.Examples.Logic.Example;
using GerstITS.Validation;
using GerstITS.Web.Api;
using GerstITS.Web.Api.FluentApi;
using Microsoft.AspNetCore.Mvc;
namespace GerstITS.Examples.Api.Controllers._1._1
{
/// <summary>
/// Is responsible to get employee organization assignment examples.
/// </summary>
[ApiController,
ApiVersion(Versions._1_1),
Route(ApplicationEnvironment.WebApi.ControllerRouteTemplate)]
public class ExampleController : FluentApiControllerBase
{
#region Fields
private readonly IExampleProvider _provider;
#endregion
#region Constructors
public ExampleController(IExampleProvider provider,
IValidator validator)
: base(validator)
{
_provider = provider;
}
#endregion
#region Methods
/// <summary>
/// Gets a employee organization assignment by specified id.
/// </summary>
/// <param name="id">Id of the employee organization assignment.</param>
/// <returns>Returns an employee organization assignment</returns>
[HttpGet,
Route("{id}")]
public IActionResult Get(int id)
{
return Api().Use(id)
.Get(_provider.GetById_v1_1);
}
#endregion
}
}

View File

@@ -0,0 +1,65 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<Company>ITSCare GbR</Company>
<Authors>ITSCare GbR</Authors>
<Copyright>Copyright © ITSCare GbR 2021</Copyright>
<Product>ITSCare Example WebApi</Product>
<Version>0.0.0.0</Version>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyInformationalVersion>0.0.0.0</AssemblyInformationalVersion>
<FileVersion>0.0.0.0</FileVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<WarningsAsErrors />
<NoWarn>1591</NoWarn>
<DocumentationFile>bin\Debug\net5.0\ITSCare.Example.Api.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<WarningsAsErrors />
<NoWarn>1591</NoWarn>
<DocumentationFile>bin\Release\net5.0\ITSCare.Example.Api.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ITSCare.Common\ITSCare.Common.csproj" />
<ProjectReference Include="..\..\ITSCare.Data.EntityFramework\ITSCare.Data.EntityFramework.csproj" />
<ProjectReference Include="..\..\ITSCare.Data\ITSCare.Data.csproj" />
<ProjectReference Include="..\..\ITSCare.IoC.DotNetCore\ITSCare.IoC.DotNetCore.csproj" />
<ProjectReference Include="..\..\ITSCare.IoC\ITSCare.IoC.csproj" />
<ProjectReference Include="..\..\ITSCare.Job.Scheduling\ITSCare.Job.Scheduling.csproj" />
<ProjectReference Include="..\..\ITSCare.Job\ITSCare.Job.csproj" />
<ProjectReference Include="..\..\ITSCare.Web.Api.Authentication.SkyNet\ITSCare.Web.Api.Authentication.SkyNet.csproj" />
<ProjectReference Include="..\..\ITSCare.Web.Api.Cors.DotNetCore\ITSCare.Web.Api.Cors.DotNetCore.csproj" />
<ProjectReference Include="..\..\ITSCare.Web.Api.DotNetCore\ITSCare.Web.Api.DotNetCore.csproj" />
<ProjectReference Include="..\..\ITSCare.Web.Api.Swagger\ITSCare.Web.Api.Swagger.csproj" />
<ProjectReference Include="..\..\ITSCare.Web.Api\ITSCare.Web.Api.csproj" />
<ProjectReference Include="..\ITSCare.Example.Jobs.SayHelloWorld\ITSCare.Example.Jobs.SayHelloWorld.csproj" />
<ProjectReference Include="..\ITSCare.Example.Logic\ITSCare.Example.Logic.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,63 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<Company>ITSCare GbR</Company>
<Authors>ITSCare GbR</Authors>
<Copyright>Copyright © ITSCare GbR 2021</Copyright>
<Product>ITSCare Example WebApi</Product>
<Version>0.0.0.0</Version>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyInformationalVersion>0.0.0.0</AssemblyInformationalVersion>
<FileVersion>0.0.0.0</FileVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<WarningsAsErrors />
<NoWarn>1591</NoWarn>
<DocumentationFile>bin\Debug\net5.0\ITSCare.Example.Api.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<WarningsAsErrors />
<NoWarn>1591</NoWarn>
<DocumentationFile>bin\Release\net5.0\ITSCare.Example.Api.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ITSCare.Common\ITSCare.Common.csproj" />
<ProjectReference Include="..\..\ITSCare.Data.EntityFramework\ITSCare.Data.EntityFramework.csproj" />
<ProjectReference Include="..\..\ITSCare.Data\ITSCare.Data.csproj" />
<ProjectReference Include="..\..\ITSCare.IoC.DotNetCore\ITSCare.IoC.DotNetCore.csproj" />
<ProjectReference Include="..\..\ITSCare.IoC\ITSCare.IoC.csproj" />
<ProjectReference Include="..\..\ITSCare.Job.Scheduling\ITSCare.Job.Scheduling.csproj" />
<ProjectReference Include="..\..\ITSCare.Job\ITSCare.Job.csproj" />
<ProjectReference Include="..\..\ITSCare.Web.Api.Cors.DotNetCore\ITSCare.Web.Api.Cors.DotNetCore.csproj" />
<ProjectReference Include="..\..\ITSCare.Web.Api.DotNetCore\ITSCare.Web.Api.DotNetCore.csproj" />
<ProjectReference Include="..\..\ITSCare.Web.Api.Swagger\ITSCare.Web.Api.Swagger.csproj" />
<ProjectReference Include="..\ITSCare.Example.Jobs.SayHelloWorld\ITSCare.Example.Jobs.SayHelloWorld.csproj" />
<ProjectReference Include="..\ITSCare.Example.Logic\ITSCare.Example.Logic.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,59 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<Company>ITSCare GbR</Company>
<Authors>ITSCare GbR</Authors>
<Copyright>Copyright © ITSCare GbR 2021</Copyright>
<Product>ITSCare Example WebApi</Product>
<Version>0.0.0.0</Version>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyInformationalVersion>0.0.0.0</AssemblyInformationalVersion>
<FileVersion>0.0.0.0</FileVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<WarningsAsErrors />
<NoWarn>1591</NoWarn>
<DocumentationFile>bin\Debug\net5.0\ITSCare.Example.Api.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<WarningsAsErrors />
<NoWarn>1591</NoWarn>
<DocumentationFile>bin\Release\net5.0\ITSCare.Example.Api.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ITSCare.Common\ITSCare.Common.csproj" />
<ProjectReference Include="..\..\ITSCare.Data.EntityFramework\ITSCare.Data.EntityFramework.csproj" />
<ProjectReference Include="..\..\ITSCare.Data\ITSCare.Data.csproj" />
<ProjectReference Include="..\..\ITSCare.IoC.DotNetCore\ITSCare.IoC.DotNetCore.csproj" />
<ProjectReference Include="..\..\ITSCare.IoC\ITSCare.IoC.csproj" />
<ProjectReference Include="..\..\ITSCare.Job\ITSCare.Job.csproj" />
<ProjectReference Include="..\ITSCare.Example.Jobs.SayHelloWorld\ITSCare.Example.Jobs.SayHelloWorld.csproj" />
<ProjectReference Include="..\ITSCare.Example.Logic\ITSCare.Example.Logic.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,68 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<Company>ITSCare GbR</Company>
<Authors>ITSCare GbR</Authors>
<Copyright>Copyright © ITSCare GbR 2021</Copyright>
<Product>ITSCare Example WebApi</Product>
<Version>0.0.0.0</Version>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyInformationalVersion>0.0.0.0</AssemblyInformationalVersion>
<FileVersion>0.0.0.0</FileVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<WarningsAsErrors />
<NoWarn>1591</NoWarn>
<DocumentationFile>bin\Debug\net5.0\ITSCare.Example.Api.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<WarningsAsErrors />
<NoWarn>1591</NoWarn>
<DocumentationFile>bin\Release\net5.0\ITSCare.Example.Api.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ITSCare.Common\ITSCare.Common.csproj" />
<ProjectReference Include="..\..\ITSCare.Data.EntityFramework\ITSCare.Data.EntityFramework.csproj" />
<ProjectReference Include="..\..\ITSCare.Data\ITSCare.Data.csproj" />
<ProjectReference Include="..\..\ITSCare.IoC.DotNetCore\ITSCare.IoC.DotNetCore.csproj" />
<ProjectReference Include="..\..\ITSCare.IoC\ITSCare.IoC.csproj" />
<ProjectReference Include="..\..\ITSCare.Job.Scheduling\ITSCare.Job.Scheduling.csproj" />
<ProjectReference Include="..\..\ITSCare.Job\ITSCare.Job.csproj" />
<ProjectReference Include="..\..\ITSCare.System\ITSCare.System.csproj" />
<ProjectReference Include="..\..\ITSCare.Validation\ITSCare.Validation.csproj" />
<ProjectReference Include="..\..\ITSCare.Web.Api.Authentication.SkyNet\ITSCare.Web.Api.Authentication.SkyNet.csproj" />
<ProjectReference Include="..\..\ITSCare.Web.Api.Cors.DotNetCore\ITSCare.Web.Api.Cors.DotNetCore.csproj" />
<ProjectReference Include="..\..\ITSCare.Web.Api.DotNetCore\ITSCare.Web.Api.DotNetCore.csproj" />
<ProjectReference Include="..\..\ITSCare.Web.Api.Swagger\ITSCare.Web.Api.Swagger.csproj" />
<ProjectReference Include="..\..\ITSCare.Web.Api\ITSCare.Web.Api.csproj" />
<ProjectReference Include="..\..\ITSCare.Web\ITSCare.Web.csproj" />
<ProjectReference Include="..\ITSCare.Example.Jobs.SayHelloWorld\ITSCare.Example.Jobs.SayHelloWorld.csproj" />
<ProjectReference Include="..\ITSCare.Example.Logic\ITSCare.Example.Logic.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,67 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<Company>ITSCare GbR</Company>
<Authors>ITSCare GbR</Authors>
<Copyright>Copyright © ITSCare GbR 2021</Copyright>
<Product>ITSCare Example WebApi</Product>
<Version>0.0.0.0</Version>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyInformationalVersion>0.0.0.0</AssemblyInformationalVersion>
<FileVersion>0.0.0.0</FileVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<WarningsAsErrors />
<NoWarn>1591</NoWarn>
<DocumentationFile>bin\Debug\net5.0\ITSCare.Example.Api.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<WarningsAsErrors />
<NoWarn>1591</NoWarn>
<DocumentationFile>bin\Release\net5.0\ITSCare.Example.Api.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GerstITS.AutoMapper" Version="2021.6.17" />
<PackageReference Include="GerstITS.Common" Version="2021.6.17" />
<PackageReference Include="GerstITS.Data" Version="2021.6.17" />
<PackageReference Include="GerstITS.IoC" Version="2021.6.17" />
<PackageReference Include="GerstITS.IoC.DotNetCore" Version="2021.6.17" />
<PackageReference Include="GerstITS.Job" Version="2021.6.17" />
<PackageReference Include="GerstITS.Job.Scheduling" Version="2021.6.17" />
<PackageReference Include="GerstITS.Search" Version="2021.6.17" />
<PackageReference Include="GerstITS.System" Version="2021.6.17" />
<PackageReference Include="GerstITS.Validation" Version="2021.6.17" />
<PackageReference Include="GerstITS.Web" Version="2021.6.17" />
<PackageReference Include="GerstITS.Web.Api" Version="2021.6.17" />
<PackageReference Include="GerstITS.Web.Api.Swagger" Version="2021.6.17" />
<PackageReference Include="GerstITS.Web.Rest" Version="2021.6.17" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GerstITS.Examples.Jobs.SayHelloWorld\GerstITS.Examples.Jobs.SayHelloWorld.csproj" />
<ProjectReference Include="..\GerstITS.Examples.Logic\GerstITS.Examples.Logic.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=common/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=common_005Cexceptionhandling_005Ctransformations/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=common_005Cswagger_005Cconfiguration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=common_005Cversioning/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controllers_005C1_002E0/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controllers_005Callversion/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -0,0 +1,18 @@
using GerstITS.Examples.Api.ExceptionHandling;
using GerstITS.Web.Api.ExceptionHandling.Extensions;
using Microsoft.Extensions.DependencyInjection;
namespace GerstITS.Examples.Api
{
public sealed partial class Module
{
#region Methods
private static void RegisterExceptionHandling(IServiceCollection container)
{
container.RegisterExceptionTransformationsOf<ValidationExceptionTransformation>();
}
#endregion
}
}

View File

@@ -0,0 +1,22 @@
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()
.SetCompatibilityVersion(CompatibilityVersion.Latest);
}
#endregion
}
}

View File

@@ -0,0 +1,18 @@
using GerstITS.Examples.Api.StartupTasks;
using GerstITS.IoC.DotNetCore;
using Microsoft.Extensions.DependencyInjection;
namespace GerstITS.Examples.Api
{
public sealed partial class Module
{
#region Methods
private static void RegisterStartupTasks(IServiceCollection container)
{
container.RegisterStartupTasksOf<ExampleStartupTask>();
}
#endregion
}
}

View File

@@ -0,0 +1,18 @@
using GerstITS.Examples.Api.Swagger;
using GerstITS.Web.Api.Swagger;
using Microsoft.Extensions.DependencyInjection;
namespace GerstITS.Examples.Api
{
public sealed partial class Module
{
#region Methods
private static void RegisterSwagger(IServiceCollection container)
{
container.AddSingleton<ISwaggerConfiguration, WebApiConfiguration>();
}
#endregion
}
}

View File

@@ -0,0 +1,20 @@
using GerstITS.IoC;
using Microsoft.Extensions.DependencyInjection;
namespace GerstITS.Examples.Api
{
public sealed partial class Module : IIoCModule<IServiceCollection>
{
#region IIoCModule
public void RegisterComponents(IServiceCollection container)
{
RegisterExceptionHandling(container);
RegisterMvc(container);
RegisterStartupTasks(container);
RegisterSwagger(container);
}
#endregion
}
}

View File

@@ -0,0 +1,21 @@
using GerstITS.Web.Api.Hosting;
namespace GerstITS.Examples.Api
{
public class Program : ProgramBase<Program>
{
#region Methods
public static void Main(string[] args)
{
Run(args);
}
protected override void ConfigureWebHost(IWebHostBuilder webHostBuilder)
{
webHostBuilder.UseStartup<Startup>();
}
#endregion
}
}

View File

@@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:61531/",
"sslPort": 44353
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ITSCare.Example.Api": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}

View File

@@ -0,0 +1,32 @@
using GerstITS.Web.Api;
using GerstITS.Web.Api.Builder;
using GerstITS.Web.Api.Hosting;
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.IsDevelopment())
applicationBuilder.UseDeveloperExceptionPage()
.UseSwagger();
else
applicationBuilder.UseHsts();
applicationBuilder.UseHttpsRedirection()
.UseAuthentication()
.UseAuthorization()
.UseRouting()
.UseEndpoints(endpoints => endpoints.MapControllers())
.UseRewriteUnknownPathsToIndexSite(ApplicationEnvironment.WebApi.BaseUrl)
.UseStaticFiles();
}
#endregion
}
}

View File

@@ -0,0 +1,22 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"WebApi": {
"SupportEMail": "support@itscare.de"
},
"SkyNet": {
"AppId": 86,
"Audience": "39CE2111-475C-42FE-88F7-9B7A29D0262C"
},
"LogPath": "log/{Date}.log",
"SayHelloWorldJob": {
"CronExpression": "*/30 * * * * ? *",
"Name": "Example Job"
}
}