public SQLiteConnection GetConnection() { var dbFilePath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var platform = new SQLitePlatformAndroid(); return(new SQLiteConnection(platform, Path.Combine(dbFilePath, DbFileName))); }
public SQLiteConnection GetConnection() { var filename = "Kelimelerim.sqlite"; // var documentspath = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); string dbPath = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.ToString(), filename); // var path = Path.Combine(documentspath, filename); if (!File.Exists(dbPath)) { using (BinaryReader br = new BinaryReader(Android.App.Application.Context.Assets.Open(filename))) { using (BinaryWriter bw = new BinaryWriter(new FileStream(dbPath, FileMode.Create))) { byte[] buffer = new byte[2048]; int len = 0; while ((len = br.Read(buffer, 0, buffer.Length)) > 0) { bw.Write(buffer, 0, len); } } } } var platform = new SQLitePlatformAndroid(); var connection = new SQLiteConnection(platform, dbPath); return(connection); }
public static void Startup() { SQLiteConnection connection = null; string dbLocation = "expensesDB.db3"; #if XAMARIN_ANDROID var library = Environment.GetFolderPath(Environment.SpecialFolder.Personal); dbLocation = Path.Combine(library, dbLocation); var platform = new SQLitePlatformAndroid(); connection = new SQLiteConnection(platform, dbLocation); #elif XAMARIN_IOS var docsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var libraryPath = Path.Combine(docsPath, "../Library/"); dbLocation = Path.Combine(libraryPath, dbLocation); var platform = new SQLitePlatformIOS(); connection = new SQLiteConnection(platform, dbLocation); #elif WINDOWS_PHONE var platform = new SQLitePlatformWP8(); connection = new SQLiteConnection(platform, dbLocation); #endif ServiceContainer.Register <IExpenseService>(() => new ExpenseService(connection)); ServiceContainer.Register <IMessageDialog>(() => new MessageDialog()); ServiceContainer.Register <ExpensesViewModel>(); ServiceContainer.Register <ExpenseViewModel>(); }
public SQLiteConnection GetConnection() { string DocumnetPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = System.IO.Path.Combine(DocumnetPath, App.dbName); var paltform = new SQLitePlatformAndroid(); var connection = new SQLiteConnection(paltform, path); return(connection); }
public SQLiteConnection GetConnection() { string _documentPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var _path = System.IO.Path.Combine(_documentPath, App.DBName); var platform = new SQLitePlatformAndroid(); var connection = new SQLiteConnection(platform, _path); return(connection); }
public SQLiteConnection GetConnection() { var fileName = "Refeicoes.db3"; string documents = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); string path = Path.Combine(documents, fileName); var platform = new SQLitePlatformAndroid(); return(new SQLiteConnection(platform, path)); }
public SQLiteConnection DbConnection() { var dbName = "iFoodDb.db3"; string documentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string path = Path.Combine(documentsFolder, dbName); var platform = new SQLitePlatformAndroid(); return(new SQLiteConnection(platform, path)); }
SQLiteConnection ISqliteService.GetConnection() { const string sqliteFilename = "ScoreTracker.db3"; var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, sqliteFilename); var platform = new SQLitePlatformAndroid(); return(new SQLiteConnection(platform, path)); }
public TaskLocalRepository(string dbPath) { this.dbPath = dbPath; platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); using (var db = new SQLiteConnection(platform, dbPath)) { db.CreateTable <TaskItemModel>(); } }
public SQLiteConnection BaglantiyiAl() { string yol = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var yol2 = System.IO.Path.Combine(yol, App.VTAdi); var platform = new SQLitePlatformAndroid(); var baglanti = new SQLiteConnection(platform, yol2); return(baglanti); }
public SQLiteConnection GetConnection() { const string sqliteFilename = "TodoSQLite.db3"; var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, sqliteFilename); var plat = new SQLitePlatformAndroid(); var conn = new SQLiteConnection(plat, path); return(conn); }
public SQLiteConnection GetConnection() { string _folderPath = System.Environment.GetFolderPath(System. Environment.SpecialFolder.Personal); var path = System.IO.Path.Combine(_folderPath, Xamarin.Sozluk.ClassUtils.SqLiteDbName); var platform = new SQLitePlatformAndroid(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLiteConnection GetConnection() { var filename = "Student.db"; var documentspath = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = Path.Combine(documentspath, filename); var platform = new SQLitePlatformAndroid(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLiteConnectionProviderDroid(string filename) { var platform = new SQLitePlatformAndroid(); var sqliteFilename = string.Format("{0}.db3", filename); string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder DbPath = Path.Combine(documentsPath, sqliteFilename); // Create the connection _connection = new SQLiteConnection(platform, DbPath); }
public SQLiteConnection GetConnection() { var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + "//ToDo.db"; File.Open(path, FileMode.OpenOrCreate); SQLitePlatformAndroid androidPlatform = new SQLitePlatformAndroid(); SQLiteConnection conn = new SQLiteConnection(androidPlatform, path); return(conn); }
/// <summary> /// Gets the connection. /// </summary> /// <returns>The connection.</returns> public SQLiteConnection GetConnection() { const string FileName = "TreeWatchDB.db3"; var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, FileName); var platform = new SQLitePlatformAndroid(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLite.Net.SQLiteConnection GetConnection() { var fileName = "PersonalRecords.db3"; var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, fileName); var platform = new SQLitePlatformAndroid(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLiteConnection GetConnection() { string dbPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = System.IO.Path.Combine(dbPath, GlobalDegisken.localDbName); var platform = new SQLitePlatformAndroid(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLiteAsyncConnection GetConnection() { var sqliteFilename = "AAAAAAAA.db3"; string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, sqliteFilename); var platform = new SQLitePlatformAndroid(); var param = new SQLiteConnectionString(path, false); var connection = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(platform, param)); return(connection); }
public SQLiteConnectionWithLock GetConnectionWithLock() { if (persistentConnection == null) { var dbFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), Constants.DB_FILE_NAME); var platform = new SQLitePlatformAndroid(); var connectionString = new SQLiteConnectionString(dbFilePath, true); persistentConnection = new SQLiteConnectionWithLock(platform, connectionString); } return(persistentConnection); }
public SQLiteConnection GetConnection() { const string sqliteFilename = "GestionServicios.db3"; var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, sqliteFilename); DataBasePath = path; var plat = new SQLitePlatformAndroid(); var conn = new SQLiteConnectionWithLock(plat, new SQLiteConnectionString(path, true)); return(conn); }
public SQLiteConnection GetConnection() { var sqliteFilename = "DataBaseDietando.db3"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); var plataform = new SQLitePlatformAndroid(); // Create the connection var conn = new SQLiteConnection(plataform, path); // Return the database connection return(conn); }
public SQLiteConnection GetAConnection() { var file = "dogs.db"; var location = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = Path.Combine(location, file); var platform = new SQLitePlatformAndroid(); var connection = new SQLiteConnection(platform, path); connection.CreateTable <Dog>(); return(connection); }
public SQLiteConnection GetConnection() { string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string applicationFolderPath = Path.Combine(documentsPath, "Habitat"); string path = Path.Combine(applicationFolderPath, _fileName); if (!Directory.Exists(applicationFolderPath)) { Directory.CreateDirectory(applicationFolderPath); } SQLitePlatformAndroid platform = new SQLitePlatformAndroid(); SQLiteConnection connection = new SQLiteConnection(platform, path); return(connection); }
public SQLiteAsyncConnection GetConnection() { var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, Constants.DatabaseName); if (!File.Exists(path)) { File.Create(path); } var platform = new SQLitePlatformAndroid(); var connectionString = new SQLiteConnectionString(path, storeDateTimeAsTicks: false); var connection = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(platform, connectionString)); return(connection); }
public SQLiteAsyncConnection GetConnection() { var sqliteFilename = "Todo.db3"; var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, sqliteFilename); var platform = new SQLitePlatformAndroid(); var connectionWithLock = new SQLiteConnectionWithLock( platform, new SQLiteConnectionString(path, true)); var connection = new SQLiteAsyncConnection(() => connectionWithLock); return(connection); }
public SQLiteConnection GetConnection() { // SQLiteデータベースパス var wSqlitePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // SQLiteデータベース名 const string wSqliteName = "SampleSQLite.db"; // SQLiteデータベースのパスとファイル名を結合 var wPath = Path.Combine(wSqlitePath, wSqliteName); // SQLIteデータベースコネクションの生成 var wPlatform = new SQLitePlatformAndroid(); var wConnect = new SQLiteConnection(wPlatform, wPath); return(wConnect); }
public SQLiteAsyncConnection GetAsyncConnection() { var dbPath = GetDatabasePath(); var platForm = new SQLitePlatformAndroid(); var connectionFactory = new Func <SQLiteConnectionWithLock>( () => { if (_conn == null) { _conn = new SQLiteConnectionWithLock(platForm, new SQLiteConnectionString(dbPath, storeDateTimeAsTicks: true)); } return(_conn); }); return(new SQLiteAsyncConnection(connectionFactory)); }
public SQLiteAsyncConnection GetAsyncConnection() { string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string applicationFolderPath = Path.Combine(documentsPath, "Habitat"); string path = Path.Combine(applicationFolderPath, _fileName); if (!Directory.Exists(applicationFolderPath)) { Directory.CreateDirectory(applicationFolderPath); } SQLitePlatformAndroid platform = new SQLitePlatformAndroid(); var param = new SQLiteConnectionString(path, false); var connection = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(platform, param)); return(connection); }
private SQLiteConnectionWithLock HandleFunc() { var dbPath = GetDatabasePath(); Debug.WriteLine("Sqlite Connection Path: " + dbPath); var platform = new SQLitePlatformAndroid(); var connectionFactory = new Func <SQLiteConnectionWithLock>( () => { if (_conn == null) { _conn = new SQLiteConnectionWithLock(platform, new SQLiteConnectionString(dbPath, storeDateTimeAsTicks: true)); } return(_conn); }); return(connectionFactory.Invoke()); }