Update model database schema

This commit is contained in:
2023-04-16 15:08:15 +02:00
parent 0333e8a5c5
commit 6e0b59da4b
14 changed files with 232 additions and 72 deletions

39
Elwig/Models/AreaCom.cs Normal file
View File

@ -0,0 +1,39 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Elwig.Models {
[Table("area_commitment"), PrimaryKey("VNr")]
public class AreaCom {
[Column("vnr")]
public int VNr { get; set; }
[Column("area")]
public int Area { get; set; }
[Column("sortid")]
public string SortId { get; set; }
[Column("cultid")]
public string CultId { get; set; }
[ForeignKey("VNr")]
public virtual Contract Contract { get; private set; }
[ForeignKey("SortId")]
public virtual WineVar WineVar { get; private set; }
[ForeignKey("CultId")]
public virtual WineCult WineCult { get; private set; }
[InverseProperty("AreaCom")]
public virtual ISet<AreaComParcel> Parcels { get; private set; }
[InverseProperty("AreaCom")]
public virtual ISet<AreaComAttr> AttributeEntries { get; private set; }
[NotMapped]
public IEnumerable<WineAttr> Attributes => AttributeEntries.Select(e => e.WineAttr);
}
}