Ejemplo n.º 1
0
        /// <summary>
        /// Builds the specified linguist.
        /// </summary>
        /// <param name="linguist">The linguist.</param>
        /// <param name="policy">The policy.</param>
        /// <param name="expression">The expression.</param>
        /// <param name="provider">The provider.</param>
        /// <returns></returns>
        public static Expression Build(QueryLinguist linguist, QueryPolicy policy, Expression expression, Expression provider)
        {
            var executor = Expression.Parameter(typeof(QueryExecutor), "executor");
            var builder  = new ExecutionBuilder(linguist, policy, executor);

            builder.variables.Add(executor);
            builder.initializers.Add(Expression.Call(Expression.Convert(provider, typeof(ICreateExecutor)), "CreateExecutor", null, null));
            var result = builder.Build(expression);

            return(result);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueryTranslator"/> class.
 /// </summary>
 /// <param name="language">The language.</param>
 /// <param name="mapping">The mapping.</param>
 /// <param name="policy">The policy.</param>
 public QueryTranslator(QueryLanguage language, SauceMapping mapping, QueryPolicy policy)
 {
     this.Linguist = language.CreateLinguist(this);
     this.Mapper   = mapping.CreateMapper(this);
     this.Police   = policy.CreatePolice(this);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueryPolice"/> class.
 /// </summary>
 /// <param name="policy">The policy.</param>
 /// <param name="translator">The translator.</param>
 public QueryPolice(QueryPolicy policy, QueryTranslator translator)
 {
     this.Policy     = policy;
     this.Translator = translator;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Prevents a default instance of the <see cref="ExecutionBuilder"/> class from being created.
 /// </summary>
 /// <param name="linguist">The linguist.</param>
 /// <param name="policy">The policy.</param>
 /// <param name="executor">The executor.</param>
 private ExecutionBuilder(QueryLinguist linguist, QueryPolicy policy, Expression executor)
 {
     this.linguist = linguist;
     this.policy   = policy;
     this.executor = executor;
 }