Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Adding multiple inherited instances of diferent children types in a TPT Mapping EF4.1
- public abstract class Person
- {
- public int Id {get;set;}
- }
- public class Customer : Person
- {
- public string Name {get;set;}
- }
- public class User : Person
- {
- public string Password {get;set;}
- }
- context.Set<Customer>().Add(new Customer { Name = "X" });
- context.SaveChanges();
- Persons
- Id: 1
- Customers
- Id: 1
- Name: X
- context.Set<Customer>().Add(new User { Id = 1, Password = "0" });
- context.SaveChanges();
Add Comment
Please, Sign In to add comment