using Connected.Data.Storage; using Connected.Entities.Storage; namespace Connected.ServiceModel.Client.Data; internal sealed class TableWriter : TableCommand, IStorageWriter { public TableWriter(IStorageOperation operation, IStorageConnection connection) : base(operation, connection) { } public async Task Execute() { if (Connection is null) return -1; try { var recordsAffected = await Connection.Execute(this); if (Connection.Behavior == StorageConnectionMode.Isolated) await Connection.Commit(); return recordsAffected; } finally { if (Connection.Behavior == StorageConnectionMode.Isolated) { await Connection.Close(); await Connection.DisposeAsync(); Connection = null; } } } }