Exemplo n.º 1
0
            static IEnumerable <ObjectParameter> ConvertToObjectParameters(object[] values)
            {
                var parameters = new ObjectParameterCollection();

                foreach (var value in values)
                {
                    parameters.Add(value);
                }

                return(parameters);
            }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a IQueryable&lt;T&gt; in the current object context by using the specified query string.
        /// </summary>
        /// <param name="db">The dataContext execute the query string.</param>
        /// <param name="esql">The query string to be executed.</param>
        /// <param name="parameters">Parameters to pass to the query.</param>
        /// <returns></returns>
        public static IQueryable CreateQuery(this DataContext db, string esql, params ObjectParameter[] parameters)
        {
            var c = new ObjectParameterCollection();

            if (parameters != null)
            {
                foreach (var p in parameters)
                {
                    c.Add(p);
                }
            }

            return(CreateQuery(db, esql, c));
        }