Entities: Use 'required' and '= null!' to get rid of warnings

This commit is contained in:
2024-02-29 15:48:09 +01:00
parent 53a25b3be4
commit f922388db9
40 changed files with 142 additions and 155 deletions

View File

@ -16,7 +16,7 @@ namespace Elwig.Models.Entities {
public int DId { get; set; }
[Column("date")]
public string DateString { get; set; }
public required string DateString { get; set; }
[NotMapped]
public DateOnly Date {
@ -43,31 +43,31 @@ namespace Elwig.Models.Entities {
}
[Column("zwstid")]
public string ZwstId { get; set; }
public required string ZwstId { get; set; }
[ForeignKey("ZwstId")]
public virtual Branch Branch { get; private set; }
public virtual Branch Branch { get; private set; } = null!;
[Column("lnr")]
public int LNr { get; set; }
[Column("lsnr")]
public string LsNr { get; set; }
public required string LsNr { get; set; }
[Column("mgnr")]
public int MgNr { get; set; }
[ForeignKey("MgNr")]
public virtual Member Member { get; private set; }
public virtual Member Member { get; private set; } = null!;
[Column("comment")]
public string? Comment { get; set; }
[ForeignKey("Year")]
public virtual Season Season { get; private set; }
public virtual Season Season { get; private set; } = null!;
[InverseProperty("Delivery")]
public virtual ISet<DeliveryPart> Parts { get; private set; }
public virtual ISet<DeliveryPart> Parts { get; private set; } = null!;
[NotMapped]
public IEnumerable<DeliveryPart> FilteredParts => PartFilter == null ? Parts : Parts.Where(p => PartFilter(p));