Raven 批量插入代码

前端之家收集整理的这篇文章主要介绍了Raven 批量插入代码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

百度了半天没找到,无奈去源代码里搜,结果真搜到了.
Raven 批量插入代码.

using Raven.Abstractions.Data;
using Raven.Client.Document;
using Raven.Documentation.CodeSamples.Orders;

namespace Raven.Documentation.Samples.ClientApi.BulkInsert
{
    public class BulkInserts
    {
        private interface IFoo
        {
            #region bulk_inserts_1
            BulkInsertOperation BulkInsert(
                string database = null,BulkInsertOptions options = null);
            #endregion
        }

        public BulkInserts()
        {
            using (var store = new DocumentStore())
            {
                #region bulk_inserts_4
                using (BulkInsertOperation bulkInsert = store.BulkInsert())
                {
                    for (int i = 0; i < 1000 * 1000; i++)
                    {
                        bulkInsert.Store(new Employee
                        {
                            FirstName = "FirstName #" + i,LastName = "LastName #" + i
                        });
                    }
                }
                #endregion
            }
        }
    }
}

这下批量插入不是问题了

原文链接:https://www.f2er.com/nosql/203829.html

猜你在找的NoSQL相关文章