MongoDB EF Core Provider: New Features at a Glance
With the release of the MongoDB EF Core Provider in May 2024, MongoDB introduces an innovative integration with Entity Framework Core (EF Core) for C# developers. Combined with MongoDB Atlas, this provider simplifies working on .NET applications through more flexible data models and efficient queries. Here, we present some of the key new features.
The code for this blog is on Github a DAK Bungalow.
1) Dynamic property extensions and change tracking
MongoDB's flexible document model approach allows properties to be added to records flexibly. The MongoDB EF Core Provider supports this approach through "code-first" modeling, enabling new properties to be added directly to the model and tracked with change tracking. An example of this would be adding a new Boolean field (e.g., `adapted_from_book`) to a record in real time, which would then also be visible in MongoDB Atlas.
2) Index management made easy
Through integration into the .NET/C# driver MongoDB's provider can effectively support index management. Developers can use the provider to directly create indexes in their databases, such as a composite index on the `title` and `rated` fields. This improves query speed and facilitates the use of complex search options in MongoDB, such as Atlas Search and Vector Search.
3) Powerful queries with LINQ
With EF Core and LINQ syntax, developers can create strongly typed and complex queries in C#. The integration of LINQ enables more efficient and precise queries on large datasets.
4) Transactions and Optimistic Concludivity
Since version 8.1.0, the MongoDB EF Core Provider supports transactions and optimistic concurrency. By default, all SaveChanges and SaveChangesAsync operations are now transactional, ensuring automatic rollback in case of errors and guaranteeing data consistency in production-critical applications. Developers can choose between concurrency checks or version tags to avoid conflicts during parallel operations.
Summary: Key takeaways about intuitive eating
The MongoDB EF Core Provider in combination with MongoDB Atlas It offers a range of powerful features for .NET developers. It enables flexible schema management, easy index management, precise queries with LINQ, and robust transaction and concurrency mechanisms. Developers seeking a flexible and scalable database solution can benefit from this new integration and efficiently integrate MongoDB into their .NET applications.

