Refactor entities: remove preprocessor blocks, unify style

Refactored Envelope, Receiver, and Signature entity classes to eliminate preprocessor directives around class and property definitions. Applied attributes directly and reformatted properties for clarity. Constructors are now always present, with default initializations still conditional where needed. Removed obsolete directives from IHasAddedWho. These changes improve code readability, maintainability, and cross-platform compatibility.
This commit is contained in:
2026-02-09 15:37:00 +01:00
parent 910a870ddf
commit c674a450d8
4 changed files with 327 additions and 348 deletions

View File

@@ -5,19 +5,13 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using EnvelopeGenerator.Domain.Constants; using EnvelopeGenerator.Domain.Constants;
using Newtonsoft.Json; using Newtonsoft.Json;
#if NETFRAMEWORK #if NETFRAMEWORK
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
#endif #endif
namespace EnvelopeGenerator.Domain.Entities namespace EnvelopeGenerator.Domain.Entities
#if NET
;
#elif NETFRAMEWORK
{ {
#endif
[Table("TBSIG_ENVELOPE", Schema = "dbo")] [Table("TBSIG_ENVELOPE", Schema = "dbo")]
public class Envelope : IHasAddedWhen, IHasChangedWhen public class Envelope : IHasAddedWhen, IHasChangedWhen
{ {
@@ -81,7 +75,8 @@ public class Envelope : IHasAddedWhen, IHasChangedWhen
#if nullable #if nullable
? ?
#endif #endif
Title { get; set; } Title
{ get; set; }
[Column("COMMENT", TypeName = "nvarchar(128)")] [Column("COMMENT", TypeName = "nvarchar(128)")]
public string Comment { get; set; } public string Comment { get; set; }
@@ -146,14 +141,16 @@ public class Envelope : IHasAddedWhen, IHasChangedWhen
#if nullable #if nullable
? ?
#endif #endif
DocResult { get; set; } DocResult
{ get; set; }
[ForeignKey("EnvelopeTypeId")] [ForeignKey("EnvelopeTypeId")]
public virtual EnvelopeType public virtual EnvelopeType
#if nullable #if nullable
? ?
#endif #endif
Type { get; set; } Type
{ get; set; }
#if NETFRAMEWORK #if NETFRAMEWORK
[NotMapped] [NotMapped]
@@ -167,19 +164,22 @@ public class Envelope : IHasAddedWhen, IHasChangedWhen
#if nullable #if nullable
? ?
#endif #endif
Documents { get; set; } Documents
{ get; set; }
public List<History> public List<History>
#if nullable #if nullable
? ?
#endif #endif
Histories { get; set; } Histories
{ get; set; }
public List<EnvelopeReceiver> public List<EnvelopeReceiver>
#if nullable #if nullable
? ?
#endif #endif
EnvelopeReceivers { get; set; } EnvelopeReceivers
{ get; set; }
//#if NETFRAMEWORK //#if NETFRAMEWORK
/// <summary> /// <summary>
@@ -202,7 +202,4 @@ public class Envelope : IHasAddedWhen, IHasChangedWhen
} }
//#endif //#endif
} }
#if NETFRAMEWORK
} }
#endif

View File

@@ -1,19 +1,13 @@
using System; using EnvelopeGenerator.Domain.Interfaces;
using EnvelopeGenerator.Domain.Interfaces;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Drawing;
#if NETFRAMEWORK #if NETFRAMEWORK
using System;
using System.Collections.Generic; using System.Collections.Generic;
#endif #endif
namespace EnvelopeGenerator.Domain.Entities namespace EnvelopeGenerator.Domain.Entities
#if NET
;
#elif NETFRAMEWORK
{ {
#endif
[Table("TBSIG_RECEIVER", Schema = "dbo")] [Table("TBSIG_RECEIVER", Schema = "dbo")]
public class Receiver : IHasAddedWhen public class Receiver : IHasAddedWhen
{ {
@@ -45,7 +39,4 @@ public class Receiver : IHasAddedWhen
public string GetSignature() => EmailAddress.ToUpperInvariant().GetChecksum(); public string GetSignature() => EmailAddress.ToUpperInvariant().GetChecksum();
} }
#if NETFRAMEWORK
} }
#endif

View File

@@ -8,12 +8,7 @@ using System.Collections.Generic;
#endif #endif
namespace EnvelopeGenerator.Domain.Entities namespace EnvelopeGenerator.Domain.Entities
#if NET
;
#elif NETFRAMEWORK
{ {
#endif
[Table("TBSIG_DOCUMENT_RECEIVER_ELEMENT", Schema = "dbo")] [Table("TBSIG_DOCUMENT_RECEIVER_ELEMENT", Schema = "dbo")]
public class Signature : ISignature, IHasReceiver, IHasAddedWhen, IHasChangedWhen, IHasChangedWho public class Signature : ISignature, IHasReceiver, IHasAddedWhen, IHasChangedWhen, IHasChangedWho
{ {
@@ -102,7 +97,8 @@ public class Signature : ISignature, IHasReceiver, IHasAddedWhen, IHasChangedWhe
#if nullable #if nullable
? ?
#endif #endif
ChangedWho { get; set; } ChangedWho
{ get; set; }
[ForeignKey("DocumentId")] [ForeignKey("DocumentId")]
public virtual Document Document { get; set; } public virtual Document Document { get; set; }
@@ -112,13 +108,15 @@ public class Signature : ISignature, IHasReceiver, IHasAddedWhen, IHasChangedWhe
#if nullable #if nullable
? ?
#endif #endif
Receiver { get; set; } Receiver
{ get; set; }
public virtual IEnumerable<ElementAnnotation> public virtual IEnumerable<ElementAnnotation>
#if nullable #if nullable
? ?
#endif #endif
Annotations { get; set; } Annotations
{ get; set; }
#if NETFRAMEWORK #if NETFRAMEWORK
[NotMapped] [NotMapped]
@@ -128,7 +126,4 @@ public class Signature : ISignature, IHasReceiver, IHasAddedWhen, IHasChangedWhe
public double Left => Math.Round(X, 5); public double Left => Math.Round(X, 5);
#endif #endif
} }
#if NETFRAMEWORK
} }
#endif

View File

@@ -1,7 +1,3 @@
#if NETFRAMEWORK
using System;
#endif
namespace EnvelopeGenerator.Domain.Interfaces namespace EnvelopeGenerator.Domain.Interfaces
{ {
public interface IHasAddedWho public interface IHasAddedWho