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.

69 lines
1.1 KiB

using Connected.Data.Storage;
using Connected.Entities.Storage;
namespace Connected.ServiceModel.Client.Data;
internal abstract class TableCommand : IStorageCommand
{
protected TableCommand(IStorageOperation operation, IStorageConnection connection)
{
Connection = connection;
Operation = operation;
}
protected bool IsDisposed { get; private set; }
public IStorageOperation Operation { get; }
public IStorageConnection? Connection { get; protected set; }
protected virtual async ValueTask DisposeAsync(bool disposing)
{
if (!IsDisposed)
{
if (disposing)
{
Connection = null;
await OnDisposingAsync();
}
IsDisposed = true;
}
}
protected virtual async ValueTask OnDisposingAsync()
{
await ValueTask.CompletedTask;
}
protected virtual void OnDisposing()
{
}
public async ValueTask DisposeAsync()
{
await DisposeAsync(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!IsDisposed)
{
if (disposing)
{
Connection = null;
OnDisposing();
}
IsDisposed = true;
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}