public SqliteContext(ISQLitePlatform platform,DatabaseInitializator init) { _platform = platform; _init = init; _dbPath = init.Path; var connection = new SQLiteConnectionWithLock(_platform, new SQLiteConnectionString(_dbPath, storeDateTimeAsTicks: true)); _connectionFactory = new Func<SQLiteConnectionWithLock>(() =>connection); CreateTables(); }
private void RegisterDatabaseServices() { var initBase = new DatabaseInitializator() { Path = Path.Combine(ApplicationData.Current.LocalFolder.Path, "local.db") }; Mvx.RegisterSingleton<DatabaseInitializator>(initBase); Mvx.RegisterSingleton<ISQLitePlatform>(new SQLitePlatformWinRT()); Mvx.ConstructAndRegisterSingleton<SqliteContext,SqliteContext>(); Mvx.RegisterType<IStationRepository, StationRepository>(); Mvx.RegisterType<IFavoriteTrainRepository, FavoriteTrainRepository>(); }