EF Core Beziehungskonfiguration für Envelope-Entität korrigiert

This commit is contained in:
Developer 02
2024-04-04 13:25:41 +02:00
parent 8de0d70e7b
commit 29ae546d98
29 changed files with 282 additions and 45 deletions

View File

@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using EnvelopeGenerator.Common.My.Resources;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities
@@ -9,7 +10,7 @@ namespace EnvelopeGenerator.Domain.Entities
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public int Guid { get; set; }
public int Id { get; set; }
[Required]
[Column("USER_ID")]
@@ -21,7 +22,7 @@ namespace EnvelopeGenerator.Domain.Entities
[Required]
[Column("ENVELOPE_UUID", TypeName = "nvarchar(36)")]
public string EnvelopeUuid { get; set; }
public string Uuid { get; set; }
[Required]
[Column("MESSAGE", TypeName = "nvarchar(max)")]
@@ -59,7 +60,7 @@ namespace EnvelopeGenerator.Domain.Entities
public int? ReminderIntervalDays { get; set; }
[Column("ENVELOPE_TYPE")]
public int? EnvelopeType { get; set; }
public int? EnvelopeTypeId { get; set; }
[Column("CERTIFICATION_TYPE")]
public int? CertificationType { get; set; }
@@ -82,5 +83,36 @@ namespace EnvelopeGenerator.Domain.Entities
[Required]
[Column("DMZ_MOVED")]
public bool DmzMoved { get; set; }
[ForeignKey("UserId")]
public Receiver? User { get; set; }
[ForeignKey("EnvelopeTypeId")]
public EnvelopeType? EnvelopeType { get; set; }
[NotMapped]
public string? EnvelopeTypeTitle => EnvelopeType?.Title;
[NotMapped]
public bool IsAlreadySent => Status > (int) Constants.EnvelopeStatus.EnvelopeSaved;
[NotMapped]
public string? StatusTranslated => Model.ResourceManager.GetString(Status.ToString());
[NotMapped]
public string? ContractTypeTranslated
{
get
{
string? oContractType = ContractType.ToString();
return oContractType is null ? default : Model.ResourceManager.GetString(oContractType);
}
}
public ICollection<EnvelopeDocument>? Documents { get; set; }
public ICollection<EnvelopeReceiver>? Receivers { get; set; }
public ICollection<EnvelopeHistory>? History { get; set; }
}
}
}