Ejemplo n.º 1
0
        public override LiteralExpression VisitLiteralValue(LiteralExpression expression)
        {
            _xmlWriter.WriteStartElement("literalExpression");

            _xmlWriter.WriteStartElement("value");
            WriteTypeAttribute(expression.ExpressionType);

            object value = expression.GetValue();

            if (NullHelper.IsNull(value))
            {
                _xmlWriter.WriteAttributeString("value", "<null>");
            }
            else
            {
                _xmlWriter.WriteAttributeString("value", value.ToString());
            }
            _xmlWriter.WriteEndElement();

            _xmlWriter.WriteEndElement();

            return(expression);
        }
Ejemplo n.º 2
0
 public override LiteralExpression VisitLiteralValue(LiteralExpression expression)
 {
     _ilEmitContext.AddParameter(expression, expression.GetValue(), expression.ExpressionType);
     return(expression);
 }
Ejemplo n.º 3
0
		private static bool VisitLiteralValue(LiteralExpression node1, LiteralExpression node2)
		{
			return node2 != null &&
			       Equals(node1.GetValue(), node2.GetValue());
		}
Ejemplo n.º 4
0
 private static bool VisitLiteralValue(LiteralExpression node1, LiteralExpression node2)
 {
     return(node2 != null &&
            Equals(node1.GetValue(), node2.GetValue()));
 }
Ejemplo n.º 5
0
		public override LiteralExpression VisitLiteralValue(LiteralExpression expression)
		{
			if (expression.GetValue() == null)
				_writer.WriteNull();
			else
			{
				switch (expression.PrimitiveType)
				{
					case PrimitiveType.None:
						if (expression.ExpressionType != typeof(DateTime))
							goto case PrimitiveType.Object;
						_writer.WriteLiteral(expression.AsDateTime);
						break;

					case PrimitiveType.Object:
						_writer.WriteLiteral(expression.GetValue());
						break;

					case PrimitiveType.Boolean:
						_writer.WriteLiteral(expression.AsBoolean);
						break;

					case PrimitiveType.Byte:
					case PrimitiveType.SByte:
					case PrimitiveType.Int16:
					case PrimitiveType.UInt16:
					case PrimitiveType.UInt32:
					case PrimitiveType.UInt64:
						_writer.WriteLiteral(expression.AsInt64, expression.ExpressionType);
						break;

					case PrimitiveType.Int32:
					case PrimitiveType.Int64:
						_writer.WriteLiteral(expression.AsInt64);
						break;

					case PrimitiveType.Char:
						_writer.WriteLiteral(expression.AsString[0]);
						break;

					case PrimitiveType.String:
						_writer.WriteLiteral(expression.AsString);
						break;

					case PrimitiveType.Single:
					case PrimitiveType.Decimal:
						_writer.WriteLiteral(expression.AsDouble, expression.ExpressionType);
						break;

					case PrimitiveType.Double:
						_writer.WriteLiteral(expression.AsDouble);
						break;

					default:
						throw ExceptionBuilder.UnhandledCaseLabel(expression.PrimitiveType);
				}
			}

			return expression;
		}
Ejemplo n.º 6
0
        public override LiteralExpression VisitLiteralValue(LiteralExpression expression)
        {
            if (expression.GetValue() == null)
            {
                _writer.WriteNull();
            }
            else
            {
                switch (expression.PrimitiveType)
                {
                case PrimitiveType.None:
                    if (expression.ExpressionType != typeof(DateTime))
                    {
                        goto case PrimitiveType.Object;
                    }
                    _writer.WriteLiteral(expression.AsDateTime);
                    break;

                case PrimitiveType.Object:
                    _writer.WriteLiteral(expression.GetValue());
                    break;

                case PrimitiveType.Boolean:
                    _writer.WriteLiteral(expression.AsBoolean);
                    break;

                case PrimitiveType.Byte:
                case PrimitiveType.SByte:
                case PrimitiveType.Int16:
                case PrimitiveType.UInt16:
                case PrimitiveType.UInt32:
                case PrimitiveType.UInt64:
                    _writer.WriteLiteral(expression.AsInt64, expression.ExpressionType);
                    break;

                case PrimitiveType.Int32:
                case PrimitiveType.Int64:
                    _writer.WriteLiteral(expression.AsInt64);
                    break;

                case PrimitiveType.Char:
                    _writer.WriteLiteral(expression.AsString[0]);
                    break;

                case PrimitiveType.String:
                    _writer.WriteLiteral(expression.AsString);
                    break;

                case PrimitiveType.Single:
                case PrimitiveType.Decimal:
                    _writer.WriteLiteral(expression.AsDouble, expression.ExpressionType);
                    break;

                case PrimitiveType.Double:
                    _writer.WriteLiteral(expression.AsDouble);
                    break;

                default:
                    throw ExceptionBuilder.UnhandledCaseLabel(expression.PrimitiveType);
                }
            }

            return(expression);
        }
Ejemplo n.º 7
0
		public override LiteralExpression VisitLiteralValue(LiteralExpression expression)
		{
			_ilEmitContext.AddParameter(expression, expression.GetValue(), expression.ExpressionType);
			return expression;
		}
Ejemplo n.º 8
0
		public override LiteralExpression VisitLiteralValue(LiteralExpression expression)
		{
			_xmlWriter.WriteStartElement("literalExpression");

			_xmlWriter.WriteStartElement("value");
			WriteTypeAttribute(expression.ExpressionType);

			object value = expression.GetValue();
			if (NullHelper.IsNull(value))
				_xmlWriter.WriteAttributeString("value", "<null>");
			else
				_xmlWriter.WriteAttributeString("value", value.ToString());
			_xmlWriter.WriteEndElement();

			_xmlWriter.WriteEndElement();

			return expression;
		}