Exemple #1
0
        private static void BulkInsert(SqliteDbContext db)
        {
            Stopwatch sw   = new Stopwatch();
            var       user = db.Query <User>(x => x.Id > 0).Take(1).FirstOrDefault();

            //var user = db.Query<User>(x => x.Id > 0).Take(1).FirstOrDefault();

            var newList = new List <User>();

            for (var i = 0; i < 2; i++)
            {
                newList.Add(user);
            }
            sw.Reset();
            sw.Start();
            db.BulkInsert <User>("Users", newList);
            sw.Stop();
            Console.WriteLine("BulkInsert List 耗时:" + sw.ElapsedMilliseconds);
        }