private static BaseExpression ConvertToBaseExpression(ExpressionMetadata filterMetadataLeftExpression) { var dataValueType = DataValueTypeUtilities.ConvertTypeToDataValueType(filterMetadataLeftExpression.Parameter.Type); var value = GetQueryValue(filterMetadataLeftExpression.Parameter.Value, dataValueType); return(ConvertToBaseExpression(dataValueType, value)); }
private static object GetQueryValue(object rawValue, DataValueType dataValueType) { if (DataValueTypeUtilities.IsDateDataValueType(dataValueType) && rawValue != null) { return($"\"{((DateTime)rawValue):yyyy-MM-ddTHH:mm:ss.fff}\""); } return(rawValue); }
private static BaseExpression CreateDefaultCreateParameterExpression(DataValueType dataValueType) { var type = DataValueTypeUtilities.ConvertDataValueTypeToType(dataValueType); var value = type.IsValueType ? Activator.CreateInstance(type) : null; return(CreateParameterExpression(value, dataValueType)); }
private static ColumnExpression ConvertValueToColumnExpression(ModelItem property, object value) { return(new ColumnExpression() { ExpressionType = EntitySchemaQueryExpressionType.Parameter, Parameter = new Parameter() { DataValueType = DataValueTypeUtilities.ConvertTypeToDataValueType(property.DataValueType), Value = ConvertValue(property.DataValueType, value) } }); }