-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Linq
-
None
var mapperConfiguration = new MapperConfiguration(config => { config.CreateMap<Post, PostDto>(); config.CreateMap<Post.EmbeddedCategory, PostDto.CategoryDto>(); config.CreateMap<Post.EmbeddedComment, PostDto.CommentDto>(); }); var mapper = mapperConfiguration.CreateMapper(); var result = postCollection .AsQueryable() .ProjectTo<PostDto>(mapper.ConfigurationProvider) .ToList();
Message: System.FormatException : An error occurred while deserializing the Category property of class MongoDb.Bugs.PostDto: Element 'Id' does not match any field or property of class MongoDb.Bugs.PostDto+CategoryDto. ---- System.FormatException : Element 'Id' does not match any field or property of class MongoDb.Bugs.PostDto+CategoryDto. Stack Trace: MongoQueryProviderImpl`1.Execute(Expression expression) MongoQueryableImpl`2.GetEnumerator() List`1.ctor(IEnumerable`1 collection) Enumerable.ToList[TSource](IEnumerable`1 source) Tests.AutoMapper_ProjectTo() line 41 ----- Inner Stack Trace ----- BsonClassMapSerializer`1.DeserializeClass(BsonDeserializationContext context) BsonClassMapSerializer`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args) IBsonSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args) IBsonSerializerExtensions.Deserialize(IBsonSerializer serializer, BsonDeserializationContext context) BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)
- duplicates
-
CSHARP-1771 Support IIF method (i.e. ternary operator) in LINQ
- Closed
- is duplicated by
-
CSHARP-3614 LINQ translation sometimes uses wrong element name in projection
- Closed