コード例 #1
0
 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;
        }
コード例 #3
0
 public override void Visit(DbOfTypeExpression expression)
 {
     throw new NotSupportedException("Visit(\"OfTypeExpression\") is not supported.");
 }
コード例 #4
0
 public override object Visit(DbOfTypeExpression expression)
 {
     this.Visit(expression.Argument);
     return(null);
 }
コード例 #5
0
 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(')');
 }
コード例 #6
0
 public override void Visit(DbOfTypeExpression expression)
 {
     Contract.Requires(expression != null);
 }
コード例 #7
0
 public override void Visit(DbOfTypeExpression e)
 {
     BeginUnary(e);
     Dump(e.OfType, "OfType");
     End(e);
 }
コード例 #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));
        }
コード例 #9
0
            public override DbExpressionEntitySetInfo Visit(DbOfTypeExpression expression)
            {
                Check.NotNull(expression, "expression");

                return(null);
            }
コード例 #10
0
 public override void Visit(DbOfTypeExpression e)
 {
     BeginUnary(e);
     Dump(e.OfType, "OfType");
     End(e);
 }
コード例 #11
0
 public override LegacyCommandTrees.DbExpression Visit(DbOfTypeExpression expression)
 {
     throw new NotImplementedException();
 }
コード例 #12
0
 public override void Visit(DbOfTypeExpression expression)
 {
     throw new NotImplementedException();
 }
コード例 #13
0
ファイル: ViewValidator.cs プロジェクト: longde123/playscript
 public override DbExpressionEntitySetInfo Visit(DbOfTypeExpression expression)
 {
     return(null);
 }
コード例 #14
0
 public override IPostgreSqlFragment Visit(DbOfTypeExpression expression)
 {
     throw new NotImplementedException();
 }
コード例 #15
0
 public override SqlFragment Visit(DbOfTypeExpression expression)
 {
     throw new NotSupportedException();
 }
コード例 #16
0
 public override ViewValidator.DbExpressionEntitySetInfo Visit(
     DbOfTypeExpression expression)
 {
     Check.NotNull <DbOfTypeExpression>(expression, nameof(expression));
     return((ViewValidator.DbExpressionEntitySetInfo)null);
 }
コード例 #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);
        }
コード例 #18
0
 public override bool Visit(DbOfTypeExpression expression)
 {
     return(VisitUnaryExpression(expression));
 }
コード例 #19
0
        public override void Visit(DbOfTypeExpression e)
        {
            Check.NotNull(e, "e");

            BeginUnary(e);
            Dump(e.OfType, "OfType");
            End(e);
        }
コード例 #20
0
 public override void Visit(DbOfTypeExpression expression) { }
コード例 #21
0
        /// <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);
        }
コード例 #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);
コード例 #23
0
        public override TReturn Visit(DbOfTypeExpression expression)
        {
            Check.NotNull(expression, "expression");

            throw ConstructNotSupportedException(expression);
        }
コード例 #24
0
		public override void Visit(DbOfTypeExpression expression)
		{
			throw new NotSupportedException("Visit(\"OfTypeExpression\") is not supported.");
		}
コード例 #25
0
 public override void Visit(DbOfTypeExpression expression)
 {
     VisitUnaryExpression(expression);
 }
コード例 #26
0
 public override void Visit(DbOfTypeExpression expression)
 {
   VisitUnaryExpression(expression);
 }
コード例 #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);
 }