I'm new to UWP and I'm trying to set up my project to use SQLite database, I'm making use of the Microsoft.EntityFrameworkCore.SQLite.
When I try to set up the database context, I keep getting this error.
DbContextOptionsBuilder does not contain definition for UseSqlite and no accessible extension method accepting a first argument of type DBcontextoptionsbuilder could be found (are you using directive or assembly reference)
Here's my code
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BradamaInternationalSkill.Models
{
/// <summary>
/// The Entity Framework Database Context.
/// </summary>
public class PersonContext : DbContext
{
internal DbSet<Person> People { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite("Filename=People.db");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// Make Id required.
modelBuilder.Entity<Person>()
.Property(p => p.Id)
.IsRequired();
// Make Name required.
modelBuilder.Entity<Person>()
.Property(p => p.Name)
.IsRequired();
}
}
}