C#C
C#2y ago
Ares

how can i fix this error?

hey so I have a asp.net core mvc app and for some reason suddenly it doesnt want to run anymore. it builds just fine but when i try to run it i get:

MissingMethodException: Method not found: 'Microsoft.EntityFrameworkCore.Storage.CoreTypeMapping Microsoft.EntityFrameworkCore.Storage.TypeMappingSourceBase.FindMapping(System.Type, Microsoft.EntityFrameworkCore.Metadata.IModel)'.

It says that it happens in my DbContext:


using Microsoft.EntityFrameworkCore;

namespace realTimePolls.Models
{
    public class RealTimePollsContext : DbContext
    {
        public RealTimePollsContext(DbContextOptions<RealTimePollsContext> options)
            **: base(options) { }** <-- Error is here

        public DbSet<Poll> Polls { get; set; }
        public DbSet<User> User { get; set; }

        public DbSet<UserPoll> UserPoll { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Poll>().ToTable("poll"); // Maps the Poll entity to the "poll" table
            modelBuilder.Entity<User>().ToTable("user"); // Maps the User entity to the "user" table
            modelBuilder.Entity<UserPoll>().ToTable("userpoll"); // Maps the User entity to the "user" table
        }
    }
}


I dont get why its not working, ive tried:

Completely changing my project structure

Deleting solution file and making a new one

Cleaning solution

Rebuilding

Reinstalling all packages

nothing seems to fix it. any advice? here is my repo: https://github.com/ForkEyeee/realtime-poll
7t348xvgz3gc1.png
Was this page helpful?