Ejemplo n.º 1
0
        /// <summary>
        /// Executes the query specified by the expression parameter.
        /// </summary>
        /// <typeparam name="T">Type for the result objects.</typeparam>
        /// <param name="expression">Expression representing the query.</param>
        /// <returns>Query results.</returns>
        public IEnumerator <T> ExecuteQuery <T>(Expression expression)
        {
            CheckDisposed();

            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            CamlQuery query = CamlQuery.Parse(expression, false);

            return(query.Execute <T>().GetEnumerator());
        }
Ejemplo n.º 2
0
        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            //
            // Any errors in the validation parser mode (second parameter set to true) are considered fatal.
            //
            CamlQuery query = CamlQuery.Parse(_expression, true);

            //
            // Store the CAML query and the entity name.
            //
            info.AddValue("Caml", query.ToString());
            info.AddValue("Entity", query._results.EntityType.Name);

            //
            // Store errors, if any.
            //
            if (query._errors != null)
            {
                info.AddValue("Errors", query._errors);
                info.AddValue("Linq", query._errors.Expression);
            }
        }