/// <summary> /// Initializes a new instance of the <see cref="CastPathSegment" /> class. /// </summary> /// <param name="previous">The previous segment in the path.</param> /// <param name="castType">The type of the cast.</param> public CastPathSegment(ODataPathSegment previous, IEdmEntityType castType) : base(previous) { if (castType == null) { throw Error.ArgumentNull("cast"); } IEdmType previousEdmType = previous.EdmType; if (previousEdmType == null) { throw Error.InvalidOperation(SRResources.PreviousSegmentEdmTypeCannotBeNull); } if (previousEdmType.TypeKind == EdmTypeKind.Collection) { EdmType = castType.GetCollection(); } else { EdmType = castType; } EntitySet = previous.EntitySet; CastType = castType; }