ResolvingSelectExpressionVisitor is used to resolve sql select projection expressions in the mapping resolutin stage.
Inheritance: ResolvingExpressionVisitor
示例#1
0
        public virtual Expression ResolveSelectExpression(Expression expression, SqlStatementBuilder sqlStatementBuilder, IMappingResolutionContext context)
        {
            ArgumentUtility.CheckNotNull("expression", expression);
            ArgumentUtility.CheckNotNull("sqlStatementBuilder", sqlStatementBuilder);
            ArgumentUtility.CheckNotNull("context", context);

            var resolvedExpression = ResolvingSelectExpressionVisitor.ResolveExpression(expression, _resolver, this, context, _uniqueIdentifierGenerator, sqlStatementBuilder);

            return(ApplyContext(resolvedExpression, SqlExpressionContext.ValueRequired, context));
        }
    public static Expression ResolveExpression (
        Expression expression,
        IMappingResolver resolver,
        IMappingResolutionStage stage,
        IMappingResolutionContext context,
        UniqueIdentifierGenerator generator,
        SqlStatementBuilder sqlStatementBuilder)
    {
      ArgumentUtility.CheckNotNull ("expression", expression);
      ArgumentUtility.CheckNotNull ("resolver", resolver);
      ArgumentUtility.CheckNotNull ("stage", stage);
      ArgumentUtility.CheckNotNull ("context", context);
      ArgumentUtility.CheckNotNull ("generator", generator);
      ArgumentUtility.CheckNotNull ("sqlStatementBuilder", sqlStatementBuilder);

      var entityIdentityResolver = new EntityIdentityResolver (stage, resolver, context);
      var comparisonSplitter = new CompoundExpressionComparisonSplitter ();
      var namedExpressionCombiner = new NamedExpressionCombiner (context);
      var groupAggregateSimplifier = new GroupAggregateSimplifier (stage, context);

      var visitor1 = new ResolvingSelectExpressionVisitor (
          resolver,
          stage,
          context,
          generator,
          entityIdentityResolver,
          comparisonSplitter,
          namedExpressionCombiner,
          groupAggregateSimplifier,
          false,
          sqlStatementBuilder);
      var result1 = visitor1.VisitExpression (expression);

      var visitor2 = new ResolvingSelectExpressionVisitor (
          resolver,
          stage,
          context,
          generator,
          entityIdentityResolver,
          comparisonSplitter,
          namedExpressionCombiner,
          groupAggregateSimplifier,
          true,
          sqlStatementBuilder);
      var result2 = visitor2.VisitExpression (result1);

      return result2;
    }
示例#3
0
        public static Expression ResolveExpression(
            Expression expression,
            IMappingResolver resolver,
            IMappingResolutionStage stage,
            IMappingResolutionContext context,
            UniqueIdentifierGenerator generator,
            SqlStatementBuilder sqlStatementBuilder)
        {
            ArgumentUtility.CheckNotNull("expression", expression);
            ArgumentUtility.CheckNotNull("resolver", resolver);
            ArgumentUtility.CheckNotNull("stage", stage);
            ArgumentUtility.CheckNotNull("context", context);
            ArgumentUtility.CheckNotNull("generator", generator);
            ArgumentUtility.CheckNotNull("sqlStatementBuilder", sqlStatementBuilder);

            var entityIdentityResolver   = new EntityIdentityResolver(stage, resolver, context);
            var comparisonSplitter       = new CompoundExpressionComparisonSplitter();
            var namedExpressionCombiner  = new NamedExpressionCombiner(context);
            var groupAggregateSimplifier = new GroupAggregateSimplifier(stage, context);

            var visitor1 = new ResolvingSelectExpressionVisitor(
                resolver,
                stage,
                context,
                generator,
                entityIdentityResolver,
                comparisonSplitter,
                namedExpressionCombiner,
                groupAggregateSimplifier,
                false,
                sqlStatementBuilder);
            var result1 = visitor1.Visit(expression);

            var visitor2 = new ResolvingSelectExpressionVisitor(
                resolver,
                stage,
                context,
                generator,
                entityIdentityResolver,
                comparisonSplitter,
                namedExpressionCombiner,
                groupAggregateSimplifier,
                true,
                sqlStatementBuilder);
            var result2 = visitor2.Visit(result1);

            return(result2);
        }