Exemple #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();
        }
        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();
        }
Exemple #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();
     }
 }