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.
40 lines
556 B
40 lines
556 B
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);
|
|
}
|
|
}
|