Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AnrodidSqlite { string GetPath()
- {
- try
- {
- var databaseName = "mydb";
- var sqliteFilename = $"{databaseName}.db3";
- var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
- var path = Path.Combine(documentsPath, sqliteFilename);
- if (File.Exists(path))
- {
- File.Delete(path);
- }
- using (File.Create(path))
- {
- var connection= new SQLiteConnection(path);
- connection.CreateTable<Location>();
- }
- return path;
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- public SQLiteAsyncConnection GetAsyncConnection()
- {
- var path = GetPath();
- var conn = new SQLiteAsyncConnection(path,SQLiteOpenFlags.ReadWrite);
- return conn;
- }
- public class LocationDal{
- public async Task SaveLocation(SearchCriteria searchCriteria)
- {
- try
- {
- var originCity = searchCriteria.OriginCity;
- await _database.InsertAsync(destinationCity);
- }
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement