Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is DbContext.Database.Migrate() method?

I'm meant to call this method at startup but it's not reference anywhere:

dbContext.Database.Migrate();

Type DatabaseFacade does not contain a definition for Migrate and no extension method Migrate of type DatabaseFacade could be found (are you missing a using directive or an assembly reference?

So which using / assembly am I missing?

like image 484
sinsedrix Avatar asked Nov 06 '22 07:11

sinsedrix


2 Answers

Adding Microsoft.EntityFrameworkCore.SqlServer via NuGet fixed the issue for me.

like image 86
Hamed Avatar answered Nov 15 '22 07:11

Hamed


Just import EntityFrameworkCore by typing the following at the top:

using Microsoft.EntityFrameworkCore;
like image 41
necimye Avatar answered Nov 15 '22 06:11

necimye