Answer by monomo for MongoDB C# driver - Change Id serialization for...
I have just spent a few hours on this problem and was stumped - but I now have the Solution!! The problem with Gurgen's answer is that SuperBaseEntity.Id is always null - since the Id Property is...
View ArticleAnswer by Gurgen Hakobyan for MongoDB C# driver - Change Id serialization for...
Look at this solution. For me it worked.Set BsonRepresentation for every base class and ignore Id field from SuperBaseEntity like this and create for every ID type base class derived from...
View ArticleAnswer by Fedor Hajdu for MongoDB C# driver - Change Id serialization for...
I may be late with an answer, but I had the same problem, found this question, but no real answer how to solve and why is it happening.What is happening is that Mongo driver doesn't explicitly...
View ArticleAnswer by mausworks for MongoDB C# driver - Change Id serialization for...
When you use the attribute [BsonRepresentation(BsonType.ObjectId)] you are telling the serializer, that even though this is a string — you want it represented by the ObjectId type. "en-GB" is not a...
View ArticleMongoDB C# driver - Change Id serialization for inherited class
I have implemented Repository pattern with a base entity class for my collections. Till now all collections had _id of ObjectId type. In the code, I needed to represent the Id as a string.Here is how...
View Article
More Pages to Explore .....