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
/// </summary>
[Table("TBJR_CFG_PROFILE", Schema = "dbo")]
public class Profile
public class CfgProfile
{
/// <summary>
/// Primary Key
@@ -29,7 +29,7 @@ namespace ECMJobRunner.Domain.Entities
public bool Active { get; set; } = true;
/// <summary>
/// Optional profile name
/// Profile name (max 150 chars)
/// </summary>
[Required]
[Column("PROFILE_NAME")]
@@ -44,7 +44,7 @@ namespace ECMJobRunner.Domain.Entities
public byte TypeId { get; set; }
/// <summary>
/// Schedule in Cron format
/// Schedule in Cron format (max 150 chars)
/// </summary>
[Required]
[Column("SCHEDULE")]
@@ -52,14 +52,14 @@ namespace ECMJobRunner.Domain.Entities
public string Schedule { get; set; } = "0 30 4 ? * MON-SAT";
/// <summary>
/// Optional description
/// Optional description (max 500 chars)
/// </summary>
[Column("COMMENT")]
[MaxLength(500)]
public string? Comment { get; set; }
/// <summary>
/// Created by
/// Created by (max 50 chars)
/// </summary>
[Required]
[Column("ADDED_WHO")]
@@ -74,7 +74,7 @@ namespace ECMJobRunner.Domain.Entities
public DateTime AddedWhen { get; set; } = DateTime.Now;
/// <summary>
/// Modified by
/// Modified by (max 50 chars)
/// </summary>
[Column("CHANGED_WHO")]
[MaxLength(50)]
@@ -91,11 +91,11 @@ namespace ECMJobRunner.Domain.Entities
/// <summary>
/// SQL Jobs associated with this profile
/// </summary>
public virtual ICollection<ProfileSqlJob> SqlJobs { get; set; } = new List<ProfileSqlJob>();
public virtual IEnumerable<ProfileSqlJob>? SqlJobs { get; set; }
/// <summary>
/// Profile execution history
/// </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>
[Required]
[Column("FK_TBJR_CFG_PROFILE_ID")]
[ForeignKey(nameof(Profile))]
[ForeignKey(nameof(CfgProfile))]
public long ProfileId { get; set; }
/// <summary>
@@ -43,7 +43,7 @@ namespace ECMJobRunner.Domain.Entities
public string ResultText { get; set; } = string.Empty;
/// <summary>
/// Created by
/// Created by (max 50 chars)
/// </summary>
[Required]
[Column("ADDED_WHO")]
@@ -58,7 +58,7 @@ namespace ECMJobRunner.Domain.Entities
public DateTime AddedWhen { get; set; } = DateTime.Now;
/// <summary>
/// Modified by
/// Modified by (max 50 chars)
/// </summary>
[Column("CHANGED_WHO")]
[MaxLength(50)]
@@ -75,6 +75,6 @@ namespace ECMJobRunner.Domain.Entities
/// <summary>
/// Associated Profile
/// </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>
[Required]
[Column("FK_TBJR_CFG_PROFILE_ID")]
[ForeignKey(nameof(Profile))]
[ForeignKey(nameof(CfgProfile))]
public long ProfileId { get; set; }
/// <summary>
@@ -42,7 +42,7 @@ namespace ECMJobRunner.Domain.Entities
public short Sequence { get; set; } = 0;
/// <summary>
/// Optional name
/// Optional name (max 150 chars)
/// </summary>
[Column("NAME")]
[MaxLength(150)]
@@ -67,14 +67,14 @@ namespace ECMJobRunner.Domain.Entities
public string? ApiCommand { get; set; }
/// <summary>
/// Optional description
/// Optional description (max 500 chars)
/// </summary>
[Column("COMMENT")]
[MaxLength(500)]
public string? Comment { get; set; }
/// <summary>
/// Created by
/// Created by (max 50 chars)
/// </summary>
[Required]
[Column("ADDED_WHO")]
@@ -89,7 +89,7 @@ namespace ECMJobRunner.Domain.Entities
public DateTime AddedWhen { get; set; } = DateTime.Now;
/// <summary>
/// Modified by
/// Modified by (max 50 chars)
/// </summary>
[Column("CHANGED_WHO")]
[MaxLength(50)]
@@ -106,6 +106,6 @@ namespace ECMJobRunner.Domain.Entities
/// <summary>
/// Associated Profile
/// </summary>
public virtual Profile Profile { get; set; } = null!;
public virtual CfgProfile? CfgProfile { get; set; }
}
}