- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 mac os webapi 上使用 asp.net core 2.1 调用 View 或存储过程。
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;
}
出现以下错误
Error CS1061: 'DbSet' does not contain a definition for 'FromSql' and no extension method 'FromSql' accepting a first argument of type 'DbSet' could be found (are you missing a using directive or an assembly reference?) (CS1061)
我在 mac os 上使用 Entity Framework 开发 webapi。
研究以下链接中的一些查询:- Raw SQL Query without DbSet - Entity Framework Core
Raw SQL Query without DbSet - Entity Framework Core
但找不到错误解决方案。谁能告诉我我缺少什么。
最佳答案
安装Microsoft.EntityFrameworkCore.Relational
nuget包,然后在类中添加using语句
使用 Microsoft.EntityFrameworkCore;
关于c# - 错误 CS1061 : 'DbSet<T>' does not contain a definition for 'FromSql' and no extension method 'FromSql' accepting a first argument of type 'DbSet<T>' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51017703/
我是一名优秀的程序员,十分优秀!