Guest User

Untitled

a guest
Jun 2nd, 2012
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. Relationship Using Code first with Existing database
  2. public class Product
  3. {
  4. public int ProductId { get; set; }
  5. public string Name { get; set; }
  6. public Category Category { get; set; }
  7. }
  8.  
  9. public class Category
  10. {
  11. public int CategoryId { get; set; }
  12. public string Name { get; set; }
  13. public ICollection<Product> Products { get; set; }
  14. }
  15.  
  16. modelBuilder.Entity<Product>()
  17. .HasMany(x => x.Category)
Advertisement
Add Comment
Please, Sign In to add comment