Esempio n. 1
0
        private static void CreateItems()
        {
            var context = new Ef7Context();
            context.LogQuery();
            System.Console.WriteLine("Creating {0} items started! ", Count);
            var timer = Stopwatch.StartNew();

            timer.Start();
            for (var i = 0; i < Count; i++)
            {
                context.Stores.Add(RandomDataGenerator.GenerateStore());
            }

            context.SaveChanges();

            timer.Stop();
            System.Console.WriteLine("Adding {0} took: {1}", Count, timer.Elapsed);
        }
Esempio n. 2
0
        private static void UpdateItems()
        {
            var context = new Ef7Context();
            System.Console.WriteLine("Updating {0} items started! ", Count);
            var timer = Stopwatch.StartNew();

            timer.Start();

            var stores = context.Stores.OrderBy(x => x.Id).Take(Count);

            foreach (var store in stores)
            {
                store.Name = store.Name + " Updated";
            }

            context.SaveChanges();

            timer.Stop();
            System.Console.WriteLine("Updating {0} items took: {1}", Count, timer.Elapsed);
        }