无法在我的 asp.net mvc4 + entity framework 5 中引用 ToListAsync()
can not reference ToListAsync() inside my asp.net mvc4 + entity framework 5
我正在开发一个 asp.net mvc4 网络应用程序 + Entity framework 5。我正在尝试按如下方式引用 ToListAsync():-
var tservers = await t.TServers.Include(a => a.Technology.TechnologyIPs).Include(a => a.TVirtualMachines.Select(a2 => a2.Technology))
.Where(
a2 => (!singlescan && String.IsNullOrEmpty(FQDN) && a2.TechnologyRole.Name.ToLower() == "hypervisor")
||
(singlescan && !String.IsNullOrEmpty(FQDN) && a2.Technology.IT360ID == it360id)
).ToListAsync();
但我一直收到以下错误:-
Error 10 'System.Linq.IQueryable<**.Models.**>' does not contain a definition for 'ToListAsync' and no extension method 'ToListAsync' accepting a first argument of type 'System.Linq.IQueryable<**.Models.***>' could be found (are you missing a using directive or an assembly reference?) C****\Repository.cs 181 22 Scanning
我在 class:
中包含了这些参考资料
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.Data;
using System.Data.Objects.SqlClient;
using System.Data.Entity.Infrastructure;
using T.ViewModels;
using System.DirectoryServices.AccountManagement;
using System.Security.Principal;
using System.DirectoryServices;
using System.Linq.Expressions;
using System.Data.Objects;
using System.Linq.Dynamic;
using System.Configuration;
using System.Threading.Tasks;
到底是什么问题? ToListAsync() 在 EF 5 中可用吗?
没有。不是。它是在 EF6 中添加的。
我正在开发一个 asp.net mvc4 网络应用程序 + Entity framework 5。我正在尝试按如下方式引用 ToListAsync():-
var tservers = await t.TServers.Include(a => a.Technology.TechnologyIPs).Include(a => a.TVirtualMachines.Select(a2 => a2.Technology))
.Where(
a2 => (!singlescan && String.IsNullOrEmpty(FQDN) && a2.TechnologyRole.Name.ToLower() == "hypervisor")
||
(singlescan && !String.IsNullOrEmpty(FQDN) && a2.Technology.IT360ID == it360id)
).ToListAsync();
但我一直收到以下错误:-
Error 10 'System.Linq.IQueryable<**.Models.**>' does not contain a definition for 'ToListAsync' and no extension method 'ToListAsync' accepting a first argument of type 'System.Linq.IQueryable<**.Models.***>' could be found (are you missing a using directive or an assembly reference?) C****\Repository.cs 181 22 Scanning
我在 class:
中包含了这些参考资料using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.Data;
using System.Data.Objects.SqlClient;
using System.Data.Entity.Infrastructure;
using T.ViewModels;
using System.DirectoryServices.AccountManagement;
using System.Security.Principal;
using System.DirectoryServices;
using System.Linq.Expressions;
using System.Data.Objects;
using System.Linq.Dynamic;
using System.Configuration;
using System.Threading.Tasks;
到底是什么问题? ToListAsync() 在 EF 5 中可用吗?
没有。不是。它是在 EF6 中添加的。