【发布时间】:2013-12-23 07:05:50
【问题描述】:
我是 MVC 新手,正在尝试从控制器调用存储过程。
在模型中,我有 edmx,它把所有存储的过程作为函数
无法隐式转换类型
System.Collections.Generic.IEnumerable<MVC.Models.xxcomplextype_result>到System.Web.Mvc.ActionResult
存在显式转换。
我在控制器中为实体创建了一个对象,并在一个动作结果函数中调用了调用存储过程的函数,它返回了上述错误。 我应该如何将结果集转换为 actionresult?
代码示例
public class DBController : Controller
{
XXXXXXXEntities xXXXXXEntities = new XXXXXXXEntities();
public IEnumerable<usp_xxxxx_Result> usp_xxxxx()
{
return XXXXXEntities.usp_xxxxx();
}
}
public ActionResult ViewQuery() {
DBController dBController = new DBController();
return dBController.usp_xxxxx();
}
【问题讨论】:
标签: c# asp.net-mvc entity-framework edmx