Try to use T-SQL directly when using EF
There is such an implementation objectcontext.executestorequery
There is a constructor objectcontext.executestorequery (string S,parm object[] p)
It's all on the web.
Se. Executestorequery<departments> ("Select did, Dname, Dmanager from departments where [email protected ]"new ObjectParameter ("ID""1")
I don't know if someone else is running or not running correctly anyway, I'm having an exception.
After modification
Se. Executestorequery<departments> ("Select did, Dname, Dmanager from departments where did={0} ","1")
Run through data correctly
Cause: The Parm section needs to be constructed as follows
context.ExecuteStoreQuery<Product>("select * from Products where pid = {0}", 1);
Or
context.ExecuteStoreQuery<Product>("select * from Products where pid = @p0", new SqlParameter { ParameterName = "p0", Value = 1 });
There is no mapping from the object type System.Data.Objects.ObjectParameter to the known managed provider native type