Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FaceLoginApp: BaseDatos.cs
using Microsoft.EntityFrameworkCore;
using Xamarin.Forms;
using FaceLoginApp.Modelos;
namespace FaceLoginApp.Datos
{
public class BaseDatos : DbContext
{
public DbSet<Usuario> Usuarios { get; set; }
private readonly string rutaBD;
public BaseDatos(string rutaBD)
{
this.rutaBD = rutaBD;
Database.EnsureCreated();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
var dbPath = DependencyService.Get<IBaseDatos>().GetDatabasePath();
optionsBuilder.UseSqlite($"Filename={dbPath}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.