Beispiel #1
0
        public static bool Validate(QuerySpecification querySpecification, bool throwIfHasError = false)
        {
            var validators = new QuerySpecificationValidator[]
            {
                new ExpressionNameTypeValidator(querySpecification)
            };

            return(Validate(throwIfHasError, validators));
        }
 public DelegatedQuerySpecificationVisitor(
     QuerySpecification querySpecification,
     Action <Expression> visitExpression,
     Action <LogicalOperation> visitLogicalOperation,
     Action <UnaryLogicalOperation> visitUnaryLogicalOperation)
     : base(querySpecification)
 {
     this._visitExpression            = visitExpression;
     this._visitLogicalOperation      = visitLogicalOperation;
     this._visitUnaryLogicalOperation = visitUnaryLogicalOperation;
 }
 /// <summary>
 /// Deserializes workflow markup into an QuerySpecification object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output QuerySpecification object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out QuerySpecification obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(QuerySpecification);
     try
     {
         obj = Deserialize(xml);
         return(true);
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
 /// <summary>
 /// Deserializes xml markup from file into an QuerySpecification object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output QuerySpecification object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out QuerySpecification obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(QuerySpecification);
     try
     {
         obj = LoadFromFile(fileName);
         return(true);
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
Beispiel #5
0
        /// <summary>
        /// 将给定的查询规约编译成另外一种形式。
        /// </summary>
        /// <param name="querySpecification">将被编译的查询规约。</param>
        /// <returns>查询规约的另外一种形式。</returns>
        public T Compile(QuerySpecification querySpecification)
        {
            try
            {
                QuerySpecificationValidator.Validate(querySpecification, true);
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException(
                          "Can't compile the given query specificaiton as the validation was failed. See InnerException for details.",
                          ex);
            }

            return(this.PerformCompile(querySpecification));
        }
Beispiel #6
0
 protected QuerySpecificationVisitor(QuerySpecification querySpecification)
 {
     this._querySpecification = querySpecification;
 }
 public static bool LoadFromFile(string fileName, out QuerySpecification obj)
 {
     System.Exception exception = null;
     return(LoadFromFile(fileName, out obj, out exception));
 }
 public static bool Deserialize(string xml, out QuerySpecification obj)
 {
     System.Exception exception = null;
     return(Deserialize(xml, out obj, out exception));
 }
Beispiel #9
0
 protected QuerySpecificationValidator(QuerySpecification querySpecification)
     : base(querySpecification)
 {
 }
Beispiel #10
0
 /// <summary>
 /// 将给定的查询规约编译成另外一种形式。
 /// </summary>
 /// <param name="querySpecification">将被编译的查询规约。</param>
 /// <returns>查询规约的另外一种形式。</returns>
 protected abstract T PerformCompile(QuerySpecification querySpecification);
Beispiel #11
0
 /// <summary>
 /// 将给定的查询规约编译成另外一种形式。
 /// </summary>
 /// <param name="querySpecification">将被编译的查询规约。</param>
 /// <returns>查询规约的另外一种形式。</returns>
 object IQuerySpecificationCompiler.Compile(QuerySpecification querySpecification)
 {
     return(this.Compile(querySpecification));
 }