コード例 #1
0
        public static PerformanceEvent Write(PerformanceEvent performanceEvent)
        {
            String _dbConnection = ConfigurationManager.ConnectionStrings["IconoDB"].ConnectionString;

            using (SqlConnection connection = new SqlConnection(_dbConnection))
            {
                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "[icoProd].[InsertUserPageRequest]";

                command.Parameters.AddWithValue("@pageUrl", EnsureFit(performanceEvent.RequestUrl, 4000));
                command.Parameters.AddWithValue("@urlParameters", EnsureFit(performanceEvent.RequestParameters, 4000));
                command.Parameters.AddWithValue("@duration", EnsureFit(performanceEvent.RequestDuration, int.MaxValue));
                command.Parameters.AddWithValue("@contactID", performanceEvent.ContactID);
                command.Parameters.AddWithValue("@aspnetSessionID", EnsureFit(performanceEvent.SessionID, 50));
                command.Parameters.AddWithValue("@isPostRequest", performanceEvent.IsPostRequest);
                var outParam = command.Parameters.Add(new SqlParameter("@ID", SqlDbType.Int));
                outParam.Direction = ParameterDirection.Output;

                connection.Open();
                command.ExecuteNonQuery();

                int PerformanceEventID = (int)command.Parameters["@ID"].Value;
                performanceEvent.ID = PerformanceEventID;
            }
            return(performanceEvent);
        }
コード例 #2
0
       public static PerformanceEvent Write(PerformanceEvent performanceEvent)
       {
          String _dbConnection = ConfigurationManager.ConnectionStrings["IconoDB"].ConnectionString;

          using (SqlConnection connection = new SqlConnection(_dbConnection))
          {
              SqlCommand command = connection.CreateCommand();
              command.CommandType = CommandType.StoredProcedure;
              command.CommandText = "[icoProd].[InsertUserPageRequest]";

              command.Parameters.AddWithValue("@pageUrl", EnsureFit(performanceEvent.RequestUrl, 4000));
              command.Parameters.AddWithValue("@urlParameters", EnsureFit(performanceEvent.RequestParameters, 4000));
              command.Parameters.AddWithValue("@duration", EnsureFit(performanceEvent.RequestDuration, int.MaxValue));
              command.Parameters.AddWithValue("@contactID", performanceEvent.ContactID);
              command.Parameters.AddWithValue("@aspnetSessionID", EnsureFit(performanceEvent.SessionID, 50));
              command.Parameters.AddWithValue("@isPostRequest", performanceEvent.IsPostRequest);          
              var outParam = command.Parameters.Add(new SqlParameter("@ID", SqlDbType.Int));
              outParam.Direction = ParameterDirection.Output;
              
              connection.Open();
              command.ExecuteNonQuery();

              int PerformanceEventID  = (int)command.Parameters["@ID"].Value;
              performanceEvent.ID = PerformanceEventID;             
          }
          return performanceEvent;
       }
コード例 #3
0
        public PerformanceEvent LogPerformanceRequest(HttpRequest request, int contactId, string sessionId, long totalMilliseconds)
        {
            PerformanceEvent performanceEvent = CreatePerformanceEvent(request, contactId, sessionId, totalMilliseconds);

            PerformanceEventDbUtil.Write(performanceEvent);

            return(performanceEvent);
        }
コード例 #4
0
        private PerformanceEvent CreatePerformanceEvent(HttpRequest request, int contactId, string sessionId, long totalMilliseconds)
        {
            PerformanceEvent performanceEvent = new PerformanceEvent()
            {
                RequestUrl        = request.Path,
                RequestParameters = request.Url.Query,
                RequestDuration   = totalMilliseconds,
                IsPostRequest     = (request.RequestType.ToLower() == "post"),
                ContactID         = contactId,
                SessionID         = sessionId
            };

            return(performanceEvent);
        }
コード例 #5
0
        private PerformanceEvent CreatePerformanceEvent(HttpRequest request, int contactId, string sessionId, long totalMilliseconds)
        {
            PerformanceEvent performanceEvent = new PerformanceEvent()
            {
                RequestUrl = request.Path,
                RequestParameters = request.Url.Query,
                RequestDuration = totalMilliseconds,
                IsPostRequest = (request.RequestType.ToLower() == "post"),
                ContactID = contactId,
                SessionID = sessionId
            };

            return performanceEvent;
        }