public void Array_All_ILike() { using (LikeAnyContext context = Fixture.CreateContext()) { var collection = new string[] { "a", "b", "c%" }; LikeAnyTestEntity[] _ = context.LikeAnyTestEntities .Where(x => collection.All(y => EF.Functions.ILike(x.Animal, y))) .ToArray(); AssertContainsSql("WHERE x.\"Animal\" ILIKE ALL (@__collection_0) = TRUE"); } }
/// <summary> /// Initializes a <see cref="LikeAnyQueryNpgsqlFixture"/>. /// </summary> public LikeAnyQueryNpgsqlFixture() { TestSqlLoggerFactory = new TestSqlLoggerFactory(); _testStore = NpgsqlTestStore.CreateScratch(); _options = new DbContextOptionsBuilder() .UseNpgsql(_testStore.ConnectionString, b => b.ApplyConfiguration()) .UseInternalServiceProvider( new ServiceCollection() .AddEntityFrameworkNpgsql() .AddSingleton <ILoggerFactory>(TestSqlLoggerFactory) .BuildServiceProvider()) .Options; using (LikeAnyContext context = CreateContext()) { context.Database.EnsureCreated(); context.LikeAnyTestEntities .AddRange( new LikeAnyTestEntity { Id = 1, Animal = "cat" }, new LikeAnyTestEntity { Id = 2, Animal = "dog" }, new LikeAnyTestEntity { Id = 3, Animal = "turtle" }, new LikeAnyTestEntity { Id = 4, Animal = "bird" }); context.SaveChanges(); } }