private void InitializeSettingTable() { string dbName = "receptionist.db3"; ILocalStorageService storageService = ServiceProvider.GetService <ILocalStorageService>(); IActivatorService activatorService = ServiceProvider.GetService <IActivatorService>(); var factory = activatorService.CreateInstance <Func <string, ISQLiteConnection> >(); ISQLiteConnection db = factory(storageService.GetFilePath(dbName, LocalFolderKind.Data)); if (!db.TableExists <GeneralSetting>()) { db.CreateTable <GeneralSetting>(); } //else // db.MigrateTable<Setting>(); if (db.Table <GeneralSetting>().ToList().Count == 0) { List <GeneralSetting> generalsetting = new List <GeneralSetting>(); generalsetting.Add(new GeneralSetting() { SettingId = Guid.NewGuid(), GeneralName = "barcode" }); db.InsertAll(generalsetting); } }
public virtual ISQLiteAsyncConnection CreateConnection(string dbName) { ILocalStorageService storageService = ServiceProvider.GetService <ILocalStorageService>(); IActivatorService activatorService = ServiceProvider.GetService <IActivatorService>(); Func <string, ISQLiteAsyncConnection> factory = activatorService.CreateInstance <Func <string, ISQLiteAsyncConnection> >(); ISQLiteAsyncConnection db = factory(storageService.GetFilePath(dbName, LocalFolderKind.Data)); return(db); }