This is a migrated thread and some comments may be shown as answers.

ToString and DateTime.Parse not supported by Entity Framework

3 Answers 126 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 28 Oct 2012, 07:44 PM
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


3 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 01 Nov 2012, 09:25 AM
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.
0
Gary
Top achievements
Rank 1
answered on 01 Nov 2012, 11:00 AM
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
0
Accepted
Marin
Telerik team
answered on 02 Nov 2012, 08:22 AM
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.
Tags
Filter
Asked by
Gary
Top achievements
Rank 1
Answers by
Marin
Telerik team
Gary
Top achievements
Rank 1
Share this question
or