c# - odata unknown function cast -


i have web api project host models, in .net application, when query :

static void titlebyid(moviesservice.container container, short id)         {             try             {                 moviesservice.title title = container.title.where(w => w.id == id).singleordefault();                 if (title != null)                 {                     displaytitle(title);                 }             }             catch (exception e)             {                 console.writeline(e.message);             }         } 

the problem not query, it's id variable. id variable of short type not int. here exception message :

<?xml version="1.0" encoding="utf-8"?> <m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">   <m:code />   <m:message xml:lang="en-us">an error has occurred.</m:message>   <m:innererror>     <m:message>unknown function 'cast'.</m:message>     <m:type>system.notimplementedexception</m:type>     <m:stacktrace>   @ system.web.http.apicontroller.&lt;invokeactionwithexceptionfilters&gt;d__1.movenext()&#xd; --- end of stack trace previous location exception thrown ---&#xd;    @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task)&#xd;    @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task)&#xd;    @ system.web.http.dispatcher.httpcontrollerdispatcher.&lt;sendasync&gt;d__0.movenext()</m:stacktrace>   </m:innererror> </m:error> 

and here odata url :

"get http://localhost:21401/odata/title()?$filter=cast(id,'edm.int32') eq 3&$top=2" 

well, type of id property in entites short. how can pass query?

thanks, if have bring more information, please tell me.

i found cast not implemented in filterbinder.bindsinglevaluefunctioncallnode in source code: https://aspnetwebstack.codeplex.com/sourcecontrol/latest#src/system.web.http.odata/odata/query/expressions/filterbinder.cs

one of way solve download code , implement yourself.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -