Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. public DbSet<Category> Categories { get; set; }
  2.  
  3. public ApplicationDbContext(): base("DefaultConnection", throwIfV1Schema: false)
  4. {
  5. }
  6.  
  7. public static ApplicationDbContext Create()
  8. {
  9. return new ApplicationDbContext();
  10. }
  11.  
  12. protected override void OnModelCreating(DbModelBuilder modelBuilder)
  13. {
  14. //Database.SetInitializer<ApplicationDbContext>(null);
  15. base.OnModelCreating(modelBuilder);
  16. }
  17.  
  18. var test = new Category { CategoryName = "test" }; --- This cant find Categories
  19.  
  20. context.Category.Add(test); ---This cant find Category
  21.  
  22.  
  23. context.SaveChanges();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement