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,27 @@
using GerstITS.Job.Scheduling;
using GerstITS.System.Configurations;
using Microsoft.Extensions.Configuration;
namespace GerstITS.Examples.Jobs.SayHelloWorld.Configurations
{
public class SayHelloWorldJobConfiguration : JobSchedulingConfigurationBase
{
#region Properties
public string Name { get; }
#endregion
#region Constructors
public SayHelloWorldJobConfiguration(Microsoft.Extensions.Configuration.IConfiguration configuration)
: base(configuration)
{
var prefix = this.ToConfigurationPrefix();
Name = configuration.GetValue<string>($"{prefix}:{nameof(Name)}");
}
#endregion
}
}

View File

@@ -0,0 +1,48 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Company>ITSCare GbR</Company>
<Authors>ITSCare GbR</Authors>
<Copyright>Copyright © ITSCare GbR 2021</Copyright>
<Product>ITSCare GbR Example Job</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 />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<WarningsAsErrors />
<NoWarn />
</PropertyGroup>
<ItemGroup>
<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="Microsoft.EntityFrameworkCore" Version="5.0.2" />
</ItemGroup>
<ItemGroup>
<Compile Update="Module.Jobs.cs">
<DependentUpon>Module.cs</DependentUpon>
</Compile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,2 @@
<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/=configurations/@EntryIndexedValue">False</s:Boolean></wpf:ResourceDictionary>

View File

@@ -0,0 +1,51 @@
using System.Diagnostics;
using System.Threading;
using GerstITS.Data;
using GerstITS.Examples.Jobs.SayHelloWorld.Configurations;
using GerstITS.Job;
using GerstITS.System.Environment;
using Quartz;
namespace GerstITS.Examples.Jobs.SayHelloWorld.Jobs
{
[DisallowConcurrentExecution]
public class SayHelloWorldJob : JobBase
{
#region Fields
private readonly SayHelloWorldJobConfiguration _configuration;
private readonly Stopwatch _stopWatch;
private readonly IRepository _repository;
private readonly ISystemClock _systemClock;
#endregion
#region Cosntructors
public SayHelloWorldJob(SayHelloWorldJobConfiguration configuration,
IRepository repository,
ISystemClock systemClock)
{
_systemClock = systemClock;
_repository = repository;
_configuration = configuration;
_stopWatch = new Stopwatch();
}
#endregion
#region Methods
protected override void Execute()
{
_stopWatch.Restart();
Thread.Sleep(4000);
var now = _systemClock.UtcNow;
_stopWatch.Stop();
Debug.WriteLine($"---> Say hello to world from {_configuration.Name}, Duration: {_stopWatch.ElapsedMilliseconds / 1000}s");
}
#endregion
}
}

View File

@@ -0,0 +1,20 @@
using GerstITS.Examples.Jobs.SayHelloWorld.Configurations;
using GerstITS.Examples.Jobs.SayHelloWorld.Jobs;
using GerstITS.IoC;
using GerstITS.Job.Scheduling;
using Microsoft.Extensions.DependencyInjection;
namespace GerstITS.Examples.Jobs.SayHelloWorld
{
public sealed class Module : IIoCModule<IServiceCollection>
{
#region IIoCModule
public void RegisterComponents(IServiceCollection container)
{
container.RegisterJob<SayHelloWorldJob, SayHelloWorldJobConfiguration>();
}
#endregion
}
}