SQLiteAsyncConnection ISqliteConnection.GetConnection() { var ConnectFuncion = new Func <SQLiteConnectionWithLock>(Connect); var conn = new SQLite.Net.Async.SQLiteAsyncConnection(ConnectFuncion); return(conn); }
// public SQLiteAsyncConnection GetConnection() // { //var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); //var path = Path.Combine(documentsPath, "MySQLite.db3"); //Console.WriteLine(path); //return new SQLiteAsyncConnection(path); //} public SQLite.Net.Async.SQLiteAsyncConnection GetConnection() { var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var path = Path.Combine(documentsPath, "MySQLite.db3"); var connectionString = new SQLite.Net.SQLiteConnectionString(path, false); var connectionWithLock = new SQLite.Net.SQLiteConnectionWithLock(new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(), connectionString); var connection = new SQLite.Net.Async.SQLiteAsyncConnection(() => connectionWithLock); return(connection); }
public SQLiteAsyncConnection GetConnection() { var sqliteFilename = "Mais.db3"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); // Create the connection var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var param = new SQLite.Net.SQLiteConnectionString(path, false); var conn = new SQLite.Net.Async.SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(plat, param)); // Return the database connection return conn; }