Created
October 30, 2013 19:01
-
-
Save mmilleruva/7238142 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 PersonMap : EntityTypeConfiguration<Person> | |
{ | |
public PersonMap() | |
{ | |
this.ToTable("Person"); | |
} | |
} | |
public class PersonWithPreferenceMap : PersonMap | |
{ | |
public PersonWithPreferenceMap() | |
{ | |
// Primary Key | |
this.HasKey(t => t.UserName); | |
// Relationships | |
this.HasMany(t => t.Preferences) | |
.WithRequired() | |
.HasForeignKey(t => t.Username); | |
this.Ignore(t => t.Orders); | |
} | |
} | |
public class PersonWithOrderMap : PersonMap | |
{ | |
public PersonWithOrderMap() | |
{ | |
// Primary Key | |
this.HasKey(t => t.PersonId); | |
// Relationships | |
this.HasMany(t => t.Orders) | |
.WithRequired() | |
.HasForeignKey(t => t.PersonId); | |
this.Ignore(t => t.Preferences); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment