Cannot resolve symbol 'ToTable' EF Core 2.2.0

Viewed 2854

I updated my dependencies as follow, in a dot net core app and looks like something got changed in ef libraries because to table is no longer resolved under modelBuilder.Entity<MyEntity>.ToTable('EntityTable');

Libs updated (from git track)

-<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.4"/>
-<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.4"/>
-<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.4"/>
-<PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3"/>
++<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" />
++<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.0" />
++<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" />
++<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.0" />
++<PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3" />

As I updated them one by one, the issue appeared after those 2 (any of those, when updated, both caused the errors in the DbContext)

<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.0" />

As an attempt to fix I installed Microsoft.EntityFrameworkCore.Relational as well, but it did not fix it.

My context looks as follows:

using Itb.Database.Entities;
using Microsoft.EntityFrameworkCore;

namespace Itb.Database.Context
{
    public class MyDbContext : DbContext
    {
        public MyDbContext(DbContextOptions options) : base(options)
        {
        }
        public DbSet<ApprovedMember> ApprovedMembers { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Entity<ApprovedMember>().ToTable("ApprovedMember");
        }
    }
}

I have dotnet --version = 2.2.101 (latest so far)

Hope you can help me to fix this :)

Thanks!

Deps as resolved deps Deps from proj

1 Answers

ToTable is under Microsoft Entity Framework Core Relational Assembly. you need to install Microsoft.EntityFrameworkCore.Relational

Reference

Related