Exemple #1
0
 public void SetUp()
 {
     _holidaysMember         = typeof(Cook).GetProperty("Holidays");
     _assistantsMember       = typeof(Cook).GetProperty("Assistants");
     _assistantsFetchRequest = new TestFetchRequest(_assistantsMember);
     _cookFromKitchenQuery   = (from sd in ExpressionHelper.CreateQueryable <Kitchen> ()
                                select sd.Cook).Take(1);
     _cookFromKitchenQueryModel = ExpressionHelper.ParseQuery(_cookFromKitchenQuery);
 }
Exemple #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)"));
        }
Exemple #3
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);
        }
        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);
        }