/// <summary> /// ExecuteCommandReaderAsync /// </summary> /// <param name="Transaction"></param> /// <param name="dbName"></param> /// <param name="dbCommand"></param> /// <param name="useMaster"></param> /// <returns></returns> /// <exception cref="DatabaseException"></exception> public Task <IDataReader> ExecuteCommandReaderAsync(IDbTransaction?Transaction, string dbName, IDbCommand dbCommand, bool useMaster = false) { if (Transaction == null) { return(SQLiteExecuter.ExecuteCommandReaderAsync(GetConnectionString(dbName, useMaster), dbCommand)); } else { return(SQLiteExecuter.ExecuteCommandReaderAsync((SqliteTransaction)Transaction, dbCommand)); } }
/// <summary> /// ExecuteCommandReaderAsync /// </summary> /// <param name="Transaction"></param> /// <param name="dbName"></param> /// <param name="engineCommand"></param> /// <param name="useMaster"></param> /// <returns></returns> /// <exception cref="DatabaseException"></exception> public async Task <IDataReader> ExecuteCommandReaderAsync(IDbTransaction?Transaction, string dbName, EngineCommand engineCommand, bool useMaster = false) { //使用using的话,会同时关闭reader. //在Microsoft.Data.Sqlite实现中, dipose connection后,会自动dispose command #pragma warning disable CA2000 // Dispose objects before losing scope SqliteCommand dbCommand = CreateTextCommand(engineCommand); #pragma warning restore CA2000 // Dispose objects before losing scope if (Transaction == null) { return(await SQLiteExecuter.ExecuteCommandReaderAsync(GetConnectionString(dbName, useMaster), dbCommand).ConfigureAwait(false)); } else { return(await SQLiteExecuter.ExecuteCommandReaderAsync((SqliteTransaction)Transaction, dbCommand).ConfigureAwait(false)); } }