Exemplo n.º 1
0
 /// <summary>
 /// LINQ修改
 /// </summary>
 /// <returns></returns>
 SpeedTest.SpeedResult LINQ_Update(int count)
 {
     using (var sp = new SpeedTest().Begin())
     {
         // 循环10万次
         for (int i = 0; i < count; i++)
         {
             using (var db = new SpeedDataContext())
             {
                 foreach (var item in db.Speed.Where(o => o.ID > 1))
                 {
                     item.UserName = "******"; item.PassWord = "******"; item.GenderType = 0; item.LoginCount = 0; item.LoginIP = "127.0.0.1"; item.RoleID = 3;
                 }
                 db.SubmitChanges();
             }
         }
         return sp.Result;
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// LINQ删除
 /// </summary>
 /// <returns></returns>
 SpeedTest.SpeedResult LINQ_Delete(int count)
 {
     using (var sp = new SpeedTest().Begin())
     {
         // 循环10万次
         for (int i = 0; i < count; i++)
         {
             using (var db = new SpeedDataContext())
             {
                 var speed = db.Speed.Where(o => o.ID > 1);
                 db.Speed.DeleteAllOnSubmit(speed);
                 db.SubmitChanges();
             }
         }
         return sp.Result;
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// LINQ插入
 /// </summary>
 /// <returns></returns>
 SpeedTest.SpeedResult LINQ_Insert(int count)
 {
     using (var sp = new SpeedTest().Begin())
     {
         // 循环10万次
         for (int i = 0; i < count; i++)
         {
             using (var db = new SpeedDataContext())
             {
                 db.Speed.InsertOnSubmit(new FS.Model.LINQ.Speed() { UserName = "******", PassWord = "******", GenderType = 0, LoginCount = 0, LoginIP = "127.0.0.1", RoleID = 3 });
                 db.SubmitChanges();
             }
         }
         return sp.Result;
     }
 }