Details
-
Bug
-
Resolution: Done
-
Major - P3
-
2.1
Description
Since we went from version 2.0.1 to 2.1.0 we get this error: Unable to determine the serialization information for c => Convert(c).Id
Here's the exception:
System.AggregateException : One or more errors occurred.
|
----> System.InvalidOperationException : Unable to determine the serialization information for c => Convert(c).Id.
|
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
|
at RC.RcGraph.Infrastructure.SmokeTests.NewsStories.NewsStoryRepositoryTests.GetByIds() in NewsStoryRepositoryTests.cs: line 137
|
--InvalidOperationException
|
at MongoDB.Driver.ExpressionFieldDefinition`2.Render(IBsonSerializer`1 documentSerializer, IBsonSerializerRegistry serializerRegistry)
|
at MongoDB.Driver.SingleItemAsArrayOperatorFilterDefinition`2.Render(IBsonSerializer`1 documentSerializer, IBsonSerializerRegistry serializerRegistry)
|
at MongoDB.Driver.MongoCollectionImpl`1.FindAsync(FilterDefinition`1 filter, FindOptions`2 options, CancellationToken cancellationToken)
|
at MongoDB.Driver.IAsyncCursorSourceExtensions.<ToListAsync>d__4`1.MoveNext()
|
--- End of stack trace from previous location where exception was thrown ---
|
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
|
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
|
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
|
at RC.RcGraph.Infrastructure.Util.MongoBaseContentRepository`1.<GetByIdsAsync>d__c.MoveNext() in MongoBaseContentRepository.cs: line 68
|
Here's the object structure:
public interface IContent {
|
int Id { get; }
|
}
|
|
|
public class News : IContent {
|
public int Id { get; private set; }
|
}
|
|
|
public abstract BaseRepository<T> where T : IContent {
|
public async Task<List<T>> GetByIdsAsync(IEnumerable<int> ids) {
|
var filter = Builders<T>.Filter.In(c => c.Id, ids);
|
return await GetCollection()
|
.Find(filter)
|
.ToListAsync();
|
}
|
}
|
Here are the conventions:
BsonClassMap.RegisterClassMap<News>(cm => { cm.AutoMap() });
|
Attachments
Issue Links
- duplicates
-
CSHARP-1463 OrderBy DateTime
-
- Closed
-