public void ReusabilityMechanismsClear()
        {
            IImmediateFlowQuery <UserEntity> query = DummyQuery <UserEntity>();

            // reset fetch instructions specified using query.Fetch(..)
            query.ClearFetches();

            // reset group by columns specified using query.GroupBy(..)
            query.ClearGroupBys();

            // reset joins specified using query.Inner/Full/LeftOuter/RightOuter
            query.ClearJoins();

            // reset limit/take/skip specified using query.Take(..)/Skip(..)/Limit(..)
            query.ClearLimit();

            // reset locks specified using query.Lock(..)
            query.ClearLocks();

            // reset orders specified using query.OrderBy(..)/OrderByDescending(..)
            query.ClearOrders();

            // reset restrictions specified using query.Where(..)/And(..)/RestrictByExample(..)
            query.ClearRestrictions();

            // reset timeout specified using query.Timeout(..)/TimeoutAfter(..)
            query.ClearTimeout();
        }
Esempio n. 2
0
        public void SetFetchModeExample4()
        {
            UserGroupLinkEntity groupLink = null;

            IImmediateFlowQuery <UserEntity> query = Session.FlowQuery <UserEntity>()
                                                     .Fetch(x => x.Groups, () => groupLink).Eagerly()
                                                     .Fetch(x => groupLink.Group.Customers).Eagerly();

            // ... code ...
            FlowQuerySelection <UserEntity> users = query
                                                    .ClearFetches()
                                                    .Select();

            Assert.That(users.Count(), Is.EqualTo(4));
        }
Esempio n. 3
0
        public void CanClearFetches()
        {
            IImmediateFlowQuery <UserGroupLinkEntity> query = DummyQuery <UserGroupLinkEntity>();

            var queryable = (IQueryableFlowQuery)query;

            Assert.That(queryable.Fetches.Count, Is.EqualTo(0));

            query.Fetch(x => x.Group).Eagerly();

            Assert.That(queryable.Fetches.Count, Is.EqualTo(1));

            query.Fetch(x => x.Group.Customers).Eagerly();

            Assert.That(queryable.Fetches.Count, Is.EqualTo(2));

            query.ClearFetches();

            Assert.That(queryable.Fetches.Count, Is.EqualTo(0));
        }