/// <summary> /// Performs CRUD load. Override to do custom Query interpretation /// </summary> protected internal async virtual Task <List <RowsetBase> > DoLoadAsync(MySqlConnection cnn, MySqlTransaction transaction, Query[] queries, bool oneDoc = false) { var result = new List <RowsetBase>(); if (queries == null) { return(result); } foreach (var query in queries) { var handler = QueryResolver.Resolve(query); try { var rowset = await handler.ExecuteAsync(new MySqlCrudQueryExecutionContext(this, cnn, transaction), query, oneDoc).ConfigureAwait(false); result.Add(rowset); } catch (Exception error) { throw new MySqlDataAccessException( StringConsts.LOAD_ERROR + error.ToMessageWithType(), error, KeyViolationKind.Unspecified, CrudGenerator.KeyViolationName(error)); } } return(result); }
/// <summary> /// Performs CRUD load. Override to do custom Query interpretation /// </summary> protected internal async virtual Task <Cursor> DoOpenCursorAsync(MySqlConnection cnn, MySqlTransaction transaction, Query query) { var context = new MySqlCrudQueryExecutionContext(this, cnn, transaction); var handler = QueryResolver.Resolve(query); try { return(await handler.OpenCursorAsync(context, query).ConfigureAwait(false)); } catch (Exception error) { throw new MySqlDataAccessException( StringConsts.OPEN_CURSOR_ERROR + error.ToMessageWithType(), error, KeyViolationKind.Unspecified, CrudGenerator.KeyViolationName(error)); } }
/// <summary> /// Performs CRUD execution of queries that do not return result set. Override to do custom Query interpretation /// </summary> protected internal async virtual Task <Doc> DoExecuteAsync(MySqlConnection cnn, MySqlTransaction transaction, Query query) { if (query == null) { return(null); } var handler = QueryResolver.Resolve(query); try { return(await handler.ExecuteProcedureAsync(new MySqlCrudQueryExecutionContext(this, cnn, transaction), query).ConfigureAwait(false)); } catch (Exception error) { throw new MySqlDataAccessException( StringConsts.EXECUTE_WITHOUT_FETCH_ERROR + error.ToMessageWithType(), error, KeyViolationKind.Unspecified, CrudGenerator.KeyViolationName(error)); } }