This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
It seems the LINQ provider does not provide support for the the "contains" method. L2SQL does support this where EF does not. I hope you support this within Lightspeed. |
|
|
LightSpeed 2 supports sequence query operators such as Any, All or Contains only when getting results, not within the WHERE clause. Sorry. This limitation should be lifted in LightSpeed 3. |
|
|
I was building high hopes on getting a super LINQ provider instead of EF. I will have to lower my expectations a bit about it. Anyway, I wrote a method that would transform a LINQ IN clause to LINQ OR clause. It is listed below: Public Shared Function BuildContainsExpression(Of TElement, TValue)( _ ByVal valueSelector As Expression(Of Func(Of TElement, TValue)), _ByVal values As IEnumerable(Of TValue) _ ) As Expression(Of Func(Of TElement, Boolean)) ' validate argumentsIf IsNothing(valueSelector) Then Throw New ArgumentNullException("valueSelector") If IsNothing(values) Then Throw New ArgumentNullException("values")Dim p As ParameterExpression = valueSelector.Parameters.Single() If Not values.Any ThenReturn _ Function(e) False End IfDim equals = values.Select(Function(v) Expression.Equal(valueSelector.Body, Expression.Constant(v, GetType(TValue)))) Dim body = Equals.Aggregate( _Function(accumulate, equal) _Expression.Or(accumulate, equal) _ ) Return Expression.Lambda(Of Func(Of TElement, Boolean))(body, p) End Function |
|