public void Commit()
{
_taskQueue.CompleteAdding();
if (_taskQueue.Count > 0)
{
_cancellationTokenSource.Cancel();
throw new InvalidOperationException("Cannot commit unless all tasks have been completed");
}
if (CustomHeaders != null)
{
Transaction.CustomHeaders = CustomHeaders;
}
Transaction.Commit();
}