Add ResultType enum and Result property in ProfileHistory
Introduced a new `ResultType` enum to represent job execution result types, including `Ok`, `Error`, `Warning`, and `Unknown`. Added a `Result` property in the `ProfileHistory` class as a wrapper around the `ResultId` property, with logic to map `ResultId` to `ResultType` values. Updated `ProfileHistory.cs` to include necessary namespaces.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using ECMJobRunner.Domain.ValueObjects;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
@@ -35,6 +36,18 @@ namespace ECMJobRunner.Domain.Entities
|
||||
[Column("RESULT_ID")]
|
||||
public byte ResultId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the result type of the job execution.
|
||||
/// This property is not mapped to a database column; it wraps <see cref="ResultId"/>.
|
||||
/// If <see cref="ResultId"/> does not correspond to a defined <see cref="ResultType"/> value, returns <see cref="ResultType.Unknown"/>.
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public ResultType Result
|
||||
{
|
||||
get => Enum.IsDefined(typeof(ResultType), ResultId) ? (ResultType)ResultId : ResultType.Unknown;
|
||||
set => ResultId = (byte)value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Result text/message
|
||||
/// </summary>
|
||||
|
||||
27
ECMJobRunner.Domain/ValueObjects/ResultType.cs
Normal file
27
ECMJobRunner.Domain/ValueObjects/ResultType.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace ECMJobRunner.Domain.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the result type of a job execution.
|
||||
/// </summary>
|
||||
public enum ResultType : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// The operation completed successfully.
|
||||
/// </summary>
|
||||
Ok = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The operation encountered an error.
|
||||
/// </summary>
|
||||
Error = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The operation completed with warnings.
|
||||
/// </summary>
|
||||
Warning = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The operation result is unknown.
|
||||
/// </summary>
|
||||
Unknown = 255
|
||||
}
|
||||
Reference in New Issue
Block a user