草庐IT

customerContext

全部标签

c# - Linq Query 一直抛出 "Unable to create a constant value of type System.Object....",为什么?

以下是代码示例:privatevoidloadCustomer(intcustIdToQuery){vardbContext=newSampleDB();try{varcustomerContext=fromtindbContext.tblCustomers//keepsthrowing:wheret.CustID.Equals(custIdToQuery)//Unabletocreateaconstantvalueoftype'System.Object'.selectnew//Onlyprimitivetypes('suchasInt32,String,andGuid'){//ar

c# - Linq Query 一直抛出 "Unable to create a constant value of type System.Object....",为什么?

以下是代码示例:privatevoidloadCustomer(intcustIdToQuery){vardbContext=newSampleDB();try{varcustomerContext=fromtindbContext.tblCustomers//keepsthrowing:wheret.CustID.Equals(custIdToQuery)//Unabletocreateaconstantvalueoftype'System.Object'.selectnew//Onlyprimitivetypes('suchasInt32,String,andGuid'){//ar