Created
September 21, 2015 19:55
-
-
Save MayogaX/7ac6327e4e7498b8b5ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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