MongoDB Provider for Entity Framework Core Now Generally Available

Taylor Pacelli

#MongoDB.local NYC '24

We are pleased to announce that the MongoDB Provider for Entity Framework Core (EF Core) is now generally available. This allows developers using EF Core to build C# and .NET applications with MongoDB and to take advantage of our powerful developer data platform while continuing to use APIs and design patterns they already know and love.

This post is also available in: Deutsch, Français, Español, Português, Italiano, 한국어, 简体中文.

Building for the C# and .NET communities

Nearly one-third of all developers use C# to build applications, with the population of C# developers reaching upwards of 10 million developers worldwide. What’s more, 39 percent of C# developers use EF Core, which is beloved as an abstraction layer to simplify working with data during development. In the past, C# developers could use MongoDB’s C# driver but didn’t have first-party support for EF Core, so some turned to community-built projects that could be helpful—but lacked official backing or ongoing support from MongoDB.

With the official MongoDB Provider for EF Core now generally available, developers can confidently use C# and EF Core when building with MongoDB for production-grade workloads.

Gaurav Seth, Partner Director, Product Management at Microsoft, shared his excitement about the new integration, highlighting its importance for the .NET developer community:

We are pleased to deepen the relationship between .NET developers and MongoDB through the new MongoDB Provider for Entity Framework Core,” said Gaurav Seth. “This advancement bridges the gap between MongoDB and Entity Framework Core, enabling .NET developers to leverage the full spectrum of MongoDB’s capabilities within the familiar EF environment. With this integration, .NET developers can now more easily incorporate MongoDB’s powerful features into their EF-based applications, further enhancing the robustness and scalability of their solutions.

Gaurav Seth, Partner Director, Product Management at Microsoft

What's in the new Provider for EF Core

With the general availability release, the MongoDB Provider for EF Core offers developers the following capabilities, building upon the foundational features released in the public preview:

  • Compatibility with Entity Framework Core 8 & .NET 8: Fully compatible with the latest EF Core and .NET versions, ensuring your projects are up-to-date with the newest features and improvements.

  • Advanced Querying and Data Operations: Provides a comprehensive suite of querying options, including complex operations and aggregates like Where, OrderBy, and ThenBy, enabling precise data retrieval and deeper analytical insights within your applications.

  • Mapping and Configuration Flexibility: Extended mapping capabilities for properties and entities, including support for various data types and composite keys, providing greater flexibility and precision in how data is structured and stored.

  • Array and List Handling: Improved handling of arrays and lists, enabling more complex data structures to be easily managed and manipulated within your applications.

  • Logging: Enhanced logging for better visibility of operations.

We will continue to offer support for the following capabilities launched in the Public Preview:

  • Support for code-first workflows: Allows users to build without an initial database; you create the classes for your application and then match your data model to the classes, not the other way around.

  • Basic CRUD methods: Basic create, read, update, and delete (CRUD) operations are supported.

  • String and numeric type operators: String and numeric type operators needed for basic CRUD operations will be supported. We anticipate supporting more complex operators in future iterations of the Provider.

  • Embedded documents: The Provider supports embedded documents, making it easier to store related information in the same database record.

  • Class mapping and serialization: Your classes in C# will map to MongoDB in a predictable way, including when working with IDs as well as date and/or time values.

  • LINQ query support: The Provider will support LINQ queries with fluent query syntax.

  • Change tracking: The Provider allows you to track and save changes made to entities with each DbContext instance back to your MongoDB database.

Benefits of using the Provider for EF Core

With the MongoDB Provider for EF Core, C# developers can unlock the full power of MongoDB's developer data platform to build modern applications while leveraging a familiar API interface, query paradigm (LINQ), and design patterns. Developers looking to modernize their data layer can do so with MongoDB while remaining free from cloud vendor lock-in since MongoDB works with all major cloud providers and for multi-cloud deployments.

How to get started with MongoDB Provider for Entity Framework Core

All you need to do is download the MongoDB Provider for EF Core from the NuGet package manager and build a DbContext that points to a MongoDB Provider instance. The Provider connects to MongoDB and handles the rest, so you can quickly harness the joint value of EF Core and MongoDB.

Learn more by diving into our documentation. After you try the new Provider for EF Core, leave us feedback. Your input is important for helping us continue to improve the product experience.

Get started today to unleash the power of your data with MongoDB and EF Core.