ASP.NET MVC
using System.Data.Entity;
public class ProfileContext : DbContext
{
public ProfileContext() : base("ProfileConnectionString")
{
}
public DbSet<Profile> Profiles { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Profile>().ToTable("Profile");
}
}
ASP.NET Core MVC
using Microsoft.EntityFrameworkCore;
public class ProfileContext : DbContext
{
public ProfileContext(DbContextOptions<ProfileContext> options) : base(options)
{
}
public DbSet<Profile> Profiles { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Profile>().ToTable("Profile");
}
}
No comments:
Post a Comment