/// <summary>
        /// Converts <see cref="System.Data.DataRow"/> to <see cref="aspnet_SchemaVersionsRow"/>.
        /// </summary>
        /// <param name="row">The <see cref="System.Data.DataRow"/> object to be mapped.</param>
        /// <returns>A reference to the <see cref="aspnet_SchemaVersionsRow"/> object.</returns>
        protected virtual aspnet_SchemaVersionsRow MapRow(DataRow row)
        {
            aspnet_SchemaVersionsRow mappedObject = new aspnet_SchemaVersionsRow();
            DataTable  dataTable = row.Table;
            DataColumn dataColumn;

            // Column "Feature"
            dataColumn = dataTable.Columns["Feature"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Feature = (string)row[dataColumn];
            }
            // Column "CompatibleSchemaVersion"
            dataColumn = dataTable.Columns["CompatibleSchemaVersion"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.CompatibleSchemaVersion = (string)row[dataColumn];
            }
            // Column "IsCurrentVersion"
            dataColumn = dataTable.Columns["IsCurrentVersion"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.IsCurrentVersion = (bool)row[dataColumn];
            }
            return(mappedObject);
        }
        /// <summary>
        /// Updates a record in the <c>aspnet_SchemaVersions</c> table.
        /// </summary>
        /// <param name="value">The <see cref="aspnet_SchemaVersionsRow"/>
        /// object used to update the table record.</param>
        /// <returns>true if the record was updated; otherwise, false.</returns>
        public virtual bool Update(aspnet_SchemaVersionsRow value)
        {
            IDbCommand cmd = _db.CreateCommand("dbo._aspnet_SchemaVersions_Update", true);

            AddParameter(cmd, "IsCurrentVersion", value.IsCurrentVersion);
            AddParameter(cmd, "Feature", value.Feature);
            AddParameter(cmd, "CompatibleSchemaVersion", value.CompatibleSchemaVersion);
            return(0 != cmd.ExecuteNonQuery());
        }
        /// <summary>
        /// Adds a new record into the <c>aspnet_SchemaVersions</c> table.
        /// </summary>
        /// <param name="value">The <see cref="aspnet_SchemaVersionsRow"/> object to be inserted.</param>
        public virtual void Insert(aspnet_SchemaVersionsRow value)
        {
            IDbCommand cmd = _db.CreateCommand("dbo._aspnet_SchemaVersions_Insert", true);

            AddParameter(cmd, "Feature", value.Feature);
            AddParameter(cmd, "CompatibleSchemaVersion", value.CompatibleSchemaVersion);
            AddParameter(cmd, "IsCurrentVersion", value.IsCurrentVersion);
            cmd.ExecuteNonQuery();
        }
        /// <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_SchemaVersionsRow"/> objects.</returns>
        protected virtual aspnet_SchemaVersionsRow[] 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 featureColumnIndex = reader.GetOrdinal("Feature");
            int compatibleSchemaVersionColumnIndex = reader.GetOrdinal("CompatibleSchemaVersion");
            int isCurrentVersionColumnIndex        = reader.GetOrdinal("IsCurrentVersion");

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

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

                    record.Feature = Convert.ToString(reader.GetValue(featureColumnIndex));
                    record.CompatibleSchemaVersion = Convert.ToString(reader.GetValue(compatibleSchemaVersionColumnIndex));
                    record.IsCurrentVersion        = Convert.ToBoolean(reader.GetValue(isCurrentVersionColumnIndex));

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

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