Example #1
0
 public void StopConsumer()
 {
     _consumer.ForEach(t =>
     {
         t.shutdown();
     });
     _helper.CloseConnection();
 }
Example #2
0
 public override void Close()
 {
     if (_helper != null)
     {
         _helper.CloseConnection();
     }
     if (_producer != null)
     {
         _producer.shutdown();
     }
 }
Example #3
0
        private void btnInsert_Click(object sender, EventArgs e)
        {
            IDBHelper helper = DBFactory.CreateDBHelper("Database = SyncDemo; uid=admin; pwd=frank;Server=localhost", DBType.MSSQL2005P);
            //helper.AutoCloseConnection = false;
            SnowFlakGenerator g      = new SnowFlakGenerator(Thread.CurrentThread.ManagedThreadId);
            ISqlMapper        mapper = new InsertMapper(new DB2Convert());
            Stopwatch         watch  = new Stopwatch();

            watch.Start();
            for (int i = 0; i < 10000; i++)
            {
                Dictionary <string, object> t = new Dictionary <string, object>();
                t["ID"]   = g.Generate();
                t["Name"] = "hello world";
                t["Type"] = 3;

                var model = mapper.ObjectToSql(Chainway.Library.SimpleMapper.Common.GetTableName("201707", "dbo", t.GetType(), null, t), t, null);

                helper.ExecNoneQueryWithSQL(model.SQL, model.Parameters.ToArray());
            }
            watch.Stop();
            helper.CloseConnection();
            MessageBox.Show("time:" + watch.ElapsedMilliseconds.ToString());
        }
Example #4
0
 public void CloseConn()
 {
     DBH.CloseConnection();
 }