feat(all): Проекты под задачи синхронизации нарядов еспп и агентов

This commit is contained in:
Mikhail Trubnikov
2023-10-19 15:59:57 +10:00
parent 2f88078d37
commit 526140eea4
37 changed files with 508 additions and 11 deletions

View File

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-PARR.Test-4ed55577-3528-48f9-99c8-33eb108a33bb</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PARR.EsppApi\PARR.EsppApi.csproj" />
</ItemGroup>
</Project>

13
PARR.Test/Program.cs Normal file
View File

@@ -0,0 +1,13 @@
using PARR.EsppApi;
using PARR.Test;
IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices((hostContext, services) =>
{
services.InstallEsppApiServices(hostContext.Configuration);
services.AddHostedService<Worker>();
})
.Build();
host.Run();

View File

@@ -0,0 +1,11 @@
{
"profiles": {
"PARR.Test": {
"commandName": "Project",
"dotnetRunMessages": true,
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
}
}
}

34
PARR.Test/Worker.cs Normal file
View File

@@ -0,0 +1,34 @@
using PARR.EsppApi;
namespace PARR.Test
{
public class Worker : BackgroundService
{
private readonly ILogger<Worker> _logger;
private readonly IEsppApiService esppApiService;
public Worker(ILogger<Worker> logger, IEsppApiService esppApiService)
{
_logger = logger;
this.esppApiService = esppApiService;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
//while (!stoppingToken.IsCancellationRequested)
//{
// _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
// await Task.Delay(1000, stoppingToken);
//}
await TestEsppApi();
}
private async Task TestEsppApi()
{
// var orders = await esppApiService.FindOrdersByPrefixAsync("ПАРР__");
}
}
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}