Exemple #1
0
        private void btnRun2_Click(object sender, EventArgs e)
        {
            mongoHelper2 = new Mongodb.MongodbHelper(txtConnStr2.Text.Trim(), "SessionState");

            int threadCount = int.Parse(txtThreadCount2.Text.Trim());
            int userCount   = int.Parse(txtUserCount2.Text.Trim());

            for (int i = 0; i < threadCount; i++)
            {
                Task.Factory.StartNew(() =>
                {
                    for (int j = 0; j < userCount; j++)
                    {
                        MongoSessionDocument session = new MongoSessionDocument();
                        mongoHelper.InsertAndUpdate(session);
                    }
                });
            }
        }
Exemple #2
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            mongoHelper = new Mongodb.MongodbHelper(txtConnStr.Text.Trim(), "SessionState");

            int threadCount = int.Parse(txtThreadCount.Text.Trim());
            int userCount = int.Parse(txtUserCount.Text.Trim());

            for (int i = 0; i < threadCount; i++)
            {
                Task.Factory.StartNew(() =>
                {
                    for (int j = 0; j < userCount; j++)
                    {
                        MongoSessionDocument session = new MongoSessionDocument();
                        mongoHelper.InsertAndUpdate(session);
                    }

                });
            }
        }