forked from sanchezvem/PyroFetes
Migration added and updated
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,9 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace PyroFetes.Models;
|
namespace PyroFetes.Models;
|
||||||
|
|
||||||
|
[PrimaryKey(nameof(MaterialId), nameof(WarehouseId))]
|
||||||
public class MaterialWarehouse
|
public class MaterialWarehouse
|
||||||
{
|
{
|
||||||
[Required] public int MaterialId { get; set; }
|
[Required] public int MaterialId { get; set; }
|
||||||
|
@@ -77,5 +77,17 @@ public class PyroFetesDbContext : DbContext
|
|||||||
.WithMany(w => w.MovementsDestination)
|
.WithMany(w => w.MovementsDestination)
|
||||||
.HasForeignKey(m => m.DestinationWarehouseId)
|
.HasForeignKey(m => m.DestinationWarehouseId)
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
|
modelBuilder.Entity<MaterialWarehouse>()
|
||||||
|
.HasOne(mw => mw.Material)
|
||||||
|
.WithMany(m => m.MaterialWarehouses)
|
||||||
|
.HasForeignKey(mw => mw.MaterialId)
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
|
modelBuilder.Entity<MaterialWarehouse>()
|
||||||
|
.HasOne(mw => mw.Warehouse)
|
||||||
|
.WithMany(w => w.MaterialWarehouses)
|
||||||
|
.HasForeignKey(mw => mw.WarehouseId)
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user