For v19.1+
EntityServerModeSource and EntityInstantFeedbackSource automatically detect the Entity Framework version and use appropriate EntityFunctions and SqlFunctions.
To register a custom query provider, use the DevExpress.Data.Linq.CriteriaToEFExpressionConverter.RegisterCustomQueryProviderType method:
C# void Application_Start() {
using(var context = new EfContext()) {
var qEf = (IQueryable)context.BuildingObjects;
var qDecompiled = (IQueryable)qEf.Decompile();
DevExpress.Data.Linq.CriteriaToEFExpressionConverter.RegisterCustomQueryProviderType(qDecompiled.Provider.GetType(), qEf.Provider.GetType());
}
}
For v14.1 - v19.1
Some breaking changes introduced in Entity Framework 6.0 caused compatibility issues with Entity Framework Server Mode collections (EntityServerModeSource, EntityInstantFeedbackSource).
Known issues
- Filtering via the Auto Filter Row against numeric columns is not supported.
- Searching via the Find Panel against numeric columns is not supported.
- Incremental searching against numeric columns is not supported.
- The following column group intervals are not supported:
- Date
- DateMonth
- DateRange
- DateYear
- Default (for DateTime columns)
- A numeric column as display member of the look-up editor is not supported.
- The following function operators are not supported in filters and unbound columns.
- ToStr (if the parameter is an operand property referencing a numeric column)
- AddDays
- AddHours
- AddMilliSeconds
- AddMinutes
- AddMonths
- AddSeconds
- AddYears
- DateDiffDay
- DateDiffHour
- DateDiffMilliSecond
- DateDiffMinute
- DateDiffMonth
- DateDiffSecond
- DateDiffYear
- GetDate
- The Like operation is not supported.
Workaround
We introduced a new feature that allows you to specify classes which will be used by our library to get methods that call functions in the database.
In Entity Framework 6.0 these classes are:
System.Data.Entity.Core.Objects.EntityFunctions
System.Data.Entity.SqlServer.SqlFunctions
C#DevExpress.Data.Linq.CriteriaToEFExpressionConverter.EntityFunctionsType = typeof(System.Data.Entity.Core.Objects.EntityFunctions);
DevExpress.Data.Linq.CriteriaToEFExpressionConverter.SqlFunctionsType = typeof(System.Data.Entity.SqlServer.SqlFunctions);
In Entity Framework 6.1+ the System.Data.Entity.Core.Objects.EntityFunctions is obsolete, and the System.Data.Entity.DbFunctions class should be used.
C#DevExpress.Data.Linq.CriteriaToEFExpressionConverter.EntityFunctionsType = typeof(System.Data.Entity.DbFunctions);
DevExpress.Data.Linq.CriteriaToEFExpressionConverter.SqlFunctionsType = typeof(System.Data.Entity.SqlServer.SqlFunctions);
In Entity Framework Core 2.1+ only the Microsoft.EntityFrameworkCore.SqlServerDbFunctionsExtensions class should be used.
C#DevExpress.Data.Linq.CriteriaToEFExpressionConverter.EntityFunctionsType = typeof(Microsoft.EntityFrameworkCore.SqlServerDbFunctionsExtensions);
If you experience issues listed in the description to this article, execute the code above in your application's entry point. This will resolve problems caused by this limitation.
Note: The information above is applicable only for Server Mode data sources, because they configure the CriteriaToEFExpressionConverter instance internally. If you are creating the CriteriaToEFExpressionConverter instance manually (e.g., for the CriteriaToQueryableExtender.AppendWhere method), you also need to pass the query type to its constructor:
C#var result = CriteriaToQueryableExtender.AppendWhere(queryable, new CriteriaToEFExpressionConverter(queryable.Provider.GetType()), criteria);
Hi Uriah,
I just checked your solution with our system (EF 6.1.1).
So far no problems.
As soon as I find something I'll write it down here.
'til then - How is yor progress so far to get things up and running without this workaround?
Chris
Hi Chris,
At the moment, we cannot provide the estimated time frame. We will do our best to find a better solution as soon as possible.
Any more word as to when ef 6.1 will be officially supported?
Hello,
We are working on the feature, but at the moment we cannot provide the date when our work is finished.
I have created a separate ticket on your behalf to discuss a temporary workaround we provided: T195141: When Server Mode will support Entity Framework 6.1. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
Hi Uriah,
What version of DevExpress that support EF 6+ ?
Currently I am using DevExpress v13.1 , is it support EF 6+ ? Thanks
Hi Budi,
The feature was included in the following versions of DevExpress .NET libraries:
v2014 vol 1.3
v2013 vol 2.10
Hello - is there a progress update for this ticket?
Thanks!
Hello Sam,
This ticket is closed, as the solution was provided. I see that you submitted a separate ticket describing the issue you are experiencing: GridView - DateRangePicker doesn't work correctly when the BindToEF method is used. From what I gather, my colleagues helped you. Please let me know if you need any further assistance.
Two clarifications:
One
For v19.1+ EntityServerModeSource and EntityInstantFeedbackSource automatically detect the Entity Framework version and use appropriate EntityFunctions and SqlFunctions.
So just to be sure, from 19.1 onwards, we dont have to write these two lines of code, right?
CriteriaToEFExpressionConverter.EntityFunctionsType = typeof(DbFunctions); CriteriaToEFExpressionConverter.SqlFunctionsType = typeof(SqlFunctions);
Two
If you are creating the CriteriaToEFExpressionConverter instance manually (e.g., for the CriteriaToQueryableExtender.AppendWhere method), you also need to pass the query type to its constructor: var result = CriteriaToQueryableExtender.AppendWhere(queryable, new CriteriaToEFExpressionConverter(queryable.GetType()), criteria);
The constructor parameter of
CriteriaToEFExpressionConverter
isType queryProviderType
. So I wonder if it should bequeryable.GetType()
orqueryable.Provider.GetType()
. I just checked the source code and looks like it makes no difference, but I wanted a confirmation from you.Hello Nawfal,
I created a separate ticket on your behalf: T1045022: KA18959 clarifications. We placed it in our processing queue and will process it shortly.