Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UseSqlServer method missing MVC 6

I am trying to implement Entity Framework 7 in MVC 6, and on this page here it says to do

services.AddEntityFramework()     .AddSqlServer()     .AddDbContext<MusicStoreContext>(options =>                         options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"])); 

But for me, the UseSqlServer method isn't visible? Anyone know how to make it visible? Or is this an old way of configuring entity framework?

My startup.cs file looks like this

using FluentValidation; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Hosting; using Microsoft.Framework.ConfigurationModel; using Microsoft.Framework.DependencyInjection;  namespace me.namespace.project {     public class Startup     {         public static IConfiguration Configuration { get; set; }          public Startup(IHostingEnvironment env)         {             // Setup configuration sources.             Configuration = new Configuration()                 .AddJsonFile("config.json")                 .AddEnvironmentVariables();         }          public void ConfigureServices(IServiceCollection services)         {             services.AddMvc();              // entity framework             services.AddEntityFramework()                 .AddSqlServer()                 .AddDbContext<DataContext>();          }     } } 
like image 849
Gillardo Avatar asked Oct 11 '15 10:10

Gillardo


1 Answers

Install Microsoft.EntityFrameworkCore.SqlServer 1.0.1 package works for me Version of Microsoft.EntityFrameworkCore is 1.1.0

like image 179
Timur Lemeshko Avatar answered Sep 20 '22 08:09

Timur Lemeshko