Refactor SQL execution in DocumentCreateReadSQL
Changed namespace for DocumentCreateReadSQL and updated SQL command to use formatted strings for parameters. Simplified DocumentExecutor to directly use the formatted SQL, enhancing clarity and reducing complexity in parameter handling.
This commit is contained in:
@@ -18,9 +18,9 @@ public class DocumentExecutor : SQLExecutor, IDocumentExecutor
|
||||
{
|
||||
using var connection = new SqlConnection(Params.ConnectionString);
|
||||
var sql = Provider.GetRequiredService<DocumentCreateReadSQL>();
|
||||
var formattedSql = string.Format(sql.Raw, base64, envelope_uuid);
|
||||
await connection.OpenAsync(cancellation);
|
||||
var parameters = DocumentCreateReadSQL.CreateParmas(base64, envelope_uuid);
|
||||
var documents = await connection.QueryAsync<EnvelopeDocument>(sql.Raw, parameters);
|
||||
var documents = await connection.QueryAsync<EnvelopeDocument>(formattedSql);
|
||||
return documents.FirstOrDefault()
|
||||
?? throw new InvalidOperationException($"Document creation failed. Parameters:" +
|
||||
$"base64={base64}, envelope_uuid='{envelope_uuid}'.");
|
||||
|
||||
Reference in New Issue
Block a user