Пример #1
0
        public void CanRightOuterJoinCollectionWithRevealAndLambdas()
        {
            Reveal.SetDefaultConvention(x => x);

            UserGroupLinkEntity     link         = null;
            GroupEntity             group        = null;
            CustomerGroupLinkEntity customerLink = null;
            CustomerEntity          customer     = null;

            FlowQuerySelection <string> groups1 = Query <UserEntity>()
                                                  .RightOuter.Join(u => u.Groups, () => link)
                                                  .RightOuter.Join(u => link.Group, () => group)
                                                  .RightOuter.Join(u => group.Customers, () => customerLink)
                                                  .RightOuter.Join(u => customerLink.Customer, () => customer)
                                                  .Distinct()
                                                  .Select(u => customer.Name);

            Assert.That(groups1.Count(), Is.EqualTo(4));

            FlowQuerySelection <string> groups2 = Query <UserEntity>()
                                                  .RightOuter.Join(u => u.Groups, () => link, () => link.Id == null)
                                                  .RightOuter.Join(u => link.Group, () => group, () => group.Id == null)
                                                  .RightOuter.Join(u => group.Customers, () => customerLink, () => customerLink.Id == null)
                                                  .RightOuter.Join(u => customerLink.Customer, () => customer, () => customer.Id == null)
                                                  .Distinct()
                                                  .Select(u => customer.Name);

            Assert.That(groups2.Count(), Is.EqualTo(4));

            Reveal.ClearDefaultConvention();
        }
Пример #2
0
        public void CanJoinWithRevealAndLambdas()
        {
            Reveal.SetDefaultConvention(x => x);

            UserGroupLinkEntity link  = null;
            GroupEntity         group = null;

            var groups = Query <UserEntity>()
                         .Inner.Join(u => u.Groups, () => link)
                         .Inner.Join(u => link.Group, () => group)
                         .Distinct()
                         .Select(u => new { group.Id });

            Assert.That(groups.Count(), Is.EqualTo(2));

            Reveal.ClearDefaultConvention();
        }
Пример #3
0
        public void CanRightOuterJoinWithRevealAndLambdas()
        {
            Reveal.SetDefaultConvention(x => x);

            UserGroupLinkEntity link  = null;
            GroupEntity         group = null;

            IDetachedFlowQuery <UserEntity> query = DetachedQuery <UserEntity>()
                                                    .RightOuter.Join(u => u.Groups, () => link)
                                                    .RightOuter.Join(u => link.Group, () => group)
                                                    .Select(u => group.Id);

            FlowQuerySelection <GroupEntity> groups = Query <GroupEntity>()
                                                      .Where(g => g.Id, FqIs.In(query))
                                                      .Select();

            Assert.That(groups.Count(), Is.EqualTo(2));

            Reveal.ClearDefaultConvention();
        }
Пример #4
0
        public void CanRightOuterJoinCollectionWithRevealAndLambdas()
        {
            Reveal.SetDefaultConvention(x => x);

            UserGroupLinkEntity     link         = null;
            GroupEntity             group        = null;
            CustomerGroupLinkEntity customerLink = null;
            CustomerEntity          customer     = null;

            IDetachedFlowQuery <UserEntity> query = DetachedQuery <UserEntity>()
                                                    .RightOuter.Join(u => u.Groups, () => link)
                                                    .RightOuter.Join(u => link.Group, () => group)
                                                    .RightOuter.Join(u => group.Customers, () => customerLink)
                                                    .RightOuter.Join(u => customerLink.Customer, () => customer)
                                                    .Distinct()
                                                    .Select(u => customer.Name);

            FlowQuerySelection <CustomerEntity> customers = Query <CustomerEntity>()
                                                            .Where(g => g.Name, FqIs.In(query))
                                                            .Select();

            Assert.That(customers.Count(), Is.EqualTo(4));

            IDetachedFlowQuery <UserEntity> query2 = DetachedQuery <UserEntity>()
                                                     .RightOuter.Join(u => u.Groups, () => link, () => link.Id == 0)
                                                     .RightOuter.Join(x => link.Group, () => group, () => group.Id == 0)
                                                     .RightOuter.Join(u => group.Customers, () => customerLink, () => customerLink.Id == 0, null)
                                                     .RightOuter.Join(u => customerLink.Customer, () => customer, () => customer.Id == 0)
                                                     .Distinct()
                                                     .Select(u => customer.Name);

            FlowQuerySelection <CustomerEntity> customers2 = Query <CustomerEntity>()
                                                             .Where(g => g.Name, FqIs.In(query2))
                                                             .Select();

            Assert.That(customers2.Count(), Is.EqualTo(4));

            Reveal.ClearDefaultConvention();
        }
Пример #5
0
        public void CanRightOuterJoinWithRevealAndLambdas()
        {
            Reveal.SetDefaultConvention(x => x);

            UserGroupLinkEntity link  = null;
            GroupEntity         group = null;

            var groups1 = Query <UserEntity>()
                          .RightOuter.Join(u => u.Groups, () => link)
                          .RightOuter.Join(u => link.Group, () => group)
                          .Select(u => new { group.Id });

            Assert.That(groups1.Count(), Is.EqualTo(5));

            var groups2 = Query <UserEntity>()
                          .RightOuter.Join(u => u.Groups, () => link, () => link.Id == null)
                          .RightOuter.Join(u => link.Group, () => group, () => group.Id == null)
                          .Select(u => new { group.Id });

            Assert.That(groups2.Count(), Is.EqualTo(2));

            Reveal.ClearDefaultConvention();
        }
Пример #6
0
 public void TearDown()
 {
     Reveal.ClearDefaultConvention();
 }