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

@@ -9,85 +9,77 @@ using System.Linq;
#endif
namespace EnvelopeGenerator.Domain.Entities
#if NET
;
#elif NETFRAMEWORK
{
#endif
[Table("TBSIG_ENVELOPE_DOCUMENT", Schema = "dbo")]
public class Document : IHasEnvelope, IHasAddedWhen
{
public Document()
[Table("TBSIG_ENVELOPE_DOCUMENT", Schema = "dbo")]
public class Document : IHasEnvelope, IHasAddedWhen
{
public Document()
{
#if NETFRAMEWORK
Elements = Enumerable.Empty<Signature>().ToList();
Elements = Enumerable.Empty<Signature>().ToList();
#endif
}
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public int Id { get; set; }
[Required]
[Column("ENVELOPE_ID")]
public int EnvelopeId { get; set; }
#if NETFRAMEWORK
= 0;
#endif
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Column("BYTE_DATA", TypeName = "varbinary(max)")]
public byte[]
#if nullable
?
#endif
ByteData { get; set; }
#region File
[Column("FILENAME", TypeName = "nvarchar(256)")]
public string Filename { get; set; }
[Column("FILEPATH", TypeName = "nvarchar(256)")]
public string Filepath { get; set; }
[Column("FILENAME_ORIGINAL", TypeName = "nvarchar(256)")]
public string
#if nullable
?
#endif
FileNameOriginal { get; set; }
#endregion
public virtual List<Signature>
#if nullable
?
#endif
Elements { get; set; }
[ForeignKey("EnvelopeId")]
public virtual Envelope
#if nullable
?
#endif
Envelope { get; set; }
#if NETFRAMEWORK
[NotMapped]
public bool IsTempFile { get; set; }
[NotMapped]
public Bitmap Thumbnail { get; set; }
[NotMapped]
public int PageCount { get; set; }
#endif
}
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public int Id { get; set; }
[Required]
[Column("ENVELOPE_ID")]
public int EnvelopeId { get; set; }
#if NETFRAMEWORK
= 0;
#endif
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Column("BYTE_DATA", TypeName = "varbinary(max)")]
public byte[]
#if nullable
?
#endif
ByteData { get; set; }
#region File
[Column("FILENAME", TypeName = "nvarchar(256)")]
public string Filename { get; set; }
[Column("FILEPATH", TypeName = "nvarchar(256)")]
public string Filepath { get; set; }
[Column("FILENAME_ORIGINAL", TypeName = "nvarchar(256)")]
public string
#if nullable
?
#endif
FileNameOriginal { get; set; }
#endregion
public virtual List<Signature>
#if nullable
?
#endif
Elements { get; set; }
[ForeignKey("EnvelopeId")]
public virtual Envelope
#if nullable
?
#endif
Envelope { get; set; }
#if NETFRAMEWORK
[NotMapped]
public bool IsTempFile { get; set; }
[NotMapped]
public Bitmap Thumbnail { get; set; }
[NotMapped]
public int PageCount { get; set; }
#endif
}
#if NETFRAMEWORK
}
#endif
}