public void LTree_contained_by_any_LTree() { using var ctx = CreateContext(); var ltrees = new LTree[] { "Top.Science.Astronomy", "Top.Art" }; var count = ctx.LTreeEntities.Count(l => ltrees.Any(t => t.IsDescendantOf(l.Path))); Assert.Equal(3, count); AssertSql( @"@__ltrees_0='System.String[]' (DbType = Object) SELECT COUNT(*)::INT FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 <@ l.""Path"""); }
public void LTree_contains_any_LTree() { using var ctx = CreateContext(); var ltrees = new LTree[] { "Top.Science", "Top.Art" }; var count = ctx.LTreeEntities.Count(l => ltrees.Any(t => t.IsAncestorOf(l.Path))); Assert.Equal(4, count); AssertSql( @"@__ltrees_0={ 'Top.Science', 'Top.Art' } (DbType = Object) SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 @> l.""Path"""); }
public void Any_LTree_matches_LTxtQuery() { using var ctx = CreateContext(); var ltrees = new LTree[] { "Top.Science.Astronomy.Astrophysics", "Top.Science.Astronomy.Cosmology" }; _ = ctx.LTreeEntities.Count(_ => ltrees.Any(t => t.MatchesLTxtQuery("Astro*"))); AssertSql( @"@__ltrees_0='System.String[]' (DbType = Object) SELECT COUNT(*)::INT FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 @ 'Astro*'"); }
public void Any_LTree_matches_LQuery() { using var ctx = CreateContext(); var ltrees = new LTree[] { "Top.Science.Astronomy.Astrophysics", "Top.Science.Astronomy.Cosmology" }; _ = ctx.LTreeEntities.Count(_ => ltrees.Any(t => t.MatchesLQuery("*.Astrophysics"))); AssertSql( @"@__ltrees_0={ 'Top.Science.Astronomy.Astrophysics', 'Top.Science.Astronomy.Cosmology' } (DbType = Object) SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 ~ '*.Astrophysics'"); }
public void Any_LTree_matches_any_LQuery() { using var ctx = CreateContext(); var ltrees = new LTree[] { "Top.Science.Astronomy.Astrophysics", "Top.Science.Astronomy.Cosmology" }; var lqueries = new[] { "*.Astrophysics", "*.Geology" }; _ = ctx.LTreeEntities.Count(_ => ltrees.Any(t => lqueries.Any(q => t.MatchesLQuery(q)))); AssertSql( @"@__ltrees_0={ 'Top.Science.Astronomy.Astrophysics', 'Top.Science.Astronomy.Cosmology' } (DbType = Object) @__lqueries_1={ '*.Astrophysics', '*.Geology' } (DbType = Object) SELECT COUNT(*)::INT FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 ? @__lqueries_1"); }