yes, previously we uses EF-Code first classes then we mapping between the POCO classes in code-first model
but using Fluent -API automatics this connvation. which will minizes coding
public class Conn : DbContext
{
public DbSet<Employee> emps { get; set; }
public DbSet<Departments> dept{ get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
// modelBuilder.Entity<Employee>() //.HasRequired(a => a.Dept)
//.WithMany()
//.HasForeignKey(u => u.Eaddress);
//modelBuilder.Entity<Employee>().
// base.OnModelCreating(modelBuilder);
// or
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
}
Reference : http://msdn.microsoft.com/en-us/data/jj591620
No comments:
Post a Comment