Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Installed Microsoft.EntityFrameworkCore.Sqlite nugets pack
- // appsetting.json change connection string to sqlite
- "ConnectionStrings": {
- //"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-App-E89CAB16-C51C-4FB1-8EAD-B43F5E23C63E;Trusted_Connection=True;MultipleActiveResultSets=true"
- "Sqlite": "Database.db"
- },
- // Startup.css method ConfigureServives method
- services.AddDbContext<ApplicationDbContext>(options =>
- options.UseSqlite(
- Configuration.GetConnectionString("Sqlite")));
- // DbContext class extended class, overrice OnConfiguring method
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- optionsBuilder.UseSqlite("Filename=Database.db");
- }
Add Comment
Please, Sign In to add comment