24 lines
595 B
C#
24 lines
595 B
C#
using Microsoft.Extensions.Hosting;
|
|
|
|
namespace RPG.Services.Core;
|
|
public abstract class RPGServiceBase : IHostedService
|
|
{
|
|
private readonly ServiceManager _serviceManager;
|
|
|
|
public RPGServiceBase(ServiceManager serviceManager)
|
|
{
|
|
_serviceManager = serviceManager;
|
|
}
|
|
|
|
public virtual Task StartAsync(CancellationToken cancellationToken)
|
|
{
|
|
_serviceManager.Start();
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
public virtual async Task StopAsync(CancellationToken cancellationToken)
|
|
{
|
|
await _serviceManager.ShutdownAsync();
|
|
}
|
|
}
|