Skip to content

Commit

Permalink
fix: Fix EF validation runtime warnings (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
akak1977 authored Oct 6, 2022
1 parent 41464c1 commit 4b4e106
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace VirtoCommerce.InventoryModule.Data.Repositories
{
public class InventoryDbContext : DbContextWithTriggers
{
#pragma warning disable S109
public InventoryDbContext(DbContextOptions<InventoryDbContext> options)
: base(options)
{
Expand All @@ -24,11 +25,17 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity<InventoryEntity>().HasOne(x => x.FulfillmentCenter).WithMany()
.HasForeignKey(x => x.FulfillmentCenterId).IsRequired()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<InventoryEntity>().Property(x => x.BackorderQuantity).HasPrecision(18, 2);
modelBuilder.Entity<InventoryEntity>().Property(x => x.InStockQuantity).HasPrecision(18, 2);
modelBuilder.Entity<InventoryEntity>().Property(x => x.PreorderQuantity).HasPrecision(18, 2);
modelBuilder.Entity<InventoryEntity>().Property(x => x.ReorderMinQuantity).HasPrecision(18, 2);
modelBuilder.Entity<InventoryEntity>().Property(x => x.ReservedQuantity).HasPrecision(18, 2);

modelBuilder.Entity<FulfillmentCenterEntity>().ToTable("FulfillmentCenter").HasKey(x => x.Id);
modelBuilder.Entity<FulfillmentCenterEntity>().Property(x => x.Id).HasMaxLength(128).ValueGeneratedOnAdd();

base.OnModelCreating(modelBuilder);
}
#pragma warning restore S109
}
}

0 comments on commit 4b4e106

Please sign in to comment.