public override Expression Visit(DbOfTypeExpression expression)
 {
     throw new NotImplementedException(
         string.Format(
             ExceptionMessages.DbExpressionTransformationNotImplemented,
             typeof(DbOfTypeExpression).Name));
 }
        public override DbExpression Visit(DbOfTypeExpression expression)
        {
#if DEBUG_VISITS
            System.Diagnostics.Debug.Print("Visit(DbOfTypeExpression): OfType={0}", expression.OfType.EdmType.Name);
#endif

            //  This visitor is called for TPH & TPT entities that need to map from base entity type to the
            //  actual type.  Argument contains the base type expression (i.e. User) and OfType contains the
            //  derived type (i.e. Student).
            //  We need to check for any filters that are defined only on the derived type and apply those filters
            //  here - they will not be detected during the DbScanExpression visitor because those filters will not
            //  exist on the base type.
            //  Filters defined on the base type will be found on both entities.  So we only want to apply the filter
            //  that are defined on the OfType entity that are not defined on the Argument entity (as those will be
            //  applied during the DbScanExpression visitor).
            IEnumerable<DynamicFilterDefinition> scanFilterList = null;
            var scanExp = expression.Argument as DbScanExpression;
            if (scanExp != null)
                scanFilterList = FindFiltersForEntitySet(scanExp.Target.ElementType.MetadataProperties);
            var ofTypeFilterList = FindFiltersForEntitySet(expression.OfType.EdmType.MetadataProperties);
            var filtersToApply = ofTypeFilterList.Where(f => (scanFilterList == null) || !scanFilterList.Any(f2 => f2.ID == f.ID));

            var baseResult = base.Visit(expression);

            if (filtersToApply.Any())
            {
                var binding = DbExpressionBuilder.Bind(baseResult);
                var newFilterExpression = BuildFilterExpressionWithDynamicFilters(filtersToApply, binding, null);
                if (newFilterExpression != null)
                {
                    //  If not null, a new DbFilterExpression has been created with our dynamic filters.
                    return newFilterExpression;
                }
            }

            return baseResult;
        }
Esempio n. 3
0
 public override void Visit(DbOfTypeExpression expression)
 {
     throw new NotSupportedException("Visit(\"OfTypeExpression\") is not supported.");
 }
Esempio n. 4
0
 public override object Visit(DbOfTypeExpression expression)
 {
     this.Visit(expression.Argument);
     return(null);
 }
 public override void Visit(DbOfTypeExpression e)
 {
     VisitExprKind(e.ExpressionKind);
     _key.Append('(');
     e.Argument.Accept(this);
     _key.Append(":");
     _key.Append(e.OfType.EdmType.Identity);
     _key.Append(')');
 }
 public override void Visit(DbOfTypeExpression expression)
 {
     Contract.Requires(expression != null);
 }
 public override void Visit(DbOfTypeExpression e)
 {
     BeginUnary(e);
     Dump(e.OfType, "OfType");
     End(e);
 }
Esempio n. 8
0
        /// <summary>
        ///     <see cref="VisitUnaryExpression" />
        /// </summary>
        /// <param name="expression"> The DbOfTypeExpression that is being visited. </param>
        /// <returns> </returns>
        public override bool Visit(DbOfTypeExpression expression)
        {
            Check.NotNull(expression, "expression");

            return(VisitUnaryExpression(expression));
        }
Esempio n. 9
0
            public override DbExpressionEntitySetInfo Visit(DbOfTypeExpression expression)
            {
                Check.NotNull(expression, "expression");

                return(null);
            }
Esempio n. 10
0
 public override void Visit(DbOfTypeExpression e)
 {
     BeginUnary(e);
     Dump(e.OfType, "OfType");
     End(e);
 }
 public override LegacyCommandTrees.DbExpression Visit(DbOfTypeExpression expression)
 {
     throw new NotImplementedException();
 }
Esempio n. 12
0
 public override void Visit(DbOfTypeExpression expression)
 {
     throw new NotImplementedException();
 }
Esempio n. 13
0
 public override DbExpressionEntitySetInfo Visit(DbOfTypeExpression expression)
 {
     return(null);
 }
 public override IPostgreSqlFragment Visit(DbOfTypeExpression expression)
 {
     throw new NotImplementedException();
 }
Esempio n. 15
0
 public override SqlFragment Visit(DbOfTypeExpression expression)
 {
     throw new NotSupportedException();
 }
 public override ViewValidator.DbExpressionEntitySetInfo Visit(
     DbOfTypeExpression expression)
 {
     Check.NotNull <DbOfTypeExpression>(expression, nameof(expression));
     return((ViewValidator.DbExpressionEntitySetInfo)null);
 }
Esempio n. 17
0
        /// <summary>
        /// Implements the visitor pattern for <see cref="T:System.Data.Common.CommandTrees.DbOfTypeExpression"/>.
        /// </summary>
        /// <param name="expression">The <see cref="T:System.Data.Common.CommandTrees.DbOfTypeExpression"/> that is visited.</param>
        public override void Visit(DbOfTypeExpression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            expression.Argument.Accept(this);
        }
Esempio n. 18
0
 public override bool Visit(DbOfTypeExpression expression)
 {
     return(VisitUnaryExpression(expression));
 }
        public override void Visit(DbOfTypeExpression e)
        {
            Check.NotNull(e, "e");

            BeginUnary(e);
            Dump(e.OfType, "OfType");
            End(e);
        }
 public override void Visit(DbOfTypeExpression expression) { }
        /// <summary>
        ///     Visitor pattern method for <see cref="DbOfTypeExpression" />.
        /// </summary>
        /// <param name="expression"> The DbOfTypeExpression that is being visited. </param>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="expression" />
        ///     is null
        /// </exception>
        public override void Visit(DbOfTypeExpression expression)
        {
            Check.NotNull(expression, "expression");

            VisitUnaryExpression(expression);
        }
Esempio n. 22
0
 /// <summary>
 ///     Visitor pattern method for DbOfTypeExpression.
 /// </summary>
 /// <param name="expression"> The DbOfTypeExpression that is being visited. </param>
 public abstract void Visit(DbOfTypeExpression expression);
Esempio n. 23
0
        public override TReturn Visit(DbOfTypeExpression expression)
        {
            Check.NotNull(expression, "expression");

            throw ConstructNotSupportedException(expression);
        }
		public override void Visit(DbOfTypeExpression expression)
		{
			throw new NotSupportedException("Visit(\"OfTypeExpression\") is not supported.");
		}
 public override void Visit(DbOfTypeExpression expression)
 {
     VisitUnaryExpression(expression);
 }
Esempio n. 26
0
 public override void Visit(DbOfTypeExpression expression)
 {
   VisitUnaryExpression(expression);
 }
Esempio n. 27
0
 /// <summary>
 /// Implements the visitor pattern for <see cref="T:System.Data.Common.CommandTrees.DbOfTypeExpression"/>.
 /// </summary>
 /// <param name="expression">The <see cref="T:System.Data.Common.CommandTrees.DbOfTypeExpression"/> that is visited.</param>
 public override void Visit(DbOfTypeExpression expression)
 {
     expression.Argument.Accept(this);
 }