diff --git a/ECMJobRunner.Application/Common/Constants/ErrorAction.cs b/ECMJobRunner.Application/Common/Constants/ErrorAction.cs new file mode 100644 index 0000000..6575895 --- /dev/null +++ b/ECMJobRunner.Application/Common/Constants/ErrorAction.cs @@ -0,0 +1,18 @@ +namespace ECMJobRunner.Application.Common.Constants +{ + /// + /// Defines actions to take when an error occurs during job execution + /// + public enum ErrorAction + { + /// + /// Ignore the error and continue execution + /// + Ignore, + + /// + /// Stop execution and throw an exception + /// + Stop, + } +} diff --git a/ECMJobRunner.Application/Common/Dtos/CheckQueryResult.cs b/ECMJobRunner.Application/Common/Dtos/CheckQueryResult.cs new file mode 100644 index 0000000..6629b40 --- /dev/null +++ b/ECMJobRunner.Application/Common/Dtos/CheckQueryResult.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations.Schema; + +namespace ECMJobRunner.Application.Common.Dtos +{ + /// + /// Result of a check query execution + /// + public class CheckQueryResult + { + /// + /// Return value from the check query (expected: > 0 for success) + /// + [Column("Return Value")] + public int? ReturnValue { get; set; } + } +} diff --git a/ECMJobRunner.Application/Common/Dtos/MainQueryResult.cs b/ECMJobRunner.Application/Common/Dtos/MainQueryResult.cs new file mode 100644 index 0000000..82d2fdf --- /dev/null +++ b/ECMJobRunner.Application/Common/Dtos/MainQueryResult.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations.Schema; + +namespace ECMJobRunner.Application.Common.Dtos +{ + /// + /// Result of a main query execution + /// + public class MainQueryResult + { + /// + /// Return value from the main query (expected: null for success) + /// + [Column("Return Value")] + public int? ReturnValue { get; set; } + } +} diff --git a/ECMJobRunner.Application/Common/Interfaces/ISQLExecutor.cs b/ECMJobRunner.Application/Common/Interfaces/ISQLExecutor.cs new file mode 100644 index 0000000..d14b0e8 --- /dev/null +++ b/ECMJobRunner.Application/Common/Interfaces/ISQLExecutor.cs @@ -0,0 +1,20 @@ +using System.Threading; +using System.Threading.Tasks; + +namespace ECMJobRunner.Application.Common.Interfaces +{ + /// + /// Interface for executing SQL queries and mapping results to DTOs + /// + public interface ISQLExecutor + { + /// + /// Executes a SQL query and maps the result to the specified type + /// + /// The type to map the query result to + /// The SQL query to execute + /// Cancellation token + /// The mapped result or null if no result + Task ExecuteQueryAsync(string sql, CancellationToken cancellationToken = default); + } +}