예제 #1
0
 public OpenEdgeParameterExtractingExpressionVisitor(IEvaluatableExpressionFilter evaluatableExpressionFilter,
                                                     IParameterValues parameterValues,
                                                     IDiagnosticsLogger <DbLoggerCategory.Query> logger,
                                                     DbContext context,
                                                     bool parameterize, bool
                                                     generateContextAccessors = false)
     : base(evaluatableExpressionFilter, parameterValues, logger, context, parameterize, generateContextAccessors)
 {
 }
 public CalculatedValuesMenuItem(
     IParameterValues parameterValues,
     IOutputWindow outputWindow,
     ILoader loader,
     IMessageBox messageBox) : base("view calculated values", 1)
 {
     this.parameterValues = parameterValues;
     this.outputWindow    = outputWindow;
     this.loader          = loader;
     this.messageBox      = messageBox;
 }
 public AseParameterExtractingExpressionVisitor(IEvaluatableExpressionFilter evaluatableExpressionFilter,
                                                IParameterValues parameterValues,
                                                Type contextType,
                                                IModel model,
                                                IDiagnosticsLogger <DbLoggerCategory.Query> logger,
                                                bool parameterize,
                                                bool generateContextAccessors)
     : base(evaluatableExpressionFilter, parameterValues, contextType, model, logger, parameterize, generateContextAccessors)
 {
     _evaluatableExpressions = (IDictionary <Expression, bool>)(typeof(ParameterExtractingExpressionVisitor).GetField("_evaluatableExpressions", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this));
 }
 public ExportValuesButton(
     IMessageBox messageBox,
     IParameterValues parameterValues,
     IValuesExport valuesExport,
     ILoader loader)
 {
     this.messageBox      = messageBox;
     this.parameterValues = parameterValues;
     this.valuesExport    = valuesExport;
     this.loader          = loader;
 }
 public ExpressionVisitor(
     QueryCompilationContext compilationContext,
     IQueryModelGenerator generator,
     EntityQueryModelVisitor visitor) :
     base(compilationContext, generator, visitor)
 {
     this.compilationContext = compilationContext;
     this.generator          = generator;
     instanceFilters         = filters.Value;
     parameters = (IParameterValues)parameterField.GetValue(this);
 }
        public override Expression ExtractParameters(Expression query, IParameterValues parameterValues, IDiagnosticsLogger <DbLoggerCategory.Query> logger, bool parameterize = true, bool generateContextAccessors = false)
        {
            var visitor = new AseParameterExtractingExpressionVisitor(
                (IEvaluatableExpressionFilter)(typeof(QueryCompiler).GetField("_evaluatableExpressionFilter", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this)),
                parameterValues,
                (Type)(typeof(QueryCompiler).GetField("_contextType", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this)),
                (IModel)(typeof(QueryCompiler).GetField("_model", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this)),
                logger,
                parameterize,
                generateContextAccessors);

            return(visitor.ExtractParameters(query));
        }
 /// <summary>
 ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
 ///     directly from your code. This API may change or be removed in future releases.
 /// </summary>
 public ParameterExtractingExpressionVisitor(
     [NotNull] IEvaluatableExpressionFilter evaluatableExpressionFilter,
     [NotNull] IParameterValues parameterValues,
     [NotNull] IDiagnosticsLogger <DbLoggerCategory.Query> logger,
     bool parameterize,
     bool generateContextAccessors = false)
 {
     _evaluatableExpressionFilter = evaluatableExpressionFilter;
     _parameterValues             = parameterValues;
     _logger                   = logger;
     _parameterize             = parameterize;
     _generateContextAccessors = generateContextAccessors;
 }
        private Expression ExtractParameters(
            Expression query,
            IParameterValues parameterValues,
            bool parameterize             = true,
            bool generateContextAccessors = false)
        {
            var visitor
                = new ParameterExtractingExpressionVisitor(
                      this.evaluatableExpressionFilter,
                      parameterValues,
                      this.logger,
                      this.currentDbContext.Context,
                      parameterize,
                      generateContextAccessors);

            return(visitor.ExtractParameters(query));
        }
예제 #9
0
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public virtual Expression ExtractParameters(
            [NotNull] Expression query,
            [NotNull] IParameterValues parameterValues,
            [NotNull] IDiagnosticsLogger <DbLoggerCategory.Query> logger,
            bool parameterize             = true,
            bool generateContextAccessors = false)
        {
            var visitor = new ParameterExtractingExpressionVisitor(
                _evaluatableExpressionFilter,
                parameterValues,
                _contextType,
                logger,
                parameterize,
                generateContextAccessors);

            return(visitor.ExtractParameters(query));
        }
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public virtual Expression ExtractParameters(
            IDiagnosticsLogger <DbLoggerCategory.Query> logger,
            Expression query,
            IParameterValues parameterValues,
            bool parameterize             = true,
            bool generateContextAccessors = false)
        {
            Check.NotNull(query, nameof(query));
            Check.NotNull(parameterValues, nameof(parameterValues));

            var visitor
                = new ParameterExtractingExpressionVisitor(
                      _evaluatableExpressionFilter,
                      parameterValues,
                      logger,
                      parameterize,
                      generateContextAccessors);

            return(visitor.ExtractParameters(query));
        }
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public ParameterExtractingExpressionVisitor(
     IEvaluatableExpressionFilter evaluatableExpressionFilter,
     IParameterValues parameterValues,
     Type contextType,
     IDiagnosticsLogger <DbLoggerCategory.Query> logger,
     bool parameterize,
     bool generateContextAccessors)
 {
     _evaluatableExpressionFindingExpressionVisitor
         = new EvaluatableExpressionFindingExpressionVisitor(evaluatableExpressionFilter);
     _parameterValues          = parameterValues;
     _logger                   = logger;
     _parameterize             = parameterize;
     _generateContextAccessors = generateContextAccessors;
     if (_generateContextAccessors)
     {
         _contextParameterReplacingExpressionVisitor
             = new ContextParameterReplacingExpressionVisitor(contextType);
     }
 }
예제 #12
0
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public ParameterExtractingExpressionVisitor(
            [NotNull] IEvaluatableExpressionFilter evaluatableExpressionFilter,
            [NotNull] IParameterValues parameterValues,
            [NotNull] IDiagnosticsLogger <DbLoggerCategory.Query> logger,
            [NotNull] DbContext context,
            bool parameterize,
            bool generateContextAccessors = false)
        {
            _evaluatableExpressionFilter = evaluatableExpressionFilter;
            _parameterValues             = parameterValues;
            _logger                   = logger;
            _parameterize             = parameterize;
            _generateContextAccessors = generateContextAccessors;
            _queryProvider            = context.GetDependencies().QueryProvider;

            if (_generateContextAccessors)
            {
                _contextParameterReplacingExpressionVisitor
                    = new ContextParameterReplacingExpressionVisitor(context.GetType());
            }
        }
예제 #13
0
 public ParameterExtractingExpressionVisitor(
     [NotNull] IEvaluatableExpressionFilter evaluatableExpressionFilter,
     [NotNull] IParameterValues parameterValues,
     [NotNull] Type contextType,
     [NotNull] IModel model,
     [NotNull] IDiagnosticsLogger <DbLoggerCategory.Query> logger,
     bool parameterize,
     bool generateContextAccessors)
 {
     _evaluatableExpressionFindingExpressionVisitor
         = new EvaluatableExpressionFindingExpressionVisitor(evaluatableExpressionFilter, model, parameterize);
     _parameterValues          = parameterValues;
     _logger                   = logger;
     _parameterize             = parameterize;
     _generateContextAccessors = generateContextAccessors;
     // The entry method will take care of populating this field always. So accesses should be safe.
     _evaluatableExpressions = null !;
     // TODO: Use MemberNotNullWhen
     // Value won't be accessed when condition is not met.
     _contextParameterReplacingExpressionVisitor = _generateContextAccessors
         ? new ContextParameterReplacingExpressionVisitor(contextType)
         : null !;
 }
예제 #14
0
 public override Expression ExtractParameters(Expression query, IParameterValues parameterValues, IDiagnosticsLogger <DbLoggerCategory.Query> logger,
                                              bool parameterize = true, bool generateContextAccessors = false)
 {
     return(query);
 }
예제 #15
0
 /// <param name="parameterValues">
 /// Calculated parameter values.
 /// </param>
 public ParameterValuesController(IParameterValues parameterValues) => this.parameterValues = parameterValues;
예제 #16
0
 public override Expression ExtractParameters(IDiagnosticsLogger <DbLoggerCategory.Query> logger, Expression query, IParameterValues parameterValues,
                                              bool parameterize = true, bool generateContextAccessors = false)
 {
     return(new OpenEdgeParameterExtractingExpressionVisitor(_evaluatableExpressionFilter, parameterValues, logger,
                                                             _currentDbContext.Context,
                                                             parameterize, generateContextAccessors).ExtractParameters(query));
 }
예제 #17
0
        /// <summary>
        /// Adds a parameter so EF query cache treats queries for different tenants as different queries.
        /// </summary>
        /// <param name="ctx"></param>
        private void AddTenantParameter(IParameterValues ctx)
        {
            var tenantDatabaseProvider = _tenantDatabaseProviderFactory.Create();

            ctx.AddParameter($"{_TENANT_PARAM_PREFIX}|{tenantDatabaseProvider.Tenant}", null);
        }