DevKriya
DevKriya

Reputation: 79

ApplicationDbContext.OnModelCreating(ModelBuilder): no suitable method found to override

I am trying to use code first migration approach(genrate database from code). but facing error. here is my code

using Microsoft.AspNet.Identity.EntityFramework;

namespace IMChatApp.Models
{
    // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
    public class ApplicationUser : IdentityUser
    {
    }

    public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
    {
        public ApplicationDbContext()
            : base("DefaultConnection")
        {
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.IncludeMetadataInDatabase = false;
        }
        public System.Data.Entity.DbSet<JustDoIt.Models.user> users { get; set; }
    }
}

Upvotes: 0

Views: 4151

Answers (1)

Rob Hill
Rob Hill

Reputation: 371

According to the documentation, the OnModelCreating method takes a DbModelBuilder, not a ModelBuilder.

Upvotes: 1

Related Questions