fließende API
public class OfficeContext: DbContext
{
public virtual DbSet<Course> Courses { get; set; }
public virtual DbSet<Enrollment> Enrollments { get; set; }
public virtual DbSet<Student> Students { get; set; }
public virtual DbSet<Worker> Workers { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
//Write Fluent API configurations here
//some example of fluent api
//Configure default schema
modelBuilder.HasDefaultSchema("Admin");
//Map entity to table
modelBuilder.Entity<Student>().ToTable("StudentsInfo");
modelBuilder.Entity<Course>().ToTable("CoursesInfo");
modelBuilder.Entity<Enrollment>().ToTable("EnrollmentsInfo");
modelBuilder.Entity<Enrollment>().ToTable("WorkersInfo");
}
}
Debmalya Banerjee