/// <summary>Initializes a new instance of the <see cref="SQLiteConnectionAsync" /> class.</summary> /// <param name="sqliteConnection">Connection instance</param> /// <param name="taskScheduler"> /// If null this parameter will be TaskScheduler.Default (evaluated /// when used in each method, not in ctor) /// </param> /// <param name="taskCreationOptions">Defaults to None</param> public SQLiteConnectionAsync( SQLiteConnectionWithLockBridge sqliteConnection, TaskScheduler taskScheduler = null, TaskCreationOptions taskCreationOptions = TaskCreationOptions.None) { _sqliteConnection = sqliteConnection; _taskCreationOptions = taskCreationOptions; _taskScheduler = taskScheduler; }
/// <summary>Computes or retrieve mapping for given table type</summary> /// <typeparam name="T">The type of DB's table</typeparam> /// <returns>Table mapping</returns> public Task <ITableMapping> GetTableMappingAsync <T>() where T : class { return(Task.Factory.StartNew( () => { SQLiteConnectionWithLockBridge conn = GetConnection(); using (conn.Lock()) return conn.GetTableMapping <T>(); }, CancellationToken.None, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default)); }