【发布时间】:2015-10-22 03:29:22
【问题描述】:
如何在实体框架 6 中调用标量函数? 我试过下面的代码
using (MhEntities DContext = new MhEntities())
{
var Account_IdParameter = Account_Id.HasValue ? new ObjectParameter("Account_Id", Account_Id) : new ObjectParameter("Account_Id", typeof(long));
string res = ((IObjectContextAdapter)DContext).ObjectContext.CreateQuery<string>("MoneyforHealthEntities.Fn_LEVEL0_Acount_Id", Account_IdParameter).FirstOrDefault();
return Convert.ToInt64(res);
}
【问题讨论】:
-
运行代码时会发生什么?
标签: c# linq entity-framework