locked
Silverlight client and DataTime != null Error RRS feed

  • Question

  •  

    Hi,

    I'm trying to use new silverlight client and I want filter my data where a DataTime field is not null.

    The code is:

    var fondi = db.Fondi.Where(f => f.Data_Finale != null);

     

    this is the call to Ado.Net Data Server  that I see in QuickWatch

     

    http://localhost:3347/Fondi?$filter=(Data_Finale)%20ne%20(cast((null),%20'System.Nullable%601%5B%5BSystem.DateTime,%20mscorlib,%20Version=2.1.0.0,%20Culture=neutral,%20PublicKeyToken=b77a5c561934e089%5D%5D'))

     

    I try this call in a browser but i get this error:

     

    No applicable function found for 'cast' at position 18 with the specified arguments. The functions considered are: cast(System.Type); cast(System.Object, System.Type).
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseIdentifier()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParsePrimaryStart()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParsePrimary()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseUnary()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseMultiplicative()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseAdditive()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseComparison()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseLogicalAnd()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseLogicalOr()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseExpression()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseParenExpression()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParsePrimaryStart()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParsePrimary()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseUnary()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseMultiplicative()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseAdditive()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseComparison()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseLogicalAnd()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseLogicalOr()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.ParseExpression()
       in Microsoft.Data.Web.RequestQueryParser.ExpressionParser.Parse(Type resultType)
       in Microsoft.Data.Web.RequestQueryParser.ParseLambda(IWebDataService service, Type typeForIt, Type resultType, String expression)
       in Microsoft.Data.Web.RequestQueryParser.Where(IWebDataService service, IQueryable source, String predicate)
       in Microsoft.Data.Web.RequestQueryProcessor.ProcessFilter()
       in Microsoft.Data.Web.RequestQueryProcessor.ProcessQuery()
       in Microsoft.Data.Web.RequestQueryProcessor.ProcessQuery(IWebDataService service, RequestDescription description)
       in Microsoft.Data.Web.RequestUriProcessor.ProcessRequestUri(String requestUri, IWebDataService service)
       in Microsoft.Data.Web.WebDataService`1.ProcessIncomingRequest()
    If I call the services in the browser with this code it works
    http://localhost:3347/DataModel/WebDataService_Simulazione_Var.svc/Fondi?$filter=(Data_Finale)%20ne%20(null)
    
    I think there is an error in silverlight client
    May anyone help me please 
    Thanks
    Mirko
     
    Wednesday, January 16, 2008 2:15 PM

Answers

  • This is a known issue with the Linq support in the Astoria Silverlight client.  Because of current limitations in Silverlight 1.1 Alpha, local evaluation of expressions is not supported.  In this case, the the cast of null to DateTime? should be done on the client before the URI is generated.

     

    I can't really come up with a work around.  But I will hack on it a bit more later today.

     

    This should be fixed in the Mix time frame.

     

    Andy

     

    Wednesday, January 16, 2008 7:03 PM
    Moderator