/// <summary> /// Converts the <see cref="QueryValue"/> to a particular <see cref="QueryType"/>. /// </summary> /// <param name="type">The type for the As operation.</param> /// <returns>The <see cref="QueryValue"/> converted to the specified type if successful. Returns null if this operation fails.</returns> public override QueryValue TreatAs(QueryType type) { return(this.EvaluationStrategy.Cast(this, type as QueryScalarType)); }
/// <summary> /// Converts the <see cref="QueryValue"/> to a particular <see cref="QueryType"/>. /// </summary> /// <param name="type">The type for the As operation.</param> /// <returns>The <see cref="QueryValue"/> converted to the specified type if successful. Returns null if this operation fails.</returns> public override QueryValue TreatAs(QueryType type) { return(type.CreateErrorValue(new QueryError("Cannot perform TreatAs on a record value"))); }
/// <summary> /// Initializes a new instance of the QueryCollectionType class. /// </summary> /// <param name="elementType">Type of a single element in the collection.</param> /// <param name="evaluationStrategy">The evaluation strategy.</param> protected QueryCollectionType(QueryType elementType, IQueryEvaluationStrategy evaluationStrategy) : base(evaluationStrategy) { this.ElementType = elementType; }
/// <summary> /// Determines whether the type can be assigned from another. /// </summary> /// <param name="queryType">Type to assign from.</param> /// <returns>True if assignment is possible, false otherwise.</returns> public virtual bool IsAssignableFrom(QueryType queryType) { return(object.ReferenceEquals(this, queryType)); }
/// <summary> /// Checks if a <see cref="QueryValue"/> is of a particular <see cref="QueryType"/>. This operation will return a true if the value is of the specified type. /// </summary> /// <param name="type">The type for the IsOf operation.</param> /// <param name="performExactMatch">Determines if an exact match needs to be performed.</param> /// <returns>A <see cref="QueryValue"/> containing true or false depending on whether the value is of the specified type or not.</returns> public override QueryValue IsOf(QueryType type, bool performExactMatch) { return(type.CreateErrorValue(new QueryError("Cannot perform IsOf on a record value"))); }
/// <summary> /// Evaluates member method of a spatial instance. /// </summary> /// <param name="instance">The instance of query value object</param> /// <param name="resultType">The function result type.</param> /// <param name="methodName">The member method to evaluate.</param> /// <param name="arguments">Arguments for the function call.</param> /// <returns>Query value which is the result of function evaluation.</returns> public QueryValue EvaluateMemberMethod(QueryValue instance, QueryType resultType, string methodName, params QueryValue[] arguments) { throw new TaupoNotSupportedException("Attempt to use evaluation strategy from " + typeof(QueryUnresolvedType).Name + ". Please resolve expression first."); }
/// <summary> /// Evaluates member property of a spatial instance. /// </summary> /// <param name="instance">The instance of query value object</param> /// <param name="resultType">The proeprty result type.</param> /// <param name="memberPropertyName">The member property name to evaluate.</param> /// <returns>Query value which is the result of method evaluation.</returns> public QueryValue EvaluateMemberProperty(QueryValue instance, QueryType resultType, string memberPropertyName) { throw new TaupoNotSupportedException("Attempt to use evaluation strategy from " + typeof(QueryUnresolvedType).Name + ". Please resolve expression first."); }
/// <summary> /// Evaluates function import. /// </summary> /// <param name="resultType">The function import result type.</param> /// <param name="functionImport">The function import to evaluate.</param> /// <param name="arguments">The arguments for the function import call.</param> /// <returns>Query value which is the result of function import evaluation.</returns> public QueryValue EvaluateFunctionImport(QueryType resultType, FunctionImport functionImport, params QueryValue[] arguments) { throw new TaupoNotSupportedException("Attempt to use evaluation strategy from " + typeof(QueryUnresolvedType).Name + ". Please resolve expression first."); }
/// <summary> /// Casts a <see cref="QueryValue"/> to a <see cref="QueryType"/>. The cast will return the value type cast to the new type. /// </summary> /// <param name="type">The type for the cast operation.</param> /// <returns><see cref="QueryValue"/> which is cast to the appropriate type</returns> public override QueryValue Cast(QueryType type) { return(type.CreateErrorValue(new QueryError("Cannot perform Cast on a reference value"))); }
/// <summary> /// Initializes a new instance of the QueryExpression class. /// </summary> /// <param name="type">The type of expression.</param> protected QueryExpression(QueryType type) { ExceptionUtilities.CheckArgumentNotNull(type, "type"); this.ExpressionType = type; }