Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework and MongoDb

Is it possible that Entity Framework supports MongoDb database? Maybe somebody will write a EF MongoDb Provider?

like image 337
Chance Avatar asked Jul 23 '11 04:07

Chance


People also ask

Can you use Entity Framework with MongoDB?

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.

Does Entity Framework work with NoSQL database?

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.

What databases does Entity Framework work with?

EF Core works with many databases, including SQL Database (on-premises and Azure), SQLite, MySQL, PostgreSQL, and Azure Cosmos DB.

Does .NET support MongoDB?

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.


2 Answers

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.

like image 184
Andrew Orsich Avatar answered Oct 02 '22 17:10

Andrew Orsich


Check out the latest version of the MongoDB C# Library.... supports LINQ!

https://mongodb.github.io/mongo-csharp-driver/1.11/linq/

like image 32
reach4thelasers Avatar answered Oct 02 '22 19:10

reach4thelasers