类型或名称空间名称"Relational"在名称空间"Microsoft.EntityFrameworkCore"中不存在 [英] The type or namespace name 'Relational' does not exist in the namespace 'Microsoft.EntityFrameworkCore'

查看:127
本文介绍了类型或名称空间名称"Relational"在名称空间"Microsoft.EntityFrameworkCore"中不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VS 2017中的ASP.Net Core 1.1 Web应用程序中,我需要引用该软件包:
Microsoft.EntityFrameworkCore.Relational
(这是为了调用具有结果集的存储过程,如下所述:如何在Entity Framework Core中运行存储过程?)

In an ASP.Net Core 1.1 web application, in VS 2017, I need to reference the package:
Microsoft.EntityFrameworkCore.Relational
(this is in order to call stored procedures with result sets as described here: How to run stored procedures in Entity Framework Core?)

从PM控制台安装软件包时,请使用:

When installing the package from PM console, with:

Install-Package Microsoft.EntityFrameworkCore.Relational

我得到成功安装了'Microsoft.EntityFrameworkCore.Relational 1.1.2'"

I get "Successfully installed 'Microsoft.EntityFrameworkCore.Relational 1.1.2'"

但是当我添加以下行时:

But when I add the line:

using Microsoft.EntityFrameworkCore.Relational;

在文件顶部,单词"Relational"在下面带有红色花键,错误为:

at the top of the file, the word "Relational" has a red squiggle under with the error:

名称空间"Microsoft.EntityFrameworkCore"中不存在类型或名称空间名称"Relational"(您是否缺少程序集引用?)

The type or namespace name 'Relational' does not exist in the namespace 'Microsoft.EntityFrameworkCore' (are you missing an assembly reference?)

我将问题隔离为创建类型为"ASP.Net Core Web应用程序(.Net Framework)"的新项目,为空的ASP.Net Core 1.1项目选择模板,然后安装上述软件包.我仍然遇到相同的错误.
TIA

I isolated the problem to creating a new project of type "ASP.Net Core Web Application (.Net Framework)", selecting the template for an empty ASP.Net Core 1.1 project, then installing the above package. I still get the same error.
TIA

推荐答案

Microsoft.EntityFrameworkCore.Relational assembly .EF Core中没有这样的命名空间.

Microsoft.EntityFrameworkCore.Relational is assembly. There is no such namespace in EF Core.

FromSql 方法是在 Microsoft.EntityFrameworkCore 命名空间 RelationalQueryableExtensions 类中定义的,因此只需访问它即可典型

The FromSql method is defined in the Microsoft.EntityFrameworkCore namespace, RelationalQueryableExtensions class, so all you need to get access to it is the typical

using Microsoft.EntityFrameworkCore;

这篇关于类型或名称空间名称"Relational"在名称空间"Microsoft.EntityFrameworkCore"中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆