public TodoItemDatabase(string dbPath) { var connectionString = "Data Source=" + dbPath; var options = new DataContextOptionsBuilder().UseSqlite(connectionString).Options; _dataContext = new TodoDataContext(options); _dataContext.Database.Creator.CreateIfNotExists(); }
public static TodoDataContext Create(string connectionString) { if (_dataContext == null) { var options = new DataContextOptionsBuilder().UseSqlite(connectionString).Options; _dataContext = new TodoDataContext(options); } return(_dataContext); }