public override void Visit(SqlObjectCreateScalarExpression sqlObjectCreateScalarExpression)
        {
            int numberOfProperties = sqlObjectCreateScalarExpression.Properties.Count();

            if (numberOfProperties == 0)
            {
                this.writer.Write("{}");
            }
            else if (numberOfProperties == 1)
            {
                this.writer.Write("{");
                sqlObjectCreateScalarExpression.Properties.First().Accept(this);
                this.writer.Write("}");
            }
            else
            {
                this.WriteStartContext("{");
                bool firstItemProcessed = false;

                foreach (SqlObjectProperty property in sqlObjectCreateScalarExpression.Properties)
                {
                    if (firstItemProcessed)
                    {
                        this.WriteDelimiter(",");
                    }

                    property.Accept(this);
                    firstItemProcessed = true;
                }

                this.WriteEndContext("}");
            }
        }
        public override SqlObject Visit(SqlObjectCreateScalarExpression sqlObjectCreateScalarExpression)
        {
            List <SqlObjectProperty> properties = new List <SqlObjectProperty>();

            foreach (SqlObjectProperty property in sqlObjectCreateScalarExpression.Properties)
            {
                properties.Add(property.Accept(this) as SqlObjectProperty);
            }

            return(SqlObjectCreateScalarExpression.Create(properties));
        }
        public override void Visit(SqlObjectCreateScalarExpression sqlObjectCreateScalarExpression)
        {
            this.writer.Write("{");
            bool firstItemProcessed = false;

            foreach (SqlObjectProperty property in sqlObjectCreateScalarExpression.Properties)
            {
                if (firstItemProcessed)
                {
                    this.writer.Write(", ");
                }

                property.Accept(this);
                firstItemProcessed = true;
            }
            this.writer.Write("}");
        }
Example #4
0
        public override int Visit(SqlObjectCreateScalarExpression sqlObjectCreateScalarExpression)
        {
            int hashCode = SqlObjectCreateScalarExpressionHashCode;

            foreach (SqlObjectProperty property in sqlObjectCreateScalarExpression.Properties)
            {
                if (this.isStrict)
                {
                    hashCode = CombineHashes(hashCode, property.Accept(this));
                }
                else
                {
                    // Combining the hash functions needs to be done in a symmetric manner
                    // since order of object properties does not change equality.
                    hashCode += property.Accept(this);
                }
            }

            return(hashCode);
        }
 public abstract void Visit(SqlObjectCreateScalarExpression scalarExpression);
 protected abstract SqlScalarExpression Visit(SqlObjectCreateScalarExpression expression);