Esempio n. 1
0
        public void GetOrAddInnerFetchRequest()
        {
            Assert.That(_assistantsFetchRequest.InnerFetchRequests, Is.Empty);

            var result = _assistantsFetchRequest.GetOrAddInnerFetchRequest(new FetchManyRequest(_holidaysMember));

            Assert.That(result.RelationMember, Is.SameAs(_holidaysMember));
            Assert.That(_assistantsFetchRequest.InnerFetchRequests, Is.EqualTo(new[] { result }));
        }
Esempio n. 2
0
        public void ToString_ThenFetch()
        {
            var cookMember        = typeof(Kitchen).GetProperty("Cook");
            var outerFetchRequest = new TestFetchRequest(cookMember);

            outerFetchRequest.GetOrAddInnerFetchRequest(_assistantsFetchRequest);

            var result = outerFetchRequest.ToString();

            Assert.That(result, Is.EqualTo("Fetch (Kitchen.Cook).ThenFetch (Cook.Assistants)"));
        }
        public void SetUp()
        {
            _friendsMember = typeof(Cook).GetProperty("Assistants");
            _hasDogMember  = typeof(Cook).GetProperty("IsStarredCook");
            _scoresMember  = typeof(Cook).GetProperty("Holidays");
            _isOldMember   = typeof(Cook).GetProperty("IsFullTimeCook");

            _outerFetchRequest  = new TestFetchRequest(_friendsMember);
            _innerFetchRequest1 = new TestFetchRequest(_hasDogMember);
            _outerFetchRequest.GetOrAddInnerFetchRequest(_innerFetchRequest1);
            _innerFetchRequest2 = new TestFetchRequest(_scoresMember);
            _outerFetchRequest.GetOrAddInnerFetchRequest(_innerFetchRequest2);
            _innerInnerFetchRequest = new TestFetchRequest(_isOldMember);
            _innerFetchRequest1.GetOrAddInnerFetchRequest(_innerInnerFetchRequest);

            var expression = ExpressionHelper.MakeExpression(() => (from sd in ExpressionHelper.CreateQueryable <Kitchen> ()
                                                                    select sd.Cook).Take(1) /*.Fetch*/.Distinct().Count());

            _sourceItemQueryModel        = ExpressionHelper.ParseQuery(expression);
            _outerFetchQueryModelBuilder = new FetchQueryModelBuilder(_outerFetchRequest, _sourceItemQueryModel, 1);
        }
Esempio n. 4
0
        public override ResultOperatorBase Clone(CloneContext cloneContext)
        {
            ArgumentUtility.CheckNotNull("cloneContext", cloneContext);

            var clone = new TestFetchRequest(RelationMember);

            foreach (var innerFetchRequest in clone.InnerFetchRequests)
            {
                clone.GetOrAddInnerFetchRequest((FetchRequestBase)innerFetchRequest.Clone(cloneContext));
            }

            return(clone);
        }