成为EF& amp;的初学者Oracle组合,我对以下内容感到困惑。
我有一个PLSQL程序:
CREATE OR REPLACE PROCEDURE "CountEmployee"("pDepartmentId" NUMBER, "pCount" OUT NUMBER)
AS BEGIN
SELECT COUNT(*) INTO "pCount" FROM "Employee"
WHERE "Employee"."DepartmentId" = "pDepartmentId";
END;
我尝试从C#访问的人。来自上下文的方法看起来非常好,几乎与EF& SQLServer案例(除了数字 - >十进制vs int - > int转换)
public virtual int CountEmployee(Nullable<decimal> pDepartmentId, ObjectParameter pCount) {
var pDepartmentIdParameter = pDepartmentId.HasValue ?
new ObjectParameter("pDepartmentId", pDepartmentId) :
new ObjectParameter("pDepartmentId", typeof(decimal));
return ((IObjectContextAdapter)this).
ObjectContext.ExecuteFunction("CountEmployee", pDepartmentIdParameter, pCount);
}
但是,请致电CountEmployee
Department dep = ctx.Departments.Where(d => d.Name == "HR").First();
var objParam = new ObjectParameter("pCount", typeof(decimal));
ctx.CountEmployee(dep.Id, objParam);
Debug.Assert((decimal) objParam.Value > 0)
以“错误的数量或类型的参数”来惨败。
非常感谢任何指导。