/// <summary> /// Execute the stored procedure represented by the provided parameter and return the count of records affected /// </summary> /// <param cref="Socratic.DataAccess.Abstractions.IStoredProcedure{T}" name="storedProc"></param> /// <returns>Count of affected records</returns> public async Task <int> ExecuteAsync(IStoredProcedure <int> storedProc) // ToDo: common response object { var procInfo = StoredProcedureConfig.Build(storedProc); await BuildTransactionalConnectionAsync(); return(await context.Database.GetDbConnection().ExecuteAsync(procInfo.Name, procInfo.Parameters, context.Database.CurrentTransaction.GetDbTransaction(), commandType: CommandType.StoredProcedure)); }
/// <summary> /// Execute the stored procedure represented by the provided parameter and return an IEnumerable of the expected type /// </summary> /// <param cref="Socratic.DataAccess.Abstractions.IStoredProcedure{T}" name="storedProc"></param> /// <typeparam name="T"></typeparam> /// <returns>A sequence of data of T</returns> public async Task <IEnumerable <T> > QueryListAsync <T>(IStoredProcedure <T> storedProc) { var procInfo = StoredProcedureConfig.Build(storedProc); await BuildTransactionalConnectionAsync(); return(await context.Database.GetDbConnection().QueryAsync <T>(procInfo.Name, procInfo.Parameters, context.Database.CurrentTransaction.GetDbTransaction(), commandType: CommandType.StoredProcedure)); }