/// <summary> /// Updates a record in the <c>aspnet_Roles</c> table. /// </summary> /// <param name="value">The <see cref="aspnet_RolesRow"/> /// object used to update the table record.</param> /// <returns>true if the record was updated; otherwise, false.</returns> public virtual bool Update(aspnet_RolesRow value) { IDbCommand cmd = _db.CreateCommand("dbo._aspnet_Roles_Update", true); AddParameter(cmd, "ApplicationId", value.ApplicationId); AddParameter(cmd, "RoleName", value.RoleName); AddParameter(cmd, "LoweredRoleName", value.LoweredRoleName); AddParameter(cmd, "Description", value.Description); AddParameter(cmd, "RoleId", value.RoleId); return(0 != cmd.ExecuteNonQuery()); }
/// <summary> /// Adds a new record into the <c>aspnet_Roles</c> table. /// </summary> /// <param name="value">The <see cref="aspnet_RolesRow"/> object to be inserted.</param> public virtual void Insert(aspnet_RolesRow value) { IDbCommand cmd = _db.CreateCommand("dbo._aspnet_Roles_Insert", true); AddParameter(cmd, "ApplicationId", value.ApplicationId); AddParameter(cmd, "RoleId", value.RoleId); AddParameter(cmd, "RoleName", value.RoleName); AddParameter(cmd, "LoweredRoleName", value.LoweredRoleName); AddParameter(cmd, "Description", value.Description); 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_RolesRow"/> objects.</returns> protected virtual aspnet_RolesRow[] 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 applicationIdColumnIndex = reader.GetOrdinal("ApplicationId"); int roleIdColumnIndex = reader.GetOrdinal("RoleId"); int roleNameColumnIndex = reader.GetOrdinal("RoleName"); int loweredRoleNameColumnIndex = reader.GetOrdinal("LoweredRoleName"); int descriptionColumnIndex = reader.GetOrdinal("Description"); System.Collections.ArrayList recordList = new System.Collections.ArrayList(); int ri = -startIndex; while (reader.Read()) { ri++; if (ri > 0 && ri <= length) { aspnet_RolesRow record = new aspnet_RolesRow(); recordList.Add(record); record.ApplicationId = reader.GetGuid(applicationIdColumnIndex); record.RoleId = reader.GetGuid(roleIdColumnIndex); record.RoleName = Convert.ToString(reader.GetValue(roleNameColumnIndex)); record.LoweredRoleName = Convert.ToString(reader.GetValue(loweredRoleNameColumnIndex)); if (!reader.IsDBNull(descriptionColumnIndex)) { record.Description = Convert.ToString(reader.GetValue(descriptionColumnIndex)); } if (ri == length && 0 != totalRecordCount) { break; } } } totalRecordCount = 0 == totalRecordCount ? ri + startIndex : -1; return((aspnet_RolesRow[])(recordList.ToArray(typeof(aspnet_RolesRow)))); }
/// <summary> /// Converts <see cref="System.Data.DataRow"/> to <see cref="aspnet_RolesRow"/>. /// </summary> /// <param name="row">The <see cref="System.Data.DataRow"/> object to be mapped.</param> /// <returns>A reference to the <see cref="aspnet_RolesRow"/> object.</returns> protected virtual aspnet_RolesRow MapRow(DataRow row) { aspnet_RolesRow mappedObject = new aspnet_RolesRow(); DataTable dataTable = row.Table; DataColumn dataColumn; // Column "ApplicationId" dataColumn = dataTable.Columns["ApplicationId"]; if (!row.IsNull(dataColumn)) { mappedObject.ApplicationId = (System.Guid)row[dataColumn]; } // Column "RoleId" dataColumn = dataTable.Columns["RoleId"]; if (!row.IsNull(dataColumn)) { mappedObject.RoleId = (System.Guid)row[dataColumn]; } // Column "RoleName" dataColumn = dataTable.Columns["RoleName"]; if (!row.IsNull(dataColumn)) { mappedObject.RoleName = (string)row[dataColumn]; } // Column "LoweredRoleName" dataColumn = dataTable.Columns["LoweredRoleName"]; if (!row.IsNull(dataColumn)) { mappedObject.LoweredRoleName = (string)row[dataColumn]; } // Column "Description" dataColumn = dataTable.Columns["Description"]; if (!row.IsNull(dataColumn)) { mappedObject.Description = (string)row[dataColumn]; } return(mappedObject); }
/// <summary> /// Deletes the specified object from the <c>aspnet_Roles</c> table. /// </summary> /// <param name="value">The <see cref="aspnet_RolesRow"/> object to delete.</param> /// <returns>true if the record was deleted; otherwise, false.</returns> public bool Delete(aspnet_RolesRow value) { return(DeleteByPrimaryKey(value.RoleId)); }