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
|
Hey guys, I have an exception thrown when I use the STIntersects function on the SqlGeography UDT.
failed: System.InvalidCastException : Unable to cast object of type 'Mindscape.LightSpeed.Querying.LiteralExpression' to type 'Mindscape.LightSpeed.Querying.IFunctionWrappableExpression'. at Mindscape.LightSpeed.Linq.Translations.MultiFunctionBase.Apply(QueryExpression applyTo, DataProvider provider, QueryExpression[] arguments) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractMethodCriteria(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, MethodCallExpression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractCriteriaCore(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractCriteria(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractMemberCriteria(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, MemberExpression member) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ConvertToQueryExpression(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractBinaryCriteria(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, BinaryExpression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ConvertToQueryExpression(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractBinaryCriteria(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, BinaryExpression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractCriteriaCore(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractCriteria(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractCriteriaCore(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractCriteria(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractCriteriaCore(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractCriteria(IList`1 rangeVariables, QuerySubexpressionCollection subexpressions, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.Where.Evaluate(ExpressionVisitor visitor, MethodCallExpression expression) at Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.VisitMethodCall(MethodCallExpression exp) at Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.Visit(Expression exp) at Mindscape.LightSpeed.Linq.LinqQueryProvider.GetExecutionPlan(Expression expression) at Mindscape.LightSpeed.Linq.LinqQueryProvider.Execute(Expression expression) at Mindscape.LightSpeed.Linq.LinqQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) at Mindscape.LightSpeed.Linq.LinqQuery`1.GetEnumerator() at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source) I followed the instructions at : https://www.mindscape.co.nz/forums/Thread.aspx?ThreadID=2400&PageIndex=2 and I'm using the SQL2008 provider but didn't have any luck... I have a repro console - I'll sent that through. Just posting this here so it doesn't get missed. Cheers, James |
|
|
Can you post the query please? Thanks. |
|
|
Swap the STIntersects call around so that it is called through the range variable instead of the literal: .Where(f => area.STIntersects(f.Location).Value == true) // causes the error We'll look at getting this fixed because for some functions the order may be significant, but for STIntersects it doesn't make any difference so just swap them round for now. |
|