You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.
Refresh couple of times, and this exception will show:
BsonSerializationException: Unknown discriminator value 'Employee'.
MongoDB.Bson.Serialization.BsonSerializer.LookupActualType(Type nominalType, BsonValue discriminator)
FormatException: An error occurred while deserializing the Owner property of class EFMongoDemo.Web.Models.Car: Unknown discriminator value 'Employee'.
MongoDB.Driver.Linq.MongoQueryProviderImpl.Execute(Expression expression)
This happens on the call:
var cars = await _context.Cars.ToListAsync();
And I noticed there isn't a collection called owner in the db after using the interface.
The text was updated successfully, but these errors were encountered:
As I said in #13, interfaces aren't really support by EF Core, which is beyond the control of this project.
The only real issue is the navigation property. As I said in #9, navigations aren't fully supported yet, so you won't see that second Owner collection get created just because you added a Car. In the current implementation, Car.Owner will be treated as a subdocument, with the entire graph getting stored in a cars collection. For now, you should refactor your entities to use Car.OwnerId, and add the Owner instance directly to your DbContext, and then use a Join to look them up and project a view model that maps between the Car and Owner:
How to reproduce:
This happens on the call:
And I noticed there isn't a collection called owner in the db after using the interface.
The text was updated successfully, but these errors were encountered: