Skip to content

Instantly share code, notes, and snippets.

@mmilleruva
Created October 30, 2013 18:58
Show Gist options
  • Save mmilleruva/7238100 to your computer and use it in GitHub Desktop.
Save mmilleruva/7238100 to your computer and use it in GitHub Desktop.
public class PersonMap : EntityTypeConfiguration
{
public PersonMap()
{
// Primary Key
this.HasKey(t => t.PersonId);
this.ToTable("Person");
// Relationships
this.HasMany(t => t.Orders)
.WithRequired()
.HasForeignKey(t => t.PersonId);
this.Ignore(t => t.Preferences);
}
}
public class OrderMap : EntityTypeConfiguration
{
public OrderMap()
{
// Primary Key
this.HasKey(t => t.OrderId);
}
}
public class PreferenceMap : EntityTypeConfiguration
{
public PreferenceMap()
{
// Primary Key
this.HasKey(t => t.PreferenceId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment