예제 #1
0
		public SQLite.Net.Async.SQLiteAsyncConnection GetConnection()
		{
			const string sqliteFilename = "Mais.db3";  
			string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
			var path = Path.Combine(documentsPath, sqliteFilename);

			// Cria a conexão
			var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid();
			var param = new SQLite.Net.SQLiteConnectionString(path, false);
			var conn = new SQLite.Net.Async.SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(plat, param));

			return conn;
		}
예제 #2
0
        protected SQLite.Net.Async.SQLiteAsyncConnection GetConnection()
        {
            var filePath = _platform.GetFilePath();
            var platform = _platform.GetPlatform();

            var connectionFactory = new Func <SQLite.Net.SQLiteConnectionWithLock>(() => new SQLite.Net.SQLiteConnectionWithLock(platform, new SQLite.Net.SQLiteConnectionString(filePath, storeDateTimeAsTicks: false)));


            var asyncConnection = new SQLite.Net.Async.SQLiteAsyncConnection(connectionFactory);


            return(asyncConnection);
        }