Update model

This commit is contained in:
2023-05-13 22:51:20 +02:00
parent f49f7534e9
commit 4d78cdd8a5
15 changed files with 121 additions and 33 deletions

View File

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace Elwig.Models {
@ -9,5 +10,11 @@ namespace Elwig.Models {
[Column("name")]
public string Name { get; private set; }
[InverseProperty("Gem")]
public virtual ISet<AT_Kg> Kgs { get; private set; }
[InverseProperty("AtGem")]
public virtual WbGem? WbGem { get; private set; }
}
}

View File

@ -15,5 +15,8 @@ namespace Elwig.Models {
[ForeignKey("Gkz")]
public virtual AT_Gem Gem { get; private set; }
[InverseProperty("AtKg")]
public virtual WbKg WbKg { get; private set; }
}
}

View File

@ -45,7 +45,7 @@ namespace Elwig.Models {
public string QualId { get; set; }
[ForeignKey("QualId")]
public virtual WineQual Quality { get; private set; }
public virtual WineQualLevel Quality { get; private set; }
[Column("hkid")]
public string HkId { get; set; }

19
Elwig/Models/WbGem.cs Normal file
View File

@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace Elwig.Models {
[Table("wb_gem"), PrimaryKey("Gkz")]
public class WbGem {
[Column("gkz")]
public int Gkz { get; private set; }
[Column("hkid")]
public string HkId { get; private set; }
[ForeignKey("Gkz")]
public virtual AT_Gem AtGem { get; private set; }
[ForeignKey("HkId")]
public virtual WineOrigin Origin { get; private set; }
}
}

17
Elwig/Models/WbGl.cs Normal file
View File

@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace Elwig.Models {
[Table("wb_gl"), PrimaryKey("GlNr")]
public class WbGl {
[Column("glnr")]
public int GlNr { get; private set; }
[Column("name")]
public string Name { get; private set; }
[InverseProperty("Gl")]
public virtual ISet<WbKg> Kgs { get; private set; }
}
}

View File

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace Elwig.Models {
@ -11,6 +12,18 @@ namespace Elwig.Models {
public int? GlNr { get; set; }
[ForeignKey("KgNr")]
public virtual AT_Kg Kg { get; private set; }
public virtual AT_Kg AtKg { get; private set; }
[ForeignKey("GlNr")]
public virtual WbGl Gl { get; private set; }
[InverseProperty("Kg")]
public virtual ISet<WbRd> Rds { get; private set; }
[NotMapped]
public WbGem Gem => AtKg.Gem.WbGem;
[NotMapped]
public WineOrigin Origin => Gem.Origin;
}
}

View File

@ -14,6 +14,6 @@ namespace Elwig.Models {
public string Name { get; set; }
[ForeignKey("KgNr")]
public virtual WbKg WbKg { get; private set; }
public virtual WbKg Kg { get; private set; }
}
}

View File

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace Elwig.Models {
@ -18,5 +19,8 @@ namespace Elwig.Models {
[Column("blnr")]
public int? BlNr { get; private set; }
[InverseProperty("Origin")]
public virtual ISet<WbGem> Gems { get; private set; }
}
}

View File

@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Elwig.Models {
[Table("wine_quality"), PrimaryKey("QualId")]
public class WineQual {
public class WineQualLevel {
[Column("qualid")]
public string QualId { get; private set; }