我在一个点网核心应用程序中更新了我的依赖关系,并发现ef库中发生了一些更改,因为在modelBuilder.Entity<MyEntity>.ToTable('EntityTable');
下不再解析表。
库已更新(来自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" />
当我一个接一个地更新它们时,问题出现在这两个之后(更新后的任何一个都在DbContext中引起了错误)
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.0" />
为修复此问题,我还安装了Microsoft.EntityFrameworkCore.Relational,但没有修复。
我的上下文如下:
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");
}
}
}
我有dotnet --version = 2.2.101(到目前为止)
希望您能帮助我解决这个问题:)
谢谢!
以已分解的副词的形式 Deps from proj
答案 0 :(得分:0)
ToTable
在Microsoft Entity Framework核心关系组装中。您需要安装Microsoft.EntityFrameworkCore.Relational