Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
1.8, 1.8.1, 1.8.3
-
None
-
None
Description
Hi,
We use asp.net web api 2 with OData Support and we use $select option on odata, when we try to use $select option we get
MongoQueryException("Skip and Take may only be used in conjunction with each other and cannot be separated by other operations.");
but when i comment that line i works correctly.
Another exception when we try to use OData date time queries is
Unsupported where clause: ((Nullable<DateTime>)x.StartDate > (Nullable<DateTime>)DateTime:(2013-08-01T00:00:00, Unspecified)).
so we cannot use date time gt ge or lt le queries and when we add following lines to PredicateTranslator BuildComparrisonQuery function it worlks again.
BsonSerializationInfo serializationInfo = null;
|
var value = constantExpression.Value;
|
|
|
var unaryExpression = variableExpression as UnaryExpression;
|
if (unaryExpression != null && (unaryExpression.NodeType == ExpressionType.Convert || unaryExpression.NodeType == ExpressionType.ConvertChecked))
|
{
|
if (unaryExpression.Operand.Type.IsEnum)
|
{
|
var enumType = unaryExpression.Operand.Type;
|
if (unaryExpression.Type == Enum.GetUnderlyingType(enumType))
|
{
|
serializationInfo = _serializationInfoHelper.GetSerializationInfo(unaryExpression.Operand);
|
value = Enum.ToObject(enumType, value); // serialize enum instead of underlying integer
|
}
|
}
|
else if (
|
unaryExpression.Type.IsGenericType &&
|
unaryExpression.Type.GetGenericTypeDefinition() == typeof(Nullable<>) &&
|
unaryExpression.Operand.Type.IsGenericType &&
|
unaryExpression.Operand.Type.GetGenericTypeDefinition() == typeof(Nullable<>) &&
|
unaryExpression.Operand.Type.GetGenericArguments()[0].IsEnum)
|
{
|
var enumType = unaryExpression.Operand.Type.GetGenericArguments()[0];
|
if (unaryExpression.Type.GetGenericArguments()[0] == Enum.GetUnderlyingType(enumType))
|
{
|
serializationInfo = _serializationInfoHelper.GetSerializationInfo(unaryExpression.Operand);
|
if (value != null)
|
{
|
value = Enum.ToObject(enumType, value); // serialize enum instead of underlying integer
|
}
|
}
|
} else {
|
// FIX
|
serializationInfo = _serializationInfoHelper.GetSerializationInfo(unaryExpression.Operand);
|
}
|
}
|
Thanks
Attachments
Issue Links
- is related to
-
CSHARP-601 Linq to Aggregation Framework
-
- Closed
-