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 also have our dependency service interface ILogger
and another string for tagging the current object. Tagging is useful with logging as it tells the logger what class is logging.
3.145.111.183