Quantcast
Channel: MongoDB C# driver - Change Id serialization for inherited class - Stack Overflow
Browsing all 5 articles
Browse latest View live

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 Article



Answer 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 Article

Answer 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 Article

Answer 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 Article

MongoDB 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

Browsing all 5 articles
Browse latest View live




Latest Images