Add framework-specific handling for Id property

Introduce conditional compilation to differentiate `Id` property
behavior between `NET` and `NETFRAMEWORK` environments. For `NET`,
the `Id` property is of type `EnvelopeType` with `[Key]` and
`[Column("GUID")]` attributes. For `NETFRAMEWORK`, the `Id` property
is of type `int` with a default value of `0`, retaining `[Key]`,
`[DatabaseGenerated(DatabaseGeneratedOption.Identity)]`, and
`[Column("GUID")]` attributes. These changes ensure compatibility
and proper configuration across frameworks.
This commit is contained in:
2026-11-13 13:00:10 +01:00
parent abd3c23f8c
commit b5c9c8da6c

View File

@@ -11,10 +11,18 @@ namespace EnvelopeGenerator.Domain.Entities
[Table("TBSIG_ENVELOPE_TYPE", Schema = "dbo")] [Table("TBSIG_ENVELOPE_TYPE", Schema = "dbo")]
public class EnvelopeTypeDefaults public class EnvelopeTypeDefaults
{ {
#if NET
[Key]
[Column("GUID")]
public EnvelopeType Id { get; set; }
#elif NETFRAMEWORK
[Key] [Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")] [Column("GUID")]
public EnvelopeType Id { get; set; } = 0; public int Id { get; set; } = 0;
#endif
[Required] [Required]
[Column("TITLE", TypeName = "nvarchar(128)")] [Column("TITLE", TypeName = "nvarchar(128)")]