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