Exemplo n.º 1
0
        /// <summary>
        /// Logs an error to the database.
        /// </summary>
        /// <remarks>
        /// Use the stored procedure called by this implementation to set a
        /// policy on how long errors are kept in the log. The default
        /// implementation stores all errors for an indefinite time.
        /// </remarks>

        public override string Log(Error error)
        {
            if (error == null)
            {
                throw new ArgumentNullException("error");
            }

            var elmahEntity = new ElmahEntity(ApplicationName)
            {
                AllXml          = ErrorXml.EncodeString(error),
                ApplicationName = ApplicationName,
                HostName        = error.HostName,
                Message         = error.Message,
                Source          = error.Source,
                StatusCode      = error.StatusCode,
                Type            = error.Type,
                User            = error.User,
            };

            var tableOperation = TableOperation.Insert(elmahEntity);

            _cloudTable.Execute(tableOperation);

            return(elmahEntity.RowKey);
        }
 protected virtual void AddEntity(ElmahEntity elmahEntity)
 {
     _cloudTable.Execute(TableOperation.Insert(elmahEntity));
 }
        /// <summary>
        /// Logs an error to the database.
        /// </summary>
        /// <remarks>
        /// Use the stored procedure called by this implementation to set a
        /// policy on how long errors are kept in the log. The default
        /// implementation stores all errors for an indefinite time.
        /// </remarks>

        public override string Log(Error error)
        {
            if (error == null)
                throw new ArgumentNullException("error");

            var elmahEntity = new ElmahEntity
            {
                AllXml = ErrorXml.EncodeString(error),
                ApplicationName = ApplicationName,
                HostName = error.HostName,
                Message = error.Message,
                Source = error.Source,
                StatusCode = error.StatusCode,
                Type = error.Type,
                User = error.User,
            };

            var tableOperation = TableOperation.Insert(elmahEntity);
            _cloudTable.Execute(tableOperation);

            return elmahEntity.RowKey;
        }
        protected override void AddEntity(ElmahEntity elmahEntity)
        {
            base.AddEntity(elmahEntity);

            _cloudTableNextCyleLog.Execute(TableOperation.Insert(elmahEntity));
        }