проекты
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
namespace PARR.API.Settings
|
||||
using PARR.BLL.Contracts.Interfaces;
|
||||
|
||||
namespace PARR.API.Settings
|
||||
{
|
||||
public class MqSettings
|
||||
{
|
||||
@@ -12,12 +14,4 @@
|
||||
public string User { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public interface IMqSettings
|
||||
{
|
||||
string HostName { get; set; }
|
||||
string QueueName { get; set; }
|
||||
string User { get; set; }
|
||||
string Password { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
13
PARR.BLL/Contracts/Interfaces/IMqSettings.cs
Normal file
13
PARR.BLL/Contracts/Interfaces/IMqSettings.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace PARR.BLL.Contracts.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Поля настроек MQ, используется для appsettings.json
|
||||
/// </summary>
|
||||
public interface IMqSettings
|
||||
{
|
||||
string HostName { get; set; }
|
||||
string QueueName { get; set; }
|
||||
string User { get; set; }
|
||||
string Password { get; set; }
|
||||
}
|
||||
}
|
||||
9
PARR.GeneratorTemplates/PARR.GeneratorTemplates.csproj
Normal file
9
PARR.GeneratorTemplates/PARR.GeneratorTemplates.csproj
Normal file
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Worker">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>dotnet-PARR.GeneratorTemplatesWorker-deb14157-f207-44e0-8d4b-963c6066a75e</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
17
PARR.GeneratorTemplatesWorker/Program.cs
Normal file
17
PARR.GeneratorTemplatesWorker/Program.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using PARR.GeneratorTemplatesWorker;
|
||||
using Serilog;
|
||||
|
||||
IHost host = Host.CreateDefaultBuilder(args)
|
||||
.ConfigureServices(services =>
|
||||
{
|
||||
services.AddHostedService<Worker>();
|
||||
})
|
||||
.UseSerilog((hostContext, services, config) =>
|
||||
{
|
||||
config
|
||||
.WriteTo.Console()
|
||||
.ReadFrom.Configuration(hostContext.Configuration);
|
||||
})
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
11
PARR.GeneratorTemplatesWorker/Properties/launchSettings.json
Normal file
11
PARR.GeneratorTemplatesWorker/Properties/launchSettings.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"profiles": {
|
||||
"PARR.GeneratorTemplatesWorker": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"environmentVariables": {
|
||||
"DOTNET_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
PARR.GeneratorTemplatesWorker/Worker.cs
Normal file
21
PARR.GeneratorTemplatesWorker/Worker.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace PARR.GeneratorTemplatesWorker
|
||||
{
|
||||
public class Worker : BackgroundService
|
||||
{
|
||||
private readonly ILogger<Worker> _logger;
|
||||
|
||||
public Worker(ILogger<Worker> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
while (!stoppingToken.IsCancellationRequested)
|
||||
{
|
||||
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
|
||||
await Task.Delay(1000, stoppingToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
}
|
||||
}
|
||||
26
PARR.GeneratorTemplatesWorker/appsettings.json
Normal file
26
PARR.GeneratorTemplatesWorker/appsettings.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Debug",
|
||||
"Override": {
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Debug"
|
||||
}
|
||||
},
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "log/log-.txt",
|
||||
"rollingInterval": "Day"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.AIHIT;
|
||||
using PARR.DAL;
|
||||
using PARR.Mail;
|
||||
using PARR.Worker;
|
||||
using PARR.Worker.Settings;
|
||||
using Serilog;
|
||||
|
||||
Reference in New Issue
Block a user