Update models

This commit is contained in:
2023-04-28 13:01:43 +02:00
parent 351a0b8d57
commit 3f11a498bc
6 changed files with 82 additions and 3 deletions

View File

@ -1,6 +1,8 @@
using Elwig.Helpers;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Elwig.Models {
[Table("delivery_part"), PrimaryKey("Year", "DId", "DPNr")]
@ -92,5 +94,17 @@ namespace Elwig.Models {
[Column("comment")]
public string? Comment { get; set; }
[InverseProperty("Part")]
public virtual ISet<DeliveryPartAttr> PartAttributes { get; private set; }
[NotMapped]
public IEnumerable<WineAttr> Attributes => PartAttributes.Select(a => a.Attr);
[InverseProperty("Part")]
public virtual ISet<DeliveryPartModifier> PartModifiers { get; private set; }
[NotMapped]
public IEnumerable<Modifier> Modifiiers => PartModifiers.Select(m => m.Modifier);
}
}