I have a web api project that host my models, in my .net application, when I query this :
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 is not with the query, it's from id variable. the id variable is of the short type not an int. here is the 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> at System.Web.Http.ApiController.<InvokeActionWithExceptionFilters>d__1.MoveNext()
---End of stack trace from previous location where exception was thrown ---
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()</m:stacktrace></m:innererror></m:error>
and here is odata url :
"GET http://localhost:21401/odata/Title()?$filter=cast(Id,'Edm.Int32') eq 3&$top=2"well, the type of Id property in my entites is short. how can I pass it to the query?
Thanks, If I have to bring more information, please tell me.