Mixing Raw SQL with Linq #
Combine your Linq queries with raw SQL using the MatchesSql(sql)
method like so:
cs
[Fact]
public void query_with_matches_sql()
{
using (var session = theStore.OpenSession())
{
var u = new User {FirstName = "Eric", LastName = "Smith"};
session.Store(u);
session.SaveChanges();
var user = session.Query<User>().Where(x => x.MatchesSql("data->> 'FirstName' = ?", "Eric")).Single();
user.LastName.ShouldBe("Smith");
user.Id.ShouldBe(u.Id);
}
}