protected override void AdditionalSetup() { base.AdditionalSetup(); _mockDeviceInfo = new Mock <IDeviceInfo>(); _mockDeviceInfo.Setup(di => di.DatabasePath).Returns(string.Empty); _platform = new SQLite.Net.Platform.Generic.SQLitePlatformGeneric(); }
public DataService(IDeviceInfo deviceInfo, SQLite.Net.Interop.ISQLitePlatform platform) { _deviceInfo = deviceInfo; _platform = platform; _path = Path.Combine(_deviceInfo.DatabasePath, DBNAME); _connectionString = new SQLiteConnectionString(_path, true); _connectionPool = new SQLiteConnectionPool(_platform); this.CreateTablesIfRequired(); }
public Nearest(ISQLitePlatform Platform, IUtility Utility, string[] Prefs) { platform = Platform; utility = Utility; prefs = Prefs; try { dbPath = utility.CopyDatabaseFromAssets(DB_NAME); //222d8a42e097fa050a3509a95aab41d1d69a9297 utility.WriteLine("DBPATH: " + dbPath); //File does not seem to exist if (!utility.FileExists(dbPath)) { utility.WriteLine("File copy failed."); } db = new SQLiteConnection(platform, dbPath); db.CreateTable <Metro.calendar>(); db.CreateTable <Metro.stops>(); db.CreateTable <Metro.stop_times>(); db.CreateTable <Metro.trips>(); if (!TablesExist() || null == GetServiceId()) { utility.WriteLine("Tables do not exist or service_id is null."); } } catch (SQLiteException Ex) { utility.WriteLine(Ex.Message); } /* * MTA FEED KEY - ba77750b760c246dda98cc80f11a90de * static - http://web.mta.info/developers/data/nyct/subway/google_transit.zip * * * .NET * Install-Package GtfsRealtimeBindings * * WebRequest req = HttpWebRequest.Create("URL OF YOUR GTFS-REALTIME SOURCE GOES HERE"); * FeedMessage feed = Serializer.Deserialize<FeedMessage>(req.GetResponse().GetResponseStream()); * foreach (FeedEntity entity in feed.entity) {} */ }
public static SQLiteAsyncConnection GetConnection(string path, SQLite.Net.Interop.ISQLitePlatform sqlitePlatform) { var connectionFactory = new Func <SQLiteConnectionWithLock>(() => new SQLiteConnectionWithLock(sqlitePlatform, new SQLiteConnectionString(path, false))); return(new SQLiteAsyncConnection(connectionFactory)); }