/// <summary>
        /// Updates a record in the <c>aspnet_WebEvent_Events</c> table.
        /// </summary>
        /// <param name="value">The <see cref="aspnet_WebEvent_EventsRow"/>
        /// object used to update the table record.</param>
        /// <returns>true if the record was updated; otherwise, false.</returns>
        public virtual bool Update(aspnet_WebEvent_EventsRow value)
        {
            IDbCommand cmd = _db.CreateCommand("dbo._aspnet_WebEvent_Events_Update", true);

            AddParameter(cmd, "EventTimeUtc", value.EventTimeUtc);
            AddParameter(cmd, "EventTime", value.EventTime);
            AddParameter(cmd, "EventType", value.EventType);
            AddParameter(cmd, "EventSequence", value.EventSequence);
            AddParameter(cmd, "EventOccurrence", value.EventOccurrence);
            AddParameter(cmd, "EventCode", value.EventCode);
            AddParameter(cmd, "EventDetailCode", value.EventDetailCode);
            AddParameter(cmd, "Message", value.Message);
            AddParameter(cmd, "ApplicationPath", value.ApplicationPath);
            AddParameter(cmd, "ApplicationVirtualPath", value.ApplicationVirtualPath);
            AddParameter(cmd, "MachineName", value.MachineName);
            AddParameter(cmd, "RequestUrl", value.RequestUrl);
            AddParameter(cmd, "ExceptionType", value.ExceptionType);
            AddParameter(cmd, "Details", value.Details);
            AddParameter(cmd, "EventId", value.EventId);
            return(0 != cmd.ExecuteNonQuery());
        }
        /// <summary>
        /// Converts <see cref="System.Data.DataRow"/> to <see cref="aspnet_WebEvent_EventsRow"/>.
        /// </summary>
        /// <param name="row">The <see cref="System.Data.DataRow"/> object to be mapped.</param>
        /// <returns>A reference to the <see cref="aspnet_WebEvent_EventsRow"/> object.</returns>
        protected virtual aspnet_WebEvent_EventsRow MapRow(DataRow row)
        {
            aspnet_WebEvent_EventsRow mappedObject = new aspnet_WebEvent_EventsRow();
            DataTable  dataTable = row.Table;
            DataColumn dataColumn;

            // Column "EventId"
            dataColumn = dataTable.Columns["EventId"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.EventId = (string)row[dataColumn];
            }
            // Column "EventTimeUtc"
            dataColumn = dataTable.Columns["EventTimeUtc"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.EventTimeUtc = (System.DateTime)row[dataColumn];
            }
            // Column "EventTime"
            dataColumn = dataTable.Columns["EventTime"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.EventTime = (System.DateTime)row[dataColumn];
            }
            // Column "EventType"
            dataColumn = dataTable.Columns["EventType"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.EventType = (string)row[dataColumn];
            }
            // Column "EventSequence"
            dataColumn = dataTable.Columns["EventSequence"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.EventSequence = (decimal)row[dataColumn];
            }
            // Column "EventOccurrence"
            dataColumn = dataTable.Columns["EventOccurrence"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.EventOccurrence = (decimal)row[dataColumn];
            }
            // Column "EventCode"
            dataColumn = dataTable.Columns["EventCode"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.EventCode = (int)row[dataColumn];
            }
            // Column "EventDetailCode"
            dataColumn = dataTable.Columns["EventDetailCode"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.EventDetailCode = (int)row[dataColumn];
            }
            // Column "Message"
            dataColumn = dataTable.Columns["Message"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Message = (string)row[dataColumn];
            }
            // Column "ApplicationPath"
            dataColumn = dataTable.Columns["ApplicationPath"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.ApplicationPath = (string)row[dataColumn];
            }
            // Column "ApplicationVirtualPath"
            dataColumn = dataTable.Columns["ApplicationVirtualPath"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.ApplicationVirtualPath = (string)row[dataColumn];
            }
            // Column "MachineName"
            dataColumn = dataTable.Columns["MachineName"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.MachineName = (string)row[dataColumn];
            }
            // Column "RequestUrl"
            dataColumn = dataTable.Columns["RequestUrl"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.RequestUrl = (string)row[dataColumn];
            }
            // Column "ExceptionType"
            dataColumn = dataTable.Columns["ExceptionType"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.ExceptionType = (string)row[dataColumn];
            }
            // Column "Details"
            dataColumn = dataTable.Columns["Details"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Details = (string)row[dataColumn];
            }
            return(mappedObject);
        }
        /// <summary>
        /// Reads data from the provided data reader and returns
        /// an array of mapped objects.
        /// </summary>
        /// <param name="reader">The <see cref="System.Data.IDataReader"/> object to read data from the table.</param>
        /// <param name="startIndex">The index of the first record to map.</param>
        /// <param name="length">The number of records to map.</param>
        /// <param name="totalRecordCount">A reference parameter that returns the total number
        /// of records in the reader object if 0 was passed into the method; otherwise it returns -1.</param>
        /// <returns>An array of <see cref="aspnet_WebEvent_EventsRow"/> objects.</returns>
        protected virtual aspnet_WebEvent_EventsRow[] MapRecords(IDataReader reader,
                                                                 int startIndex, int length, ref int totalRecordCount)
        {
            if (0 > startIndex)
            {
                throw new ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex cannot be less than zero.");
            }
            if (0 > length)
            {
                throw new ArgumentOutOfRangeException("length", length, "Length cannot be less than zero.");
            }

            int eventIdColumnIndex                = reader.GetOrdinal("EventId");
            int eventTimeUtcColumnIndex           = reader.GetOrdinal("EventTimeUtc");
            int eventTimeColumnIndex              = reader.GetOrdinal("EventTime");
            int eventTypeColumnIndex              = reader.GetOrdinal("EventType");
            int eventSequenceColumnIndex          = reader.GetOrdinal("EventSequence");
            int eventOccurrenceColumnIndex        = reader.GetOrdinal("EventOccurrence");
            int eventCodeColumnIndex              = reader.GetOrdinal("EventCode");
            int eventDetailCodeColumnIndex        = reader.GetOrdinal("EventDetailCode");
            int messageColumnIndex                = reader.GetOrdinal("Message");
            int applicationPathColumnIndex        = reader.GetOrdinal("ApplicationPath");
            int applicationVirtualPathColumnIndex = reader.GetOrdinal("ApplicationVirtualPath");
            int machineNameColumnIndex            = reader.GetOrdinal("MachineName");
            int requestUrlColumnIndex             = reader.GetOrdinal("RequestUrl");
            int exceptionTypeColumnIndex          = reader.GetOrdinal("ExceptionType");
            int detailsColumnIndex                = reader.GetOrdinal("Details");

            System.Collections.ArrayList recordList = new System.Collections.ArrayList();
            int ri = -startIndex;

            while (reader.Read())
            {
                ri++;
                if (ri > 0 && ri <= length)
                {
                    aspnet_WebEvent_EventsRow record = new aspnet_WebEvent_EventsRow();
                    recordList.Add(record);

                    record.EventId         = Convert.ToString(reader.GetValue(eventIdColumnIndex));
                    record.EventTimeUtc    = Convert.ToDateTime(reader.GetValue(eventTimeUtcColumnIndex));
                    record.EventTime       = Convert.ToDateTime(reader.GetValue(eventTimeColumnIndex));
                    record.EventType       = Convert.ToString(reader.GetValue(eventTypeColumnIndex));
                    record.EventSequence   = Convert.ToDecimal(reader.GetValue(eventSequenceColumnIndex));
                    record.EventOccurrence = Convert.ToDecimal(reader.GetValue(eventOccurrenceColumnIndex));
                    record.EventCode       = Convert.ToInt32(reader.GetValue(eventCodeColumnIndex));
                    record.EventDetailCode = Convert.ToInt32(reader.GetValue(eventDetailCodeColumnIndex));
                    if (!reader.IsDBNull(messageColumnIndex))
                    {
                        record.Message = Convert.ToString(reader.GetValue(messageColumnIndex));
                    }
                    if (!reader.IsDBNull(applicationPathColumnIndex))
                    {
                        record.ApplicationPath = Convert.ToString(reader.GetValue(applicationPathColumnIndex));
                    }
                    if (!reader.IsDBNull(applicationVirtualPathColumnIndex))
                    {
                        record.ApplicationVirtualPath = Convert.ToString(reader.GetValue(applicationVirtualPathColumnIndex));
                    }
                    record.MachineName = Convert.ToString(reader.GetValue(machineNameColumnIndex));
                    if (!reader.IsDBNull(requestUrlColumnIndex))
                    {
                        record.RequestUrl = Convert.ToString(reader.GetValue(requestUrlColumnIndex));
                    }
                    if (!reader.IsDBNull(exceptionTypeColumnIndex))
                    {
                        record.ExceptionType = Convert.ToString(reader.GetValue(exceptionTypeColumnIndex));
                    }
                    if (!reader.IsDBNull(detailsColumnIndex))
                    {
                        record.Details = Convert.ToString(reader.GetValue(detailsColumnIndex));
                    }

                    if (ri == length && 0 != totalRecordCount)
                    {
                        break;
                    }
                }
            }

            totalRecordCount = 0 == totalRecordCount ? ri + startIndex : -1;
            return((aspnet_WebEvent_EventsRow[])(recordList.ToArray(typeof(aspnet_WebEvent_EventsRow))));
        }
 /// <summary>
 /// Deletes the specified object from the <c>aspnet_WebEvent_Events</c> table.
 /// </summary>
 /// <param name="value">The <see cref="aspnet_WebEvent_EventsRow"/> object to delete.</param>
 /// <returns>true if the record was deleted; otherwise, false.</returns>
 public bool Delete(aspnet_WebEvent_EventsRow value)
 {
     return(DeleteByPrimaryKey(value.EventId));
 }