Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UseSqlServer missing from AddDbContext

Just upgraded to asp.net core 2.1 and it seems like UseSqlServer no longer exists in the options for AddDbContext. (where I pass in the connectionstring)

What am I supposed to use instead?

like image 588
SteinTheRuler Avatar asked Jul 02 '18 14:07

SteinTheRuler


Video Answer


2 Answers

Added nuget package Microsoft.EntityFrameworkCore.SqlServer and it worked again

like image 107
SteinTheRuler Avatar answered Oct 24 '22 22:10

SteinTheRuler


You must add

using Microsoft.EntityFrameworkCore;

as explained in https://social.msdn.microsoft.com/Forums/en-US/f9cdb8de-0c4c-47ae-b0be-e4b52a887183/dbcontextoptionsbuilder-does-not-contain-a-definition-for-usesqlserver?forum=adodotnetentityframework

like image 23
Vladimir Fedonov Avatar answered Oct 24 '22 21:10

Vladimir Fedonov