Refactor Profile entity and update property constraints

Renamed `Profile` to `CfgProfile` across the codebase for clarity and consistency. Updated property constraints in `CfgProfile.cs`, `ProfileHistory.cs`, and `ProfileSqlJob.cs` to include maximum length validations. Changed navigation properties in `CfgProfile.cs` to use `IEnumerable` and made them nullable. Updated `ForeignKey` attributes in `ProfileHistory.cs` and `ProfileSqlJob.cs` to reference `CfgProfile`. Improved property descriptions for better documentation.
This commit is contained in:
2026-07-09 13:23:46 +02:00
parent be8e58df84
commit ce47653831
3 changed files with 18 additions and 18 deletions

View File

@@ -11,7 +11,7 @@ namespace ECMJobRunner.Domain.Entities
/// Type: 0 = ADSync; 1 = GraphQL; 2 = SQL-Job; 3 = SQL and REST-Job /// Type: 0 = ADSync; 1 = GraphQL; 2 = SQL-Job; 3 = SQL and REST-Job
/// </summary> /// </summary>
[Table("TBJR_CFG_PROFILE", Schema = "dbo")] [Table("TBJR_CFG_PROFILE", Schema = "dbo")]
public class Profile public class CfgProfile
{ {
/// <summary> /// <summary>
/// Primary Key /// Primary Key
@@ -29,7 +29,7 @@ namespace ECMJobRunner.Domain.Entities
public bool Active { get; set; } = true; public bool Active { get; set; } = true;
/// <summary> /// <summary>
/// Optional profile name /// Profile name (max 150 chars)
/// </summary> /// </summary>
[Required] [Required]
[Column("PROFILE_NAME")] [Column("PROFILE_NAME")]
@@ -44,7 +44,7 @@ namespace ECMJobRunner.Domain.Entities
public byte TypeId { get; set; } public byte TypeId { get; set; }
/// <summary> /// <summary>
/// Schedule in Cron format /// Schedule in Cron format (max 150 chars)
/// </summary> /// </summary>
[Required] [Required]
[Column("SCHEDULE")] [Column("SCHEDULE")]
@@ -52,14 +52,14 @@ namespace ECMJobRunner.Domain.Entities
public string Schedule { get; set; } = "0 30 4 ? * MON-SAT"; public string Schedule { get; set; } = "0 30 4 ? * MON-SAT";
/// <summary> /// <summary>
/// Optional description /// Optional description (max 500 chars)
/// </summary> /// </summary>
[Column("COMMENT")] [Column("COMMENT")]
[MaxLength(500)] [MaxLength(500)]
public string? Comment { get; set; } public string? Comment { get; set; }
/// <summary> /// <summary>
/// Created by /// Created by (max 50 chars)
/// </summary> /// </summary>
[Required] [Required]
[Column("ADDED_WHO")] [Column("ADDED_WHO")]
@@ -74,7 +74,7 @@ namespace ECMJobRunner.Domain.Entities
public DateTime AddedWhen { get; set; } = DateTime.Now; public DateTime AddedWhen { get; set; } = DateTime.Now;
/// <summary> /// <summary>
/// Modified by /// Modified by (max 50 chars)
/// </summary> /// </summary>
[Column("CHANGED_WHO")] [Column("CHANGED_WHO")]
[MaxLength(50)] [MaxLength(50)]
@@ -91,11 +91,11 @@ namespace ECMJobRunner.Domain.Entities
/// <summary> /// <summary>
/// SQL Jobs associated with this profile /// SQL Jobs associated with this profile
/// </summary> /// </summary>
public virtual ICollection<ProfileSqlJob> SqlJobs { get; set; } = new List<ProfileSqlJob>(); public virtual IEnumerable<ProfileSqlJob>? SqlJobs { get; set; }
/// <summary> /// <summary>
/// Profile execution history /// Profile execution history
/// </summary> /// </summary>
public virtual ICollection<ProfileHistory> ProfileHistories { get; set; } = new List<ProfileHistory>(); public virtual IEnumerable<ProfileHistory>? ProfileHistories { get; set; }
} }
} }

View File

@@ -25,7 +25,7 @@ namespace ECMJobRunner.Domain.Entities
/// </summary> /// </summary>
[Required] [Required]
[Column("FK_TBJR_CFG_PROFILE_ID")] [Column("FK_TBJR_CFG_PROFILE_ID")]
[ForeignKey(nameof(Profile))] [ForeignKey(nameof(CfgProfile))]
public long ProfileId { get; set; } public long ProfileId { get; set; }
/// <summary> /// <summary>
@@ -43,7 +43,7 @@ namespace ECMJobRunner.Domain.Entities
public string ResultText { get; set; } = string.Empty; public string ResultText { get; set; } = string.Empty;
/// <summary> /// <summary>
/// Created by /// Created by (max 50 chars)
/// </summary> /// </summary>
[Required] [Required]
[Column("ADDED_WHO")] [Column("ADDED_WHO")]
@@ -58,7 +58,7 @@ namespace ECMJobRunner.Domain.Entities
public DateTime AddedWhen { get; set; } = DateTime.Now; public DateTime AddedWhen { get; set; } = DateTime.Now;
/// <summary> /// <summary>
/// Modified by /// Modified by (max 50 chars)
/// </summary> /// </summary>
[Column("CHANGED_WHO")] [Column("CHANGED_WHO")]
[MaxLength(50)] [MaxLength(50)]
@@ -75,6 +75,6 @@ namespace ECMJobRunner.Domain.Entities
/// <summary> /// <summary>
/// Associated Profile /// Associated Profile
/// </summary> /// </summary>
public virtual Profile Profile { get; set; } = null!; public virtual CfgProfile? CfgProfile { get; set; }
} }
} }

View File

@@ -24,7 +24,7 @@ namespace ECMJobRunner.Domain.Entities
/// </summary> /// </summary>
[Required] [Required]
[Column("FK_TBJR_CFG_PROFILE_ID")] [Column("FK_TBJR_CFG_PROFILE_ID")]
[ForeignKey(nameof(Profile))] [ForeignKey(nameof(CfgProfile))]
public long ProfileId { get; set; } public long ProfileId { get; set; }
/// <summary> /// <summary>
@@ -42,7 +42,7 @@ namespace ECMJobRunner.Domain.Entities
public short Sequence { get; set; } = 0; public short Sequence { get; set; } = 0;
/// <summary> /// <summary>
/// Optional name /// Optional name (max 150 chars)
/// </summary> /// </summary>
[Column("NAME")] [Column("NAME")]
[MaxLength(150)] [MaxLength(150)]
@@ -67,14 +67,14 @@ namespace ECMJobRunner.Domain.Entities
public string? ApiCommand { get; set; } public string? ApiCommand { get; set; }
/// <summary> /// <summary>
/// Optional description /// Optional description (max 500 chars)
/// </summary> /// </summary>
[Column("COMMENT")] [Column("COMMENT")]
[MaxLength(500)] [MaxLength(500)]
public string? Comment { get; set; } public string? Comment { get; set; }
/// <summary> /// <summary>
/// Created by /// Created by (max 50 chars)
/// </summary> /// </summary>
[Required] [Required]
[Column("ADDED_WHO")] [Column("ADDED_WHO")]
@@ -89,7 +89,7 @@ namespace ECMJobRunner.Domain.Entities
public DateTime AddedWhen { get; set; } = DateTime.Now; public DateTime AddedWhen { get; set; } = DateTime.Now;
/// <summary> /// <summary>
/// Modified by /// Modified by (max 50 chars)
/// </summary> /// </summary>
[Column("CHANGED_WHO")] [Column("CHANGED_WHO")]
[MaxLength(50)] [MaxLength(50)]
@@ -106,6 +106,6 @@ namespace ECMJobRunner.Domain.Entities
/// <summary> /// <summary>
/// Associated Profile /// Associated Profile
/// </summary> /// </summary>
public virtual Profile Profile { get; set; } = null!; public virtual CfgProfile? CfgProfile { get; set; }
} }
} }