When using Linq to Entities, the resulting query should run on sql server (not enumerating it into memory and then perform the conversion)
I currently have a project whereby I build expression trees for string searching. I am currently exploring the possibility of converting non string properties to strings to enable searching on primitive types, such as integer
and Guid
etc.
I currently try to Convert
a supplied lamda property to a string and then swap it into the expression tree using the following:
var stringProperty = Expression.Convert(property.Body, typeof (string));
System.InvalidOperationException : No coercion operator is defined between types 'System.Int32' and 'System.String'.
Am I trying to achieve the impossible or is there a way to extend linq to entities to support conversions?