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.

39 lines
758 B

2 years ago
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<int> 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;
}
}
}
}