Skip to content

Instantly share code, notes, and snippets.

@MayogaX
Created September 21, 2015 19:55
Show Gist options
  • Save MayogaX/7ac6327e4e7498b8b5ee to your computer and use it in GitHub Desktop.
Save MayogaX/7ac6327e4e7498b8b5ee to your computer and use it in GitHub Desktop.
public class JogadoresContext:DbContext
{
public DbSet Artilheiros { get; set; }
public DbSet Goleiros { get; set; }
public JogadoresContext()
{
Database.SetInitializer(new DropCreateDatabaseAlways());
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove();
modelBuilder.Entity().Map(m =>
{
m.MapInheritedProperties();
m.ToTable("Artilheiros");
});
modelBuilder.Entity().Map(m =>
{
m.MapInheritedProperties();
m.ToTable("Goleiros");
});
base.OnModelCreating(modelBuilder);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment