Is it possible that Entity Framework supports MongoDb database? Maybe somebody will write a EF MongoDb Provider?
Short answer - no, it's for sure possible, but not reasonable. MongoDB is document database and not support any physical relations between collections. EF is a good fit for relational databases like SQL, MySQL, etc. MongoDB works faster with embedded documents.
When you use NoSQL databases for your infrastructure data tier, you typically do not use an ORM like Entity Framework Core. Instead you use the API provided by the NoSQL engine, such as Azure Cosmos DB, MongoDB, Cassandra, RavenDB, CouchDB, or Azure Storage Tables.
EF Core works with many databases, including SQL Database (on-premises and Azure), SQLite, MySQL, PostgreSQL, and Azure Cosmos DB.
Accessing the MongoDB database from an ASP.NET Core Web API application. The first thing we will do is to add the MongoDB driver NuGet package. This will allow us to access the MongoDB database via friendly APIs. Once this is done, we can proceed to start adding the code.
Short answer - no, it's for sure possible, but not reasonable.
MongoDB is document database and not support any physical relations between collections. EF is a good fit for relational databases like SQL, MySQL, etc. MongoDB works faster with embedded documents. So it's just two different approaches.
Check out the latest version of the MongoDB C# Library.... supports LINQ!
https://mongodb.github.io/mongo-csharp-driver/1.11/linq/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With