首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >错误CS1061:'DbSet<T>‘不包含'FromSql’的定义,并且没有扩展方法'FromSql‘接受类型为'DbSet<T>’的第一个参数

错误CS1061:'DbSet<T>‘不包含'FromSql’的定义,并且没有扩展方法'FromSql‘接受类型为'DbSet<T>’的第一个参数
EN

Stack Overflow用户
提问于 2018-06-25 14:48:18
回答 6查看 18.1K关注 0票数 14

我正尝试在mac os webapi上使用asp.net core 2.1调用视图或存储过程。

代码语言:javascript
复制
using System;
using System.Linq;
using Auth.Database;
using Microsoft.EntityFrameworkCore;

public virtual IQueryable<T> ExecuteStoreProcView(string viewProcName)
{
    IQueryable<T> queryResult = _entities.Set<T>().FromSql(viewProcName).AsQueryable();
    return queryResult;
}

获取以下错误

错误CS1061:“”DbSet“”不包含“”FromSql“”的定义,并且找不到接受“”DbSet“”类型的第一个参数的扩展方法“”FromSql“”(是否缺少using指令或程序集引用?)“(CS1061)

我正在使用mac os上的实体框架开发webapi。

研究以下链接中的一些查询:- Raw SQL Query without DbSet - Entity Framework Core

Raw SQL Query without DbSet - Entity Framework Core

https://forums.asp.net/t/1886501.aspx?System+Data+Entity+DbSet+Entities+User+does+not+contain+a+definition+for+FirstOrDefault+

https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.relationalqueryableextensions.fromsql?view=efcore-2.1

但是不能找到错误的解决方案。有谁能让我知道我错过了什么。

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51017703

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档