feat: add DEX job common infrastructure
Add foundational types for DEX job execution: Constants: - ErrorAction enum (Ignore, Stop) for error handling strategy DTOs: - CheckQueryResult: check query execution result with ReturnValue - MainQueryResult: main query execution result with ReturnValue Interfaces: - ISQLExecutor: abstraction for SQL query execution and DTO mapping All types include comprehensive XML documentation
This commit is contained in:
18
ECMJobRunner.Application/Common/Constants/ErrorAction.cs
Normal file
18
ECMJobRunner.Application/Common/Constants/ErrorAction.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace ECMJobRunner.Application.Common.Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines actions to take when an error occurs during job execution
|
||||
/// </summary>
|
||||
public enum ErrorAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Ignore the error and continue execution
|
||||
/// </summary>
|
||||
Ignore,
|
||||
|
||||
/// <summary>
|
||||
/// Stop execution and throw an exception
|
||||
/// </summary>
|
||||
Stop,
|
||||
}
|
||||
}
|
||||
16
ECMJobRunner.Application/Common/Dtos/CheckQueryResult.cs
Normal file
16
ECMJobRunner.Application/Common/Dtos/CheckQueryResult.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ECMJobRunner.Application.Common.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Result of a check query execution
|
||||
/// </summary>
|
||||
public class CheckQueryResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Return value from the check query (expected: > 0 for success)
|
||||
/// </summary>
|
||||
[Column("Return Value")]
|
||||
public int? ReturnValue { get; set; }
|
||||
}
|
||||
}
|
||||
16
ECMJobRunner.Application/Common/Dtos/MainQueryResult.cs
Normal file
16
ECMJobRunner.Application/Common/Dtos/MainQueryResult.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ECMJobRunner.Application.Common.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Result of a main query execution
|
||||
/// </summary>
|
||||
public class MainQueryResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Return value from the main query (expected: null for success)
|
||||
/// </summary>
|
||||
[Column("Return Value")]
|
||||
public int? ReturnValue { get; set; }
|
||||
}
|
||||
}
|
||||
20
ECMJobRunner.Application/Common/Interfaces/ISQLExecutor.cs
Normal file
20
ECMJobRunner.Application/Common/Interfaces/ISQLExecutor.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ECMJobRunner.Application.Common.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for executing SQL queries and mapping results to DTOs
|
||||
/// </summary>
|
||||
public interface ISQLExecutor
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a SQL query and maps the result to the specified type
|
||||
/// </summary>
|
||||
/// <typeparam name="TResult">The type to map the query result to</typeparam>
|
||||
/// <param name="sql">The SQL query to execute</param>
|
||||
/// <param name="cancellationToken">Cancellation token</param>
|
||||
/// <returns>The mapped result or null if no result</returns>
|
||||
Task<TResult?> ExecuteQueryAsync<TResult>(string sql, CancellationToken cancellationToken = default);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user