【发布时间】:2014-02-04 13:20:04
【问题描述】:
我在我的 MVC 3 解决方案中创建了一个新项目,其中将数据库优先的实体框架模型映射到 SQL Server 2008 数据库。我在模型中包含了所有表、视图、存储过程等。我可以在查看数据模型时看到我想要使用的标量函数,但是当我尝试在控制器中使用 proc 或函数名称作为对象时,Intellisense 看不到它并且应用程序出错。我还需要做什么才能在控制器中使用存储过程和函数吗?
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Newtonsoft.Json;
using System.Web.Security;
using System.Data.Objects.SqlClient;
using JobBoard.Models;
using JobBoardDAL.Models;
namespace JobBoard.Controllers
{
public class AccountController : Controller
{
private DataModel db = new DataModel();
public ActionResult Authenticate() {
.....
var x = db.IsUser(somevariable); // <---- Problem is here
{
}
}
}
【问题讨论】:
标签: c# sql-server asp.net-mvc entity-framework visual-studio-2012