Models: Remove DeliveryPartAttr
This commit is contained in:
@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
using IndexAttribute = Microsoft.EntityFrameworkCore.IndexAttribute;
|
||||
|
||||
namespace Elwig.Models {
|
||||
[Table("area_commitment_type"), PrimaryKey("VtrgId"), Index("SortId", "AttrId1", "AttrId2", "Discriminator")]
|
||||
[Table("area_commitment_type"), PrimaryKey("VtrgId"), Index("SortId", "AttrId", "Discriminator")]
|
||||
public class AreaComType {
|
||||
[Column("vtrgid")]
|
||||
public string VtrgId { get; set; }
|
||||
@ -12,11 +12,8 @@ namespace Elwig.Models {
|
||||
[Column("sortid")]
|
||||
public string SortId { get; set; }
|
||||
|
||||
[Column("attrid_1")]
|
||||
public string? AttrId1 { get; set; }
|
||||
|
||||
[Column("attrid_2")]
|
||||
public string? AttrId2 { get; set; }
|
||||
[Column("attrid")]
|
||||
public string? AttrId { get; set; }
|
||||
|
||||
[Column("disc")]
|
||||
public string? Discriminator { get; set; }
|
||||
@ -39,14 +36,10 @@ namespace Elwig.Models {
|
||||
[ForeignKey("SortId")]
|
||||
public virtual WineVar WineVar { get; private set; }
|
||||
|
||||
[ForeignKey("AttrId1")]
|
||||
public virtual WineAttr? WineAttr1 { get; private set; }
|
||||
|
||||
[ForeignKey("AttrId2")]
|
||||
public virtual WineAttr? WineAttr2 { get; private set; }
|
||||
[ForeignKey("AttrId")]
|
||||
public virtual WineAttr? WineAttr { get; private set; }
|
||||
|
||||
[NotMapped]
|
||||
public string DisplayName => WineVar.Name + (WineAttr1 != null ? $" {WineAttr1.Name}" : "") +
|
||||
(WineAttr2 != null ? $" {WineAttr2.Name}" : "") + (Discriminator != null ? $" ({Discriminator})" : "");
|
||||
public string DisplayName => WineVar.Name + (WineAttr != null ? $" {WineAttr.Name}" : "") + (Discriminator != null ? $" ({Discriminator})" : "");
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,12 @@ namespace Elwig.Models {
|
||||
[ForeignKey("SortId")]
|
||||
public virtual WineVar Variant { get; private set; }
|
||||
|
||||
[Column("attrid")]
|
||||
public string? AttrId { get; set; }
|
||||
|
||||
[ForeignKey("AttrId")]
|
||||
public virtual WineAttr? Attribute { get; private set; }
|
||||
|
||||
[Column("weight")]
|
||||
public int Weight { get; set; }
|
||||
|
||||
@ -96,15 +102,6 @@ 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);
|
||||
|
||||
[NotMapped]
|
||||
public string AttributesString => string.Join(" / ", Attributes);
|
||||
|
||||
[InverseProperty("Part")]
|
||||
public virtual ISet<DeliveryPartModifier> PartModifiers { get; private set; }
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Elwig.Models {
|
||||
[Table("delivery_part_attribute"), PrimaryKey("Year", "DId", "DPNr", "AttrId")]
|
||||
public class DeliveryPartAttr {
|
||||
[Column("year")]
|
||||
public int Year { get; set; }
|
||||
|
||||
[Column("did")]
|
||||
public int DId { get; set; }
|
||||
|
||||
[Column("dpnr")]
|
||||
public int DPNr { get; set; }
|
||||
|
||||
[ForeignKey("Year, DId, DPNr")]
|
||||
public virtual DeliveryPart Part { get; private set; }
|
||||
|
||||
[Column("attrid")]
|
||||
public string AttrId { get; set; }
|
||||
|
||||
[ForeignKey("AttrId")]
|
||||
public virtual WineAttr Attr { get; private set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user