无法在beta5中覆盖OnConfiguring - 找不到合适的方法来覆盖

问题描述:

从Beta4将EF7更新为beta5后,我的OnConfiguring停止工作。无法在beta5中覆盖OnConfiguring - 找不到合适的方法来覆盖

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) 

我不明白我需要写什么。

这里是我的project.json,以防万一

{ 
    "dependencies": { 
     "EntityFramework.SqlServer": "7.0.0-beta5", 
     "EntityFramework.Commands": "7.0.0-beta5", 
     ... 
    } 
} 

它不具备 “的EntityFramework”: “7.0.0-BETA4”(无beta5的还)。它显然不是必需的。

DNVM列表

Active Version   Runtime Architecture Location      Alias 
------ -------   ------- ------------ --------      ----- 
     1.0.0-beta4  clr  x64   C:\Users\Snebjorn\.dnx\runtimes 
     1.0.0-beta4  clr  x86   C:\Users\Snebjorn\.dnx\runtimes 
     1.0.0-beta4  coreclr x64   C:\Users\Snebjorn\.dnx\runtimes 
     1.0.0-beta4  coreclr x86   C:\Users\Snebjorn\.dnx\runtimes 
    * 1.0.0-beta5  clr  x86   C:\Users\Snebjorn\.dnx\runtimes default 
     1.0.0-beta5-12103 clr  x86   C:\Users\Snebjorn\.dnx\runtimes 

你需要在测试5使用EntityOptionsBuilder添加(和回DbContextOptionsBuilder处于测试阶段6)

无法获取OnConfiguring工作。

但是现在这个工程

public class Startup 
{ 
    public void ConfigureServices(IServiceCollection services) 
    { 
     services.AddEntityFramework() 
      .AddSqlServer() 
      .AddDbContext<ApplicationDbContext>(opt => opt.UseSqlServer("...")); 
    } 
} 

它没有BETA4。

注意:记住using Microsoft.Data.Entity;

如果您正在使用EF 7.0.0-β7的方法签名看起来正是如此:

protected internal virtual void OnConfiguring(DbContextOptions options);