fix ForeignKey constraints in DB models
This commit is contained in:
parent
d427de2200
commit
48e52db40e
@ -21,9 +21,12 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public string Category { get; private set; } = string.Empty;
|
public string Category { get; private set; } = string.Empty;
|
||||||
|
|
||||||
[ForeignKey("ComponentId")]
|
[ForeignKey("AssemblyId")]
|
||||||
public virtual List<AssemblyComponent> Components { get; set; } = new();
|
public virtual List<AssemblyComponent> Components { get; set; } = new();
|
||||||
|
|
||||||
|
[ForeignKey("AssemblyId")]
|
||||||
|
public virtual List<Request> Requests { get; set; } = new();
|
||||||
|
|
||||||
private Dictionary<int, (IComponentModel, int)>? _assemblyComponents;
|
private Dictionary<int, (IComponentModel, int)>? _assemblyComponents;
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
|
@ -19,6 +19,9 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public double Cost { get; private set; }
|
public double Cost { get; private set; }
|
||||||
|
|
||||||
|
[ForeignKey("ComponentId")]
|
||||||
|
public virtual List<ProductComponent> ProductComponents { get; set; } = new();
|
||||||
|
|
||||||
[ForeignKey("ComponentId")]
|
[ForeignKey("ComponentId")]
|
||||||
public virtual List<AssemblyComponent> AssemblyComponents { get; set; } = new();
|
public virtual List<AssemblyComponent> AssemblyComponents { get; set; } = new();
|
||||||
|
|
||||||
|
@ -23,7 +23,9 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
|
|
||||||
public int? ShipmentId { get; set; }
|
public int? ShipmentId { get; set; }
|
||||||
|
|
||||||
[ForeignKey("ComponentId")]
|
public virtual Shipment? Shipment { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("ProductId")]
|
||||||
public virtual List<ProductComponent> Components { get; set; } = new();
|
public virtual List<ProductComponent> Components { get; set; } = new();
|
||||||
|
|
||||||
private Dictionary<int, (IComponentModel, int)>? _productComponents;
|
private Dictionary<int, (IComponentModel, int)>? _productComponents;
|
||||||
|
Loading…
Reference in New Issue
Block a user