Migration to DevOps
This commit is contained in:
33
PartSource.Data/Contexts/FitmentContext.cs
Normal file
33
PartSource.Data/Contexts/FitmentContext.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using PartSource.Data.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace PartSource.Data.Contexts
|
||||
{
|
||||
public class FitmentContext : DbContext
|
||||
{
|
||||
public FitmentContext(DbContextOptions<FitmentContext> contextOptions) : base(contextOptions) { }
|
||||
|
||||
public DbSet<DcfMapping> DcfMappings { get; set; }
|
||||
|
||||
public DbSet<Fitment> Fitments { get; set; }
|
||||
|
||||
public DbSet<Vehicle> Vehicles { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
modelBuilder.Entity<DcfMapping>().HasKey(d => new { d.LineCode, d.WhiCode });
|
||||
modelBuilder.Entity<Fitment>().HasKey(f => new { f.BaseVehicleId, f.EngineConfigId, f.LineCode, f.PartNumber });
|
||||
|
||||
foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes())
|
||||
{
|
||||
entityType.Relational().TableName = entityType.ClrType.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user