Is it possible that Entity Framework supports MongoDB database? Has someone written an Entity Framework MongoDB Provider?
9 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.
5 Comments
Check out the latest version of the MongoDB C# Library.... supports LINQ!
3 Comments
I'm a big fan of entity framework, so when I first tried out mongoDb I've created a library called "MongoDB.Dynamic" that has an approach next to EF Code First. MongoDB has no relations between collections physically, but you can simulate it. MongoDB.Dynamic has a feature known as Eager Loading that you can configure relationships between collections and load related documents automatically if an entity have the conventioned structure. You can try and read some documentation at MongoDB.Dynamic
Comments
MongoDB has now released an officially supported EF Core provider (currently in preview).
Github repo: https://github.com/mongodb/mongo-efcore-provider
NuGet: https://www.nuget.org/packages/MongoDB.EntityFrameworkCore
Issue/bug tracker: https://jira.mongodb.org/projects/EF/issues/EF-63
Comments
Looking online, RSSBus look to have created a MongoDBProviderServices dll that could be used with entity framework 6.
http://cdn.rssbus.com/help/DG1/ado/pg_ef6.htm
The link includes a tutorial on how to implement it.
Comments
CData developed a library for doing CRUD operations with MongoDb using Entity Framework 6.0. But its not free.
Details of the library can be found in
Comments
I do not suggest to use the old version of MongoDb provider that uses LINQ. The best and stable C# MongoDb driver is the official MongoDb driver 2.0 for C# that uses Builders mechanics.
The LINQ legacy driver has many constraints with inconvenient and slow Bulk insert mechanism.
3 Comments
Rachelle from MongoDB here. Yes, you can use the Entity Framework with MongoDB. Our C# team just released our official provider, the documentation is located here https://www.mongodb.com/docs/entity-framework/current/ . Please reach out if you have feedback or questions!
Comments
I am not sure, but I think the Microsoft.EntityFrameworkCore.Cosmos Database Provider will work for you.