I tried to create a rest api . when I try to change
services.AddDbContext<WebContext>(options =>
options.useSqlite(Configuration.GetConnectionString("WebContext")));
when I try to do this I get this error. I installed sqlite nuget.and also Microsoft.EntityFrameworkCore but I still got the problem
error CS1061: 'DbContextOptionsBuilder' does not contain a definition for 'UseSqlite' and no extension method 'UseSqlite' accepting a first argument of type 'DbContextOptionsBuilder' could be found (are you missing a using directive or an assembly reference?
Try:
using Microsoft.EntityFrameworkCore;
...
services.AddDbContext<WebContext>(options =>
options.UseSqlite(Configuration.GetConnectionString("WebContext")));
...
And you also need to install the Microsoft.EntityFrameworkCore.Sqlite
nuget package.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.