The following test fails because it uses the serializer from `x.Id` for `"abc"`.
public class CSharp4118Tests : Linq3IntegrationTest { [Fact] public void Test() { var collection = GetCollection<C>(); var queryable = collection.AsQueryable() .Select(x => new { S = "abc", HasId = x.Id != "000000000000000000000000" }); var stages = Translate(collection,queryable); AssertStages(stages, "{ $project : { S : 'abc', HasId : { $ne : ['$_id', ObjectId('000000000000000000000000')] }, _id : 0 } }") } private class C { [BsonRepresentation(BsonType.ObjectId)] public string Id { get; set; } } }
Somehow we need to limit the scope of where it is appropriate to deduce that strings need to be serialized using the `x.Id` serializer.
In this example `"abc"` should be serialized using a vanilla `StringSerializer`, while `"000000000000000000000000"` needs to be serialized using the `x.Id` serializer so that it will be converted to an `ObjectId` in the generated MQL.
- is depended on by
-
CSHARP-3989 oDATA $select support with LINQ3
- Closed