private async Task InitializeDb() { StorageService storageService = new StorageService(); string path = storageService.GetPathForFileAsync("SalesApp.db3"); ISQLitePlatform sqLitePlatform = new SQLitePlatformGeneric(); await DatabaseInstance.Instance.InitializeDb(sqLitePlatform, path); }
public static SQLiteConnection GetConnection(string name) { ISQLitePlatform platform = new SQLitePlatformGeneric(); if (!Connections.ContainsKey(name)) { Connections[name] = new SQLiteConnection(platform, DbFileNames[name]); } return(Connections[name]); }
public override SQLiteConnection GetDatabase(string name) { ISQLitePlatform platform; if (RuntimeInfo.IsWindows) { platform = new SQLitePlatformWin32(); } else { platform = new SQLitePlatformGeneric(); } return(new SQLiteConnection(platform, @":memory:")); }
public override SQLiteConnection GetDatabase(string name) { ISQLitePlatform platform; if (RuntimeInfo.IsWindows) { platform = new SQLitePlatformWin32(Architecture.NativeIncludePath); } else { platform = new SQLitePlatformGeneric(); } return(new SQLiteConnection(platform, GetUsablePathFor($@"{name}.db", true))); }
public override SQLiteConnection GetDatabase(string name) { Directory.CreateDirectory(BasePath); ISQLitePlatform platform; if (RuntimeInfo.IsWindows) { platform = new SQLitePlatformWin32(); } else { platform = new SQLitePlatformGeneric(); } return(new SQLiteConnection(platform, Path.Combine(BasePath, $@"{name}.db"))); }
public override SQLiteConnection GetDatabase(string name, SQLiteOpenFlags openFlags = SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create, bool storeDateTimeAsTicks = true, IBlobSerializer serializer = null, IDictionary <string, TableMapping> tableMappings = null, IDictionary <Type, string> extraTypeMappings = null, IContractResolver resolver = null) { Directory.CreateDirectory(BasePath); ISQLitePlatform platform; if (RuntimeInfo.IsWindows) { platform = new SQLitePlatformWin32(); } else { platform = new SQLitePlatformGeneric(); } return(new SQLiteConnection(platform, Path.Combine(BasePath, $@"{name}.db"), openFlags, storeDateTimeAsTicks, serializer, tableMappings, extraTypeMappings, resolver)); }
public SQLiteConnection CreateDb(string fileName) { var platform = new SQLitePlatformGeneric(); platform.SQLiteApi.Config(ConfigOption.Serialized); /* * 使用Serialize模式串行地进行数据读取写入. * 如果要并行,需要将DatabaseSource的传递变为string * 由各个使用到这个数据库的地方自行建立SQLiteConnection * (*MultiThread模式下不能让同一个SQLiteConnection同时被多个线程使用) */ var conn = new SQLiteConnection( platform , fileName); conn.CreateTable <DiffData>(); return(conn); }