小编Rob*_*oli的帖子

只有实现IAsyncEnumerable的源才能用于Entity Framework异步操作

我正在使用EF 6.1.3和.NET Framework 4.6.1实现模型.此模型由ASPNET应用程序和ASPNET CORE应用程序使用,因此它使用System.Data.Entity,它位于单独的程序集mymodel.dll中.

这是模型

using System.Data.Entity;
public partial class MyDbContext : DbContext
{    
        public virtual DbSet<Athlete> Athletes{ get; set; }
}
public partial class Athlete
{
    public Athlete()
    {
    }
    //...
    public string Country { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我正在开发使用.NET Framework 4.6在aspnet核心中实现的MVC应用程序.它引用了EF 6.1.3,因此可以使用该模型.

public class MyViewModel
{
    public IList<Athlete> ItalianAthletes{ get; set; }
}

using Microsoft.EntityFrameworkCore;
//solution: comment the previous line and use instead System.Data.Entity;
public class MyController : Controller
{
    private readonly MyDbContext _context;
    //...
    public IActionResult …
Run Code Online (Sandbox Code Playgroud)

c# asynchronous entity-framework

15
推荐指数
2
解决办法
1万
查看次数

标签 统计

asynchronous ×1

c# ×1

entity-framework ×1