Models: Remove DeliveryPartAttr

This commit is contained in:
2023-10-31 22:21:24 +01:00
parent b1dad261d1
commit ad9f4d3a9a
12 changed files with 172 additions and 104 deletions

View File

@ -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})" : "");
}
}