3
votes

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?)

When installing the package from PM console, with:

Install-Package Microsoft.EntityFrameworkCore.Relational

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

But when I add the line:

using Microsoft.EntityFrameworkCore.Relational;

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

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

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

1

1 Answers

4
votes

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

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;