【发布时间】:2012-10-12 16:19:59
【问题描述】:
我正在使用 SelectCountMethod 来计算返回的行数,但不会为我添加的新类调用它。
下面是我的 UI 代码。
<asp:ObjectDataSource ID="ObjDS1" runat="server" EnablePaging="false" TypeName="SomeBusinesslogicclass"
SelectCountMethod="GetCallCount" SelectMethod="sp_gettotalcallsummary2_ivr" OnSelecting="objDS_Selecting1"
OnSelected="objDS_Selected1">
业务逻辑
public int GetCallCount(string Provider , string FromCallDate , string ToCallDate)
{
CallSummaryRepository rep = new CallSummaryRepository();
return rep.GetCallCount(Provider,FromCallDate,ToCallDate);
}
数据访问层
public int GetCallCount(string Provider , string FromCallDate , string ToCallDate)
{
int count = 0;
using (IVREntities context = new IVREntities())
{
var query = (from ap in context.sp_gettotalcallsummary2(Provider, FromCallDate, ToCallDate)
select ap
);
count = query.Count();
}
return count;
}
我已设置断点并尝试调试代码,但它从未进入 GetCallCount 函数。我知道这个问题已经被问过几次了,但这些答案并不能解决我的问题
【问题讨论】:
-
你的
SelectCountMethod的参数和你的SelectMethod的参数匹配吗?
标签: c# .net gridview objectdatasource