コード例 #1
0
        private void button6_Click(object sender, EventArgs e)
        {
            VeolcityDbHandler dbHandler = new VeolcityDbHandler();

            radioButton4.Checked = true;
            CreateCustomers();
            ulong id = dbHandler.Insert(customers[0]);

            Console.WriteLine($"Velo: {id}");
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;

            Task.Run(() =>
            {
                CreateCustomers();
                sw.Reset();
                sw.Start();
                foreach (Customer c in customers)
                {
                    CoreObject co = (CoreObject)c;
                    ormLiteDbHandler.AddRow(co);
                }
                sw.Stop();
                Log($"CREATE took\t{sw.ElapsedMilliseconds} ms");
                sw.Reset();

                sw.Start();
                veloDbHandler.InsertList(customers);
                sw.Stop();
                Log($"CREATE VeloDb InsertList took\t{sw.ElapsedMilliseconds} ms");
                sw.Reset();

                sw.Start();
                int i = 0;
                foreach (Customer c in customers)
                {
                    CoreObject co = (CoreObject)c;
                    veloDbHandler.Insert(co);
                    i++;
                    if (i % 50 == 0)
                    {
                        double speed = (i + 0.0) / (sw.ElapsedMilliseconds / 1000.0);
                        Log($"VeloSpeed: {speed} rec/s ({sw.ElapsedMilliseconds / 1000.0} seconds, {i} rec)");
                    }
                }
                sw.Stop();
                Log($"CREATE VelocityDB took\t{sw.ElapsedMilliseconds} ms");

                Invoke((MethodInvoker) delegate
                {
                    button1.Enabled = true;
                });
            });
        }