internal static PrimitiveValue ConvertToPrimitiveValue(this QueryExpression expression, PrimitiveDataType primitiveDataType)
        {
            var constantExpression = expression as QueryConstantExpression;

            if (constantExpression != null)
            {
                return(new PrimitiveValue(primitiveDataType.GetEdmTypeName(), constantExpression.ScalarValue.Value));
            }
            else
            {
                var nullExpression = expression as QueryNullExpression;
                ExceptionUtilities.CheckObjectNotNull(nullExpression, "Expected a QueryNullReference");

                return(new PrimitiveValue(primitiveDataType.GetEdmTypeName(), null));
            }
        }
Exemplo n.º 2
0
 private static PrimitiveValue PrimitiveValue(PrimitiveDataType dataType, object value)
 {
     // leave behind the metadata as an annotation so other components can use it
     return(new PrimitiveValue(dataType.GetEdmTypeName(), value).WithAnnotations(new DataTypeAnnotation()
     {
         DataType = dataType
     }));
 }
        internal static PrimitiveValue ConvertToPrimitiveValue(this QueryConstantExpression queryConstantExpression, PrimitiveDataType primitiveDataType)
        {
            ExceptionUtilities.CheckArgumentNotNull(queryConstantExpression, "queryConstantExpression");
            ExceptionUtilities.CheckArgumentNotNull(primitiveDataType, "primitiveDataType");

            // TODO: Need to understand what to do when values are null, should we omit them or be able to turn them on or off?
            string typeName = primitiveDataType.GetEdmTypeName();
            return new PrimitiveValue(typeName, queryConstantExpression.ScalarValue.Value);
        }
        internal static PrimitiveValue ConvertToPrimitiveValue(this QueryConstantExpression queryConstantExpression, PrimitiveDataType primitiveDataType)
        {
            ExceptionUtilities.CheckArgumentNotNull(queryConstantExpression, "queryConstantExpression");
            ExceptionUtilities.CheckArgumentNotNull(primitiveDataType, "primitiveDataType");

            // TODO: Need to understand what to do when values are null, should we omit them or be able to turn them on or off?
            string typeName = primitiveDataType.GetEdmTypeName();

            return(new PrimitiveValue(typeName, queryConstantExpression.ScalarValue.Value));
        }
        internal static PrimitiveValue ConvertToPrimitiveValue(this QueryExpression expression, PrimitiveDataType primitiveDataType)
        {
            var constantExpression = expression as QueryConstantExpression;
            if (constantExpression != null)
            {
                return new PrimitiveValue(primitiveDataType.GetEdmTypeName(), constantExpression.ScalarValue.Value);
            }
            else
            {
                var nullExpression = expression as QueryNullExpression;
                ExceptionUtilities.CheckObjectNotNull(nullExpression, "Expected a QueryNullReference");

                return new PrimitiveValue(primitiveDataType.GetEdmTypeName(), null);
            }
        }
Exemplo n.º 6
0
 private static PrimitiveValue PrimitiveValue(PrimitiveDataType dataType, object value)
 {
     // leave behind the metadata as an annotation so other components can use it
     return new PrimitiveValue(dataType.GetEdmTypeName(), value).WithAnnotations(new DataTypeAnnotation() { DataType = dataType });
 }