Beispiel #1
0
        public void ContainsQueryForMemberOfProxiedEntity()
        {
            var ent = new ProxiedEntity()
            {
                Child = new ProxiedEntityChild()
                {
                    Children = new List<AnotherChild>()
                                {
                                    new AnotherChild()
                                        {
                                            Foo = "foo1",
                                        }
                                }
                }

            };

            session.Save(ent);

            session.Flush();

            var child = session.CreateQuery("from AnotherChild c where c.Foo = 'foo1'").UniqueResult<AnotherChild>();

            var query = from p in session.Linq<ProxiedEntity>()
                        where p.Child.Children.Contains(child)
                        select p;

            var result = query.ToList();
            Assert.That(result.Count, Is.EqualTo(1));
        }
Beispiel #2
0
        public void AnyQueryForMemberOfProxiedEntity()
        {
            var ent = new ProxiedEntity()
                        {
                            Child = new ProxiedEntityChild()
                            {
                                Children = new List<AnotherChild>()
                                {
                                    new AnotherChild()
                                        {
                                            Foo = "foo1",
                                        }
                                }
                            }

                        };

            session.Save(ent);

            session.Flush();

            var query = from p in session.Linq<ProxiedEntity>()
                        where p.Child.Children.Any(x => x.Foo == "foo1")
                        select p;

            var result = query.ToList();
            Assert.That(result.Count, Is.EqualTo(1));
        }