I am trying to use entity framework to call a stored procedure with one parameter. The stored procedure will query few tables and return results. It has been tested successfully in SSMS. My call code is as follows
public async Task<IReadOnlyList<Object>> GetListWithBalancePROCAsync(int organizationId){ SqlParameter OrganizationId = new SqlParameter("@OrganizationId", organizationId); try { using var _dbContext = _DbFactory.CreateDbContext(); if (_dbContext is null) return null; var query = _dbContext.Database.SqlQueryRaw<Object>($"EXECUTE dbo.GetCOAWithBalancePROC @OrganizationId", organizationId); return await query.ToListAsync(); } catch (Exception ex) { await _exceptionLogService?.CreateLogAsync(ex, null, "FinGLAccountDbService.GetListWithBalancePROCAsync"); return null; }}The call only can return null and looks like the procedure has not been executed successfully. Please help to check the code. Thank you very much.