Translate() 공개 정적인 메소드

A translator from LINQ queries to MongoDB queries.
public static Translate ( MongoCollection collection, Expression expression ) : TranslatedQuery
collection MongoCollection The collection being queried.
expression System.Linq.Expressions.Expression The LINQ query.
리턴 TranslatedQuery
예제 #1
0
        // public methods
        /// <summary>
        /// Builds the MongoDB query that will be sent to the server when the LINQ query is executed.
        /// </summary>
        /// <typeparam name="T">The type of the documents being queried.</typeparam>
        /// <param name="query">The LINQ query.</param>
        /// <returns>The MongoDB query.</returns>
        public IMongoQuery BuildMongoQuery <T>(MongoQueryable <T> query)
        {
            var translatedQuery = MongoQueryTranslator.Translate(this, ((IQueryable)query).Expression);

            return(((SelectQuery)translatedQuery).BuildQuery());
        }
예제 #2
0
        /// <summary>
        /// Gets a string representation of the LINQ expression translated to a MongoDB query.
        /// </summary>
        /// <param name="expression">The LINQ expression.</param>
        /// <returns>A string.</returns>
        public string GetQueryText(Expression expression)
        {
            var translatedQuery = MongoQueryTranslator.Translate(_collection, expression);

            return(translatedQuery.ToString());
        }