/// <summary> /// test performance /// </summary> /// <param name="instance"></param> /// <returns></returns> public List <string> test(List <PosData> instance) { var count = 5000; Stopwatch sw = new Stopwatch(); sw.Reset(); sw.Start(); var batchcount = 100; List <string> _ListError = new List <string>(); //using (var beginTarn = this._context.Database.BeginTransaction()) //{ try { for (int i = 0; i < (count / batchcount); i++) { using (EDIEntities db = new EDIEntities()) { for (int j = 0; j < batchcount; j++) { PosData parent = new PosData(); db.PosData.Add(parent); } db.SaveChanges(); } } //beginTarn.Commit(); } catch (Exception) { //beginTarn.Rollback(); throw; } //} sw.Stop(); _ListError.Add(sw.ElapsedMilliseconds.ToString()); return(_ListError); }