コード例 #1
0
ファイル: ConsumerManager.cs プロジェクト: mazhufeng/DataSync
 public void StopConsumer()
 {
     _consumer.ForEach(t =>
     {
         t.shutdown();
     });
     _helper.CloseConnection();
 }
コード例 #2
0
 public override void Close()
 {
     if (_helper != null)
     {
         _helper.CloseConnection();
     }
     if (_producer != null)
     {
         _producer.shutdown();
     }
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: mazhufeng/DataSync
        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());
        }
コード例 #4
0
 public void CloseConn()
 {
     DBH.CloseConnection();
 }