Does EF for MongoDB support the decimal data type from .NET out of the box? Or does a serializer still need to be registered?
Skip to main content
Hi @Nicholas_Vella,
You can use the .NET Decimal data type or Decimal 128 but by default but it maps to a string in MongoDB. However, you can use the BsonRepresentation
attribute ([BsonRepresentation(BsonType.Decimal128)]
) or the Fluent API with the EF Core provider to specify decimal 128 storage. Separately, we are planning to change the default in the next major version of the .NET/C# driver, you can track the progress of that in this ticket. Hope that helps.
Thanks,
Rishit.
Thank you for the clarification @Rishit_Bhatia
New & Unread Topics
Topic | Replies | Views | Activity |
---|---|---|---|
mongodb to powerbi | 1 | 607 | May 2024 |
If ?retrywrites=true, DeleteManyAsync() returns a MongoWriteException | 11 | 673 | Oct 2024 |
cannout use ImmutableList<T>.IsEmpty Property in Filter | 0 | 207 | Jul 2024 |
Filtering on array properties | 2 | 515 | Aug 2024 |
Process memory leak that mongoc_init creates but mongoc_cleanup does not clean up | 3 | 73 | Nov 2024 |