Refactor entities: remove preprocessor directives, unify style

Large-scale cleanup of entity and interface classes:
- Removed obsolete #if NET/NETFRAMEWORK preprocessor blocks
- Unified class/property formatting and indentation
- Standardized use of data annotations
- Improved nullable reference type handling
- Simplified interfaces (IHasEnvelope, IHasReceiver)
- Removed redundant and dead code
- No changes to business logic or data model

These changes modernize and standardize the codebase for easier maintenance and .NET compatibility.
This commit is contained in:
2026-02-09 15:32:41 +01:00
parent e2afbc5a62
commit 910a870ddf
9 changed files with 321 additions and 409 deletions

View File

@@ -4,101 +4,88 @@ using System.ComponentModel.DataAnnotations.Schema;
using DigitalData.Core.Abstractions.Interfaces;
using EnvelopeGenerator.Domain.Interfaces;
#if NETFRAMEWORK
#endif
namespace EnvelopeGenerator.Domain.Entities
#if NET
;
#elif NETFRAMEWORK
{
#endif
[Table("TBSIG_ENVELOPE_RECEIVER", Schema = "dbo")]
public class EnvelopeReceiver : IHasEnvelope, IHasReceiver, IEntity, IHasAddedWhen, IHasChangedWhen
{
public EnvelopeReceiver()
[Table("TBSIG_ENVELOPE_RECEIVER", Schema = "dbo")]
public class EnvelopeReceiver : IHasEnvelope, IHasReceiver, IEntity, IHasAddedWhen, IHasChangedWhen
{
public EnvelopeReceiver()
{
#if NETFRAMEWORK
CompanyName = string.Empty;
CompanyName = string.Empty;
#endif
}
}
[Column("ENVELOPE_ID")]
public int EnvelopeId { get; set; }
[Column("ENVELOPE_ID")]
public int EnvelopeId { get; set; }
[Column("RECEIVER_ID")]
public int ReceiverId { get; set; }
[Column("RECEIVER_ID")]
public int ReceiverId { get; set; }
[Required]
[Column("SEQUENCE")]
public int Sequence { get; set; }
[Required]
[Column("SEQUENCE")]
public int Sequence { get; set; }
[Column("NAME", TypeName = "nvarchar(128)")]
public string Name { get; set; }
[Column("NAME", TypeName = "nvarchar(128)")]
public string Name { get; set; }
[Column("JOB_TITLE", TypeName = "nvarchar(128)")]
public string JobTitle { get; set; }
[Column("JOB_TITLE", TypeName = "nvarchar(128)")]
public string JobTitle { get; set; }
[Column("COMPANY_NAME", TypeName = "nvarchar(128)")]
public string
[Column("COMPANY_NAME", TypeName = "nvarchar(128)")]
public string
#if nullable
?
?
#endif
CompanyName { get; set; }
CompanyName { get; set; }
[Column("PRIVATE_MESSAGE", TypeName = "nvarchar(max)")]
public string PrivateMessage { get; set; }
[Column("PRIVATE_MESSAGE", TypeName = "nvarchar(max)")]
public string PrivateMessage { get; set; }
[Column("ACCESS_CODE", TypeName = "nvarchar(64)")]
public string AccessCode { get; set; }
[Column("ACCESS_CODE", TypeName = "nvarchar(64)")]
public string AccessCode { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime? ChangedWhen { get; set; }
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime? ChangedWhen { get; set; }
[Column("PHONE_NUMBER")]
[StringLength(20)]
[RegularExpression(@"^\+[0-9]+$", ErrorMessage = "Phone number must start with '+' followed by digits.")]
public string PhoneNumber { get; set; }
[Column("PHONE_NUMBER")]
[StringLength(20)]
[RegularExpression(@"^\+[0-9]+$", ErrorMessage = "Phone number must start with '+' followed by digits.")]
public string PhoneNumber { get; set; }
[NotMapped]
public Tuple<int, int> Id => Tuple.Create(EnvelopeId, ReceiverId);
[NotMapped]
public Tuple<int, int> Id => Tuple.Create(EnvelopeId, ReceiverId);
[NotMapped]
public bool HasPhoneNumber => !string.IsNullOrWhiteSpace(PhoneNumber);
[NotMapped]
public bool HasPhoneNumber => !string.IsNullOrWhiteSpace(PhoneNumber);
[ForeignKey("EnvelopeId")]
public Envelope
[ForeignKey("EnvelopeId")]
public Envelope
#if nullable
?
?
#endif
Envelope { get; set; }
Envelope { get; set; }
[ForeignKey("ReceiverId")]
public Receiver
[ForeignKey("ReceiverId")]
public Receiver
#if nullable
?
?
#endif
Receiver { get; set; }
Receiver { get; set; }
#region Model of old serice
[NotMapped]
public Constants.ReceiverStatus Status { get; set; }
#region Model of old serice
[NotMapped]
public Constants.ReceiverStatus Status { get; set; }
[NotMapped]
public bool HasId => Id.Item1 > 0 && Id.Item2 > 0;
[NotMapped]
public bool HasId => Id.Item1 > 0 && Id.Item2 > 0;
[NotMapped]
public bool HasEmailAndName =>
!string.IsNullOrWhiteSpace(Receiver.EmailAddress) &&
!string.IsNullOrWhiteSpace(Name);
[NotMapped]
public bool HasEmailAndName =>
#endregion
}
#if NETFRAMEWORK
}
#endif
}