ToString and DateTime.Parse not supported by Entity Framework

4 posts, 1 answers
  1. Gary
    Gary avatar
    28 posts
    Member since:
    Apr 2011

    Posted 28 Oct 2012 Link to this post

    I am having big issues with RadFilter and getting it to produce the right expressions against Entity Framework DBContext.

    It produces expressions that are not supported in EF.

    E.g. Expression Preview is  (TransDate > '10-20-2014 12:00:00')
        Translates to (TransDate > DateTime.Parse('10-20-2014 12:00:00'))

    Results in EF error "function DateTime.Parse is not supported... etc."

    Same for String comparsions. and anywhere that ToString output by the RadFilter.

    How can I get the expressions to be EF compatible???? I have tried the EnitySql Provider but this is not SQL. Also tried the DynamicLinq but that outputs the same as the default.

    Thanks


  2. Marin
    Admin
    Marin avatar
    1045 posts

    Posted 01 Nov 2012 Link to this post

    Hello,

     RadFilter can be integrated with databound controls as shown in this demo or with any datasource controls (such as SqlDataSource, EntityDataSource, LinqDataSource etc.) as described in this help topic. For additional custom scenarios you will need to define the expressions manually as shown here.
    If you are using any of the predefined approaches above and you still get an error let us know how exactly you have integrated the RadFilter with the entity framework so we can check it on our side.
    Also note that there are many different filter expressions depending on what type of data you are trying to filter and in order for the control to automatically generate the correct expression you have set its DataSourceControlID property to the proper value.

    I hope this helps.

    Kind regards,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gary
    Gary avatar
    28 posts
    Member since:
    Apr 2011

    Posted 01 Nov 2012 Link to this post

    The examples you reference for manually generating expressions actually do nothing of the kind.They show you how to call a built-in RadFilterXXXQueryProvider.

    What I would like to do is build a custom Query Provider called say RadFilterODataQueryProvider for example.

    Thanks
    Gary
  5. Answer
    Marin
    Admin
    Marin avatar
    1045 posts

    Posted 02 Nov 2012 Link to this post

    Hello,

     Since RadFilter does not support adding custom query providers yet, you can use one of the predefined query providers if they are applicable for the type of data that you need to filter. RadFilter will use internally the specified provider to construct the correct filter expressions for the type of datasource that will be filtered. You can also add filter expressions using the server-side API as shown here.

    Kind regards,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top