/// <summary> /// Create a clone of the ResourceExpression. /// </summary> /// <returns>The new clone.</returns> internal override ResourceExpression CreateCloneResourceExpression() { QueryableResourceExpression clone = this.CreateClone(); if (this.keyPredicateConjuncts != null && this.keyPredicateConjuncts.Count > 0) { clone.SetKeyPredicate(this.keyPredicateConjuncts); } clone.keyFilter = this.keyFilter; clone.sequenceQueryOptions = this.sequenceQueryOptions; clone.transparentScope = this.transparentScope; return(clone); }
/// <summary> /// Create a clone with new type. /// </summary> /// <param name="type">The type.</param> /// <returns>The new clone.</returns> internal override ResourceExpression CreateCloneWithNewType(Type type) { QueryableResourceExpression clone = this.CreateCloneWithNewTypes(type, TypeSystem.GetElementType(type)); if (this.keyPredicateConjuncts != null && this.keyPredicateConjuncts.Count > 0) { clone.SetKeyPredicate(this.keyPredicateConjuncts); } clone.keyFilter = this.keyFilter; clone.sequenceQueryOptions = this.sequenceQueryOptions; clone.transparentScope = this.transparentScope; return(clone); }
/// <summary> /// Cast QueryableResourceExpression to new type without affecting member type /// </summary> /// <param name="type">The new expression type</param> /// <returns>A copy of this with the new types</returns> internal QueryableResourceExpression CreateCloneForTransparentScope(Type type) { // QueryableResourceExpression can always have order information, // so return them as IOrderedQueryable<> always. Necessary to allow // OrderBy results that get aliased to a previous expression work // with ThenBy. Type elementType = TypeSystem.GetElementType(type); Debug.Assert(elementType != null, "elementType != null -- otherwise the set isn't going to act like a collection"); Type newType = typeof(IOrderedQueryable <>).MakeGenericType(elementType); QueryableResourceExpression clone = this.CreateCloneWithNewTypes(newType, this.ResourceType); if (this.keyPredicateConjuncts != null && this.keyPredicateConjuncts.Count > 0) { clone.SetKeyPredicate(this.keyPredicateConjuncts); } clone.keyFilter = this.keyFilter; clone.sequenceQueryOptions = this.sequenceQueryOptions; clone.transparentScope = this.transparentScope; return(clone); }