Use file scope namespaces

This commit is contained in:
2025-08-11 10:13:20 +02:00
parent 5cf1a07526
commit 0f20e727d3
3 changed files with 59 additions and 67 deletions

View File

@@ -1,16 +1,11 @@
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Serilog; using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TemplateNETService.Business; using TemplateNETService.Business;
namespace TemplateNETService namespace TemplateNETService;
internal class BaseWorker : BackgroundService
{ {
internal class BaseWorker : BackgroundService
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken) protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{ {
Log.Debug($"Service is started on port {Config.general.ThisPort}..."); Log.Debug($"Service is started on port {Config.general.ThisPort}...");
@@ -26,5 +21,4 @@ namespace TemplateNETService
{ {
Log.Debug("Service stopped..."); Log.Debug("Service stopped...");
} }
}
} }

View File

@@ -7,10 +7,10 @@ using Serilog.Events;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using TemplateNETService.Models; using TemplateNETService.Models;
namespace TemplateNETService.Business namespace TemplateNETService.Business;
public class Program
{ {
public class Program
{
public static void Main(string[] args) public static void Main(string[] args)
{ {
Directory.CreateDirectory("_LOG"); Directory.CreateDirectory("_LOG");
@@ -51,5 +51,4 @@ namespace TemplateNETService.Business
services.AddHostedService<BaseWorker>(); services.AddHostedService<BaseWorker>();
}); });
}); });
}
} }

View File

@@ -3,10 +3,10 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
namespace TemplateNETService namespace TemplateNETService;
public class Startup
{ {
public class Startup
{
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddControllers(); services.AddControllers();
@@ -24,5 +24,4 @@ namespace TemplateNETService
}); });
} }
}
} }