Multi query Dapper request take too long

Viewed 42

Inside my repository I have the request method to my database using dapper multiquery as:

public async Task<NotificationReadViewModel> GetAll(NotificationSelectModel model)
        {
            try
            {
                async Task<NotificationReadViewModel> DoGet()
                {
                    var rModel = new NotificationReadViewModel();
                    using var connection = _connectionManager.GetOpenConnection(_configuration.GetConnectionString(MyConnection));
                    using var multi = await connection.QueryMultipleAsync("[MySp]", param: new
                    {
                        model.NotificationId,
                        model.PageNumber,
                        model.RowsPerPage,
                        model.SearchBy,
                        model.UserName,
                        model.StartingDate,
                        model.EndingDate,
                        model.Read,
                        TypeTableType = ((List<VarcharIdTableType>)model.TypeTableType).ToDataTable(),
                        DogTagTableType = ((List<VarcharIdTableType>)model.DogTagList).ToDataTable(),
                        RoleTableType = ((List<VarcharIdTableType>)model.RoleList).ToDataTable(),
                    }, commandType: CommandType.StoredProcedure);

                ...
                                
                    return rModel;
                }
                return await DoGet();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

for some reason the request take too long. I add a debug on the request: using var multi = await connection.QueryMultipleAsync... and it took over 15 seconds to respond.

My first though was the stored procedure, but I check it with the same variables and it took 0 seconds to execute, but for some reason the request is taking too much.

Note: I have other multi query stored procedures and this is the only one where I have this issue. Can someone have an idea or see anything weird or know what is going on?

0 Answers
Related