Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Relationship Using Code first with Existing database
- public class Product
- {
- public int ProductId { get; set; }
- public string Name { get; set; }
- public Category Category { get; set; }
- }
- public class Category
- {
- public int CategoryId { get; set; }
- public string Name { get; set; }
- public ICollection<Product> Products { get; set; }
- }
- modelBuilder.Entity<Product>()
- .HasMany(x => x.Category)
Advertisement
Add Comment
Please, Sign In to add comment