EntityTypeBuilder does not contain a definition for ToTable in EF Core

前端 未结 12 1459
南笙
南笙 2021-02-06 20:22

I have this sample code:

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Models;

namespace MySampleNamespace
{         


        
12条回答
  •  温柔的废话
    2021-02-06 20:39

    Ivan & Mardoxx are correct.

    I tried to just install Microsoft.EntityFrameworkCore.Tools then got this error:

    Detected package downgrade: Microsoft.EntityFrameworkCore from 2.1.4 to 2.1.1. Reference the package directly from the project to select a different version. -> Microsoft.EntityFrameworkCore.Tools 2.1.4 -> Microsoft.EntityFrameworkCore.Design 2.1.4 -> Microsoft.EntityFrameworkCore.Relational 2.1.4 -> Microsoft.EntityFrameworkCore (>= 2.1.4) -> Microsoft.EntityFrameworkCore (>= 2.1.1)

    1. I upgraded Microsoft.EntityFrameworkCore via nuget
    2. I did install Microsoft.EntityFrameworkCore.Tools which didn't work for ToTable , unknown if this is even needed
    3. I did then install the Microsoft.EntityFrameworkCore.Relational and it now resolves

提交回复
热议问题