实体框架核心存储过程即时返回,无结果

时间:2018-11-09 17:41:04

标签: entity-framework entity-framework-core

我确定我缺少什么,但无法弄清楚。 我正在尝试调用存储过程来填充帐户列表。呼叫看起来像这样:

....
  var sortOrderP = new SqlParameter("@sortOrder", sortOrder)
        {
            DbType = DbType.String,
            Size = 10
        };
        var accounts = new List<AccountModel>();
        var sqlParams = new List<SqlParameter>()
        {
            acctCode, fundCode, dealerId, dealerName,
            branchId, branchName, repId, repName, pageNumP, pageSizeP, sortColumnP, sortOrderP
        };
        var parameters = sqlParams.ToArray<object>();

        try
        {
            var results =  _camDwContext.Accounts.FromSql("EXECUTE dbo.fm_SearchAccounts @acctCode," +
                                                         "@fundCode," +
                                                         "@dealerId," +
                                                         "@dealerName," +
                                                         "@branchId," +
                                                         "@branchName," +
                                                         "@repId," +
                                                         "@repName," +
                                                         "@pageNum," +
                                                         "@pageSize," +
                                                         "@sortColumn," +
                                                         "@sortOrder", parameters).ToList();
            foreach (var result in results)
            {
                var acct = new AccountModel(result);
                accounts.Add(acct);
            }

我没有收到任何错误消息,但通话会持续几秒钟,并且不会返回任何结果,但会立即返回...

0 个答案:

没有答案