Refactor: Replace EnvelopeTypeId with EnvelopeType enum

Replaced all instances of `EnvelopeTypeId` (int/int?) with `Type`
(EnvelopeType/EnvelopeType?) across the codebase to improve type
safety and readability. Updated affected properties, methods, and
logic in DTOs, commands, handlers, and Razor components.

Introduced conditional compilation to handle differences between
.NET and .NET Framework where necessary. Removed obsolete helper
methods for `EnvelopeTypeId`. This refactor ensures consistent use
of the strongly-typed `EnvelopeType` enum, reducing the risk of
invalid values and aligning with best practices.
This commit is contained in:
2026-11-13 11:46:56 +01:00
parent 18fbc2100f
commit 48b2fc0eca
15 changed files with 63 additions and 56 deletions

View File

@@ -106,7 +106,12 @@ namespace EnvelopeGenerator.Domain.Entities
public int? ReminderIntervalDays { get; set; }
[Column("ENVELOPE_TYPE")]
public int? EnvelopeTypeId { get; set; }
#if NET
public EnvelopeType? Type { get; set; }
#elif NETFRAMEWORK
public int EnvelopeTypeId { get; set; }
#endif
[JsonIgnore]
[NotMapped]
@@ -155,7 +160,7 @@ namespace EnvelopeGenerator.Domain.Entities
DocResult
{ get; set; }
[ForeignKey("EnvelopeTypeId")]
[ForeignKey("Type")]
public virtual EnvelopeTypeDefaults
#if nullable
?

View File

@@ -14,7 +14,7 @@ namespace EnvelopeGenerator.Domain.Entities
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public int Id { get; set; } = 0;
public EnvelopeType Id { get; set; } = 0;
[Required]
[Column("TITLE", TypeName = "nvarchar(128)")]