Inheritance: SqlBaseExpression
 protected override Expression VisitCreateIndex(SqlCreateIndexExpression expression)
 {
     this.hashCode ^= expression.Unique ? 379717795 : 0;
     this.hashCode ^= expression.IndexName?.GetHashCode() ?? 0;
     this.hashCode ^= expression.IfNotExist ? 1286760945 : 0;
     this.hashCode ^= expression.LowercaseIndex ? -692148566 : 0;
     this.hashCode ^= expression.IndexType.GetHashCode();
     return(base.VisitCreateIndex(expression));
 }
		protected override Expression VisitCreateIndex(SqlCreateIndexExpression createIndexExpression)
		{
			var predicate = createIndexExpression
				.Columns
				.Select(c => (Expression)new SqlFunctionCallExpression(typeof(bool), SqlFunction.IsNotNull, c.Column))
				.Aggregate(Expression.And);

			return createIndexExpression.ChangeWhere(createIndexExpression.Where == null ? predicate : Expression.And(createIndexExpression.Where, predicate));
		}
 protected override Expression VisitCreateIndex(SqlCreateIndexExpression expression)
 {
     this.hashCode ^= expression.Unique ? 379717795 : 0;
     this.hashCode ^= expression.IndexName?.GetHashCode() ?? 0;
     this.hashCode ^= expression.IfNotExist ? 1286760945 : 0;
     this.hashCode ^= expression.LowercaseIndex ? -692148566 : 0;
     this.hashCode ^= expression.IndexType.GetHashCode();
     return base.VisitCreateIndex(expression);
 }
        protected override Expression VisitCreateIndex(SqlCreateIndexExpression expression)
        {
            SqlCreateIndexExpression current;
            if (!TryGetCurrent(expression, out current))
            {
                return expression;
            }

            if (!(this.result &= current.Unique == expression.Unique))
            {
                return expression;
            }

            if (!(this.result &= object.Equals(current.IndexName, expression.IndexName)))
            {
                return expression;
            }

            if (!(this.result &= current.IfNotExist == expression.IfNotExist))
            {
                return expression;
            }

            if (!(this.result &= current.LowercaseIndex == expression.LowercaseIndex))
            {
                return expression;
            }

            if (!(this.result &= current.IndexType == expression.IndexType))
            {
                return expression;
            }

            if (!(this.result &= current.NodeType == expression.NodeType))
            {
                return expression;
            }

            if (!(this.result &= current.Type == expression.Type))
            {
                return expression;
            }

            this.currentObject = current.Table;
            this.VisitTable(expression.Table);
            if (!this.result)
            {
                return expression;
            }

            this.currentObject = current.Where;
            this.Visit(expression.Where);
            if (!this.result)
            {
                return expression;
            }

            this.currentObject = current.Columns;
            this.VisitExpressionList(expression.Columns);
            if (!this.result)
            {
                return expression;
            }

            this.currentObject = current.IncludedColumns;
            this.VisitExpressionList(expression.IncludedColumns);
            if (!this.result)
            {
                return expression;
            }

            this.currentObject = current;
            return expression;
        }
Ejemplo n.º 5
0
        protected override Expression VisitCreateIndex(SqlCreateIndexExpression createIndexExpression)
        {
            this.Write("CREATE ");

            if (createIndexExpression.Unique)
            {
                this.Write("UNIQUE ");
            }

            if (createIndexExpression.IfNotExist)
            {
                this.Write("IF NOT EXIST ");
            }

            this.Write("INDEX ");
            this.WriteQuotedIdentifier(createIndexExpression.IndexName);
            this.Write(" ON ");
            this.Visit(createIndexExpression.Table);
            this.Write("(");
            this.WriteDeliminatedListOfItems(createIndexExpression.Columns, c => this.Visit(c));
            this.WriteLine(");");

            return createIndexExpression;
        }
Ejemplo n.º 6
0
		protected virtual Expression VisitCreateIndex(SqlCreateIndexExpression createIndexExpression)
		{
			return createIndexExpression;
		}
Ejemplo n.º 7
0
		protected override Expression VisitCreateIndex(SqlCreateIndexExpression createIndexExpression)
		{
			this.Write("CREATE ");

			if (createIndexExpression.Unique)
			{
				this.Write("UNIQUE ");
			}

			if (createIndexExpression.IfNotExist)
			{
				this.Write("IF NOT EXIST ");
			}

			this.Write("INDEX ");
			this.WriteQuotedIdentifier(createIndexExpression.IndexName);
			this.Write(" ON ");
			this.Visit(createIndexExpression.Table);
			this.Write("(");
			this.WriteDeliminatedListOfItems(createIndexExpression.Columns, c => this.Visit(c));
			this.WriteLine(")");

			if (this.sqlDialect.SupportsCapability(SqlCapability.IndexInclude))
			{
				if (createIndexExpression.IncludedColumns?.Count > 0)
				{
					this.Write(" INCLUDE ");

					this.Write("(");
					this.WriteDeliminatedListOfItems(createIndexExpression.IncludedColumns, c => this.Visit(c));
					this.WriteLine(")");
				}
			}

			if (createIndexExpression.Where != null)
			{
				this.Write(" WHERE ");
				this.Visit(createIndexExpression.Where);
			}

			this.WriteLine(";");

			return createIndexExpression;
		}
Ejemplo n.º 8
0
 protected virtual Expression VisitCreateIndex(SqlCreateIndexExpression createIndexExpression)
 {
     return(createIndexExpression);
 }