Implementing the SQLiteStorage class
Now back to the FileStorage.Portable
project. Let's add another file into the Storage
folder called SQLiteStorage.cs
and implement the private
variables:
public class SQLiteStorage : ISQLiteStorage { #region Private Properties private readonly AsyncLock asyncLock = new AsyncLock(); private readonly object lockObject = new object(); private SQLiteConnectionWithLock _conn; private SQLiteAsyncConnection _dbAsyncConn; private readonly ISQLitePlatform _sqlitePlatform; private string _dbPath; private readonly ILogger _log; private readonly string _tag; #endregion }
We have a private AsyncLock
object as we will be doing synchronous and asynchronous locking implementations. We then have two SQLite objects for creating the connection to our local database. The _dbPath
variable is used to hold the local database path; this will be used for setting up the connection. We...