Exemplo n.º 1
0
        private static decimal LINQtoSQLUpdateTest()
        {
            List <decimal> testresults = new List <decimal>();

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            var AWL2SContext = new AWL2SDataContext();

            for (int j = 0; j < iInnerloop; j++)
            {
                var customers = from c in AWL2SContext.L2SCustomers select c;
                foreach (L2SCustomer cust in customers)
                {
                    L2SCustomer o = cust;
                    o.ModifiedDate = o.ModifiedDate.AddDays(1);
                }
                for (int iAdd = 0; iAdd < 10; iAdd++)
                {
                    L2SCustomer cust = new L2SCustomer();
                    cust.NameStyle    = true;
                    cust.FirstName    = "new";
                    cust.LastName     = "cust";
                    cust.PasswordHash = "pw";
                    cust.PasswordSalt = "salt";
                    cust.rowguid      = Guid.NewGuid();
                    cust.ModifiedDate = DateTime.Now;

                    AWL2SContext.L2SCustomers.InsertOnSubmit(cust);
                }

                sw.Reset();
                sw.Start();
                AWL2SContext.SubmitChanges();
                sw.Stop();
                testresults.Add((decimal)sw.ElapsedMilliseconds);
                clearnewcusts(connectionString);
            }

            // figure out how long this took
            //toss first result, calc average of rest
            clearnewcusts(connectionString);
            testresults.Remove(0);
            return(testresults.Average());
        }
Exemplo n.º 2
0
 partial void DeleteL2SCustomer(L2SCustomer instance);
Exemplo n.º 3
0
 partial void UpdateL2SCustomer(L2SCustomer instance);
Exemplo n.º 4
0
 partial void InsertL2SCustomer(L2SCustomer instance);