Skip to content

Instantly share code, notes, and snippets.

@mmilleruva
Created October 30, 2013 19:07
Show Gist options
  • Save mmilleruva/7238251 to your computer and use it in GitHub Desktop.
Save mmilleruva/7238251 to your computer and use it in GitHub Desktop.
public partial class OrdersContext : DbContext
{
static OrdersContext()
{
Database.SetInitializer<OrdersContext>(null);
}
public OrdersContext()
: base("Name=ToyContext")
{
}
public DbSet<Order> Orders { get; set; }
public DbSet<Person> Person { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new OrderMap());
modelBuilder.Configurations.Add(new PersonWithOrderMap());
}
}
public partial class PreferencesContext : DbContext
{
static PreferencesContext()
{
Database.SetInitializer<PreferencesContext>(null);
}
public PreferencesContext()
: base("Name=ToyContext")
{
}
public DbSet<Person> Person { get; set; }
public DbSet<Preference> Preferences { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new PersonWithPreferenceMap());
modelBuilder.Configurations.Add(new PreferenceMap());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment