Array
(
[dirname] => .
[basename] => MMABooksContext.cs
[extension] => cs
[filename] => MMABooksContext
)
1. file=./MMABooksContext.cs
2. file=.//MMABooksContext.cs
3. file=MMABooksContext.cs
using System.Configuration;
using Microsoft.EntityFrameworkCore;
namespace CustomerMaintenance.Models.DataLayer;
public partial class MMABooksContext : DbContext
{
public MMABooksContext()
{
}
public MMABooksContext(DbContextOptions options)
: base(options)
{
}
public virtual DbSet Customers { get; set; }
public virtual DbSet Invoices { get; set; }
public virtual DbSet InvoiceLineItems { get; set; }
public virtual DbSet OrderOptions { get; set; }
public virtual DbSet Products { get; set; }
public virtual DbSet States { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder
.UseSqlServer(ConfigurationManager.ConnectionStrings["MMABooks"]
.ConnectionString);
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity(entity =>
{
entity.Property(e => e.Rowversion)
.IsRowVersion()
.IsConcurrencyToken();
entity.Property(e => e.State).IsFixedLength();
entity.Property(e => e.ZipCode).IsFixedLength();
entity.HasOne(d => d.StateNavigation).WithMany(p => p.Customers)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_Customers_States");
});
modelBuilder.Entity(entity =>
{
entity.HasOne(d => d.Customer).WithMany(p => p.Invoices).HasConstraintName("FK_Invoices_Customers");
});
modelBuilder.Entity(entity =>
{
entity.Property(e => e.ProductCode).IsFixedLength();
entity.HasOne(d => d.Invoice).WithMany(p => p.InvoiceLineItems).HasConstraintName("FK_InvoiceLineItems_Invoices");
entity.HasOne(d => d.ProductCodeNavigation).WithMany(p => p.InvoiceLineItems)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_InvoiceLineItems_Products");
});
modelBuilder.Entity(entity =>
{
entity.Property(e => e.ProductCode).IsFixedLength();
entity.Property(e => e.Rowversion)
.IsRowVersion()
.IsConcurrencyToken();
});
modelBuilder.Entity(entity =>
{
entity.Property(e => e.StateCode).IsFixedLength();
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}