Entity Framework and MongoDb

前端 未结 6 1077
孤城傲影
孤城傲影 2021-02-01 12:18

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

相关标签:
6条回答
  • 2021-02-01 12:29

    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.

    0 讨论(0)
  • 2021-02-01 12:37

    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.

    0 讨论(0)
  • 2021-02-01 12:38

    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

    0 讨论(0)
  • 2021-02-01 12:44

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

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

    0 讨论(0)
  • 2021-02-01 12:48

    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

    https://www.cdata.com/kb/tech/mongodb-ado-codefirst.rst

    0 讨论(0)
  • 2021-02-01 12:51

    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.

    0 讨论(0)
提交回复
热议问题