Sto cercando di fare una semplice ricerca full text:
var dbquery = _dbContext.Contents
.Where(c => EF.Functions.FreeText("Content", "a"));
var result = dbQuery.ToList();
ma sto ottenendo:
InvalidOperationException: il metodo 'FreeText' non è supportato perché la query è passata alla valutazione client. Ispezionare il registro per determinare quali espressioni di query attivano la valutazione del client.
Forse è importante notare che sto usando l'ereditarietà:
public class MyDbContext : DbContext
{
public DbSet<ForumThread> ForumThreads { get; set; }
public DbSet<ForumPost> ForumPosts { get; set; }
public DbSet<ContentBase> Contents { get; set; }
}
public abstract class ContentBase
{
public Guid Id { get; set; }
public string Content { get; set; }
}
public class GenericContent : ContentBase
{
public virtual string Title { get; set; }
public virtual ICollection<Tag> Tags { get; set; } = new List<Tag>();
}
public class ForumThread : GenericContent {}
public class ForumPost : ContentBase
{
public ForumThread Thread { get; set; }
}
Modo alternativo:
var dbquery = _dbContext.Contents
.Where(c => EF.Functions.FreeText(EF.Property<string>(c, "Content"), "a"));