You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Framework/Connected.Middleware/MiddlewareComponent.cs

40 lines
556 B

2 years ago
namespace Connected.Middleware;
public abstract class MiddlewareComponent : IMiddleware, IDisposable
{
protected bool IsDisposed { get; private set; }
public async Task Initialize()
{
await OnInitialize();
}
protected virtual async Task OnInitialize()
{
await Task.CompletedTask;
}
protected virtual void OnDisposing()
{
}
private void Dispose(bool disposing)
{
if (!IsDisposed)
{
if (disposing)
OnDisposing();
IsDisposed = true;
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}