コード例 #1
0
        private void SampleSqlConnectionTestOperation(Boolean smallTime)
        {
            Thread.Sleep(smallTime ? Constants.smallTime : Constants.bigTime);//simulate some work before db operation
            dynamic cnn = PerfLabsProfiledADOWrapper.PerfLabsDbConnection(new SqlConnection(Constants.demoDBConnectionString));

            cnn.Open();
            var cmd = cnn.CreateCommand();

            cmd.CommandText = smallTime ? Constants.smallQuery : Constants.bigQuery;
            cmd.ExecuteNonQuery();
            Thread.Sleep(smallTime ? Constants.smallTime : Constants.bigTime);//simulate some work after db operation
            cnn.Close();
        }
コード例 #2
0
        public void SqlConnectionTestOperation(Boolean smallTime = true)
        {
            Thread.Sleep(smallTime ? Constants.smallTime : Constants.bigTime);//simulate some work before db operation
            dynamic cnn = PerfLabsProfiledADOWrapper.PerfLabsDbConnection(new SqlConnection(ConfigurationManager.ConnectionStrings["TestDBBlogContext"].ConnectionString));

            cnn.Open();
            var cmd = cnn.CreateCommand();

            cmd.CommandText = smallTime ? Constants.smallQuery : Constants.bigQuery;
            cmd.ExecuteNonQuery();
            Thread.Sleep(smallTime ? Constants.smallTime : Constants.bigTime);//simulate some work after db operation
            cnn.Close();
        }
コード例 #3
0
 public void SqlConnectionTestOperation2()
 {
     using (_perfLabs.Step(Profiler.MVCMiniProfiler, "SqlConnectionTestOperation2", 6000))
     {
         Thread.Sleep(Constants.bigTime);//simulate some work before db operation
         dynamic cnn = PerfLabsProfiledADOWrapper.PerfLabsDbConnection(new SqlConnection(Constants.demoDBConnectionString));
         cnn.Open();
         var cmd = cnn.CreateCommand();
         cmd.CommandText = Constants.bigQuery;
         cmd.ExecuteNonQuery();
         Thread.Sleep(Constants.bigTime);//simulate some work after db operation
         cnn.Close();
     }
 }