Skip to content

'l => l.Tags' cannot be converted to SQL. when Join with FreeTextTable  #386

Closed
@JCKodel

Description

This works fine: (joining an existing query to a FreeTextTable, using inner join)

return from q in query
   join f in db.FreeTextTable<Link, Guid>(l => l.Tags, authenticatedUserTags) on q.Id equals f.Key
   orderby f.Rank descending
   select q;

But this don't: (only changed inner join to left join)

return from q in query
   from f in db.FreeTextTable<Link, Guid>(l => l.Tags, authenticatedUserTags).Where(f => f.Key == q.Id).DefaultIfEmpty()
   orderby f.Rank descending
   select q;

Exception:

[LinqException: 'l => l.Tags' cannot be converted to SQL.]
   LinqToDB.Linq.Builder.ExpressionBuilder.ConvertToSql(IBuildContext context, Expression expression, Boolean unwrap) in C:\CodeArt\Submodules\linq2db\Source\Linq\Builder\ExpressionBuilder.SqlBuilder.cs:988
   LinqToDB.Linq.Builder.<>c__DisplayClass28_0.<.ctor>b__0(Expression a) in C:\CodeArt\Submodules\linq2db\Source\Linq\Builder\TableBuilder.cs:190
   System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +223
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +153
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +106
   LinqToDB.DataProvider.SqlServer.FreeTextTableExpressionAttribute.SetTable(MappingSchema mappingSchema, SqlTable table, MemberInfo member, IEnumerable`1 expArgs, IEnumerable`1 sqlArgs) in C:\CodeArt\Submodules\linq2db\Source\DataProvider\SqlServer\FreeTextTableExpressionAttribute.cs:28

But using string, works fine: (removed lambda)

return from q in query
   from f in db.FreeTextTable<Link, Guid>("Tags", authenticatedUserTags).Where(f => f.Key == q.Id).DefaultIfEmpty()
   orderby f.Rank descending
   select q;

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions