Convert SQL table to mongoDB document

后端 未结 5 1777
眼角桃花
眼角桃花 2020-12-15 01:21

What\'s the best way to convert a SQL database, let\'s say 1 table, to a mongoDB document?

I guess I could use a C# driver and implement a loop, which selects each r

5条回答
  •  伪装坚强ぢ
    2020-12-15 02:18

    Both the Norm & samus c# mongo drivers support strongly typed classes to be passed as documents. Means its cool as Nhiberbate and LINQ to SQL.

    SO my idea is, you can use a LINQ to SQL to create a entity in c# (classes representing tables) to retrieve the data from sql server and you can use the same strongly typed class for insertion in mongo db.

    Make sure that your classes should have a mongo identifier attribute (in NoRM) in any one of the field. This is to generate a unique id for a document.

提交回复
热议问题