Adust AreaComAdminWindow to new db schema

This commit is contained in:
2023-08-23 15:45:59 +02:00
parent 85e4ccd215
commit cfa1f1eeea
9 changed files with 133 additions and 146 deletions

View File

@ -1,7 +1,5 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Elwig.Models {
[Table("area_commitment"), PrimaryKey("FbNr")]
@ -12,8 +10,8 @@ namespace Elwig.Models {
[Column("mgnr")]
public int MgNr { get; set; }
[Column("sortid")]
public string SortId { get; set; }
[Column("vtrgid")]
public string VtrgId { get; set; }
[Column("cultid")]
public string CultId { get; set; }
@ -42,8 +40,8 @@ namespace Elwig.Models {
[ForeignKey("MgNr")]
public virtual Member Member { get; private set; }
[ForeignKey("SortId")]
public virtual WineVar WineVar { get; private set; }
[ForeignKey("VtrgId")]
public virtual AreaComType AreaComType { get; private set; }
[ForeignKey("CultId")]
public virtual WineCult WineCult { get; private set; }
@ -53,11 +51,5 @@ namespace Elwig.Models {
[ForeignKey("KgNr, RdNr")]
public virtual WbRd? Rd { get; private set; }
[InverseProperty("AreaCom")]
public virtual ISet<AreaComAttr> AttributeEntries { get; private set; }
[NotMapped]
public IEnumerable<WineAttr> Attributes => AttributeEntries.Select(e => e.WineAttr);
}
}