コード例 #1
0
        /// <summary>
        /// Updates a record in the <c>aspnet_PersonalizationPerUser</c> table.
        /// </summary>
        /// <param name="value">The <see cref="aspnet_PersonalizationPerUserRow"/>
        /// object used to update the table record.</param>
        /// <returns>true if the record was updated; otherwise, false.</returns>
        public virtual bool Update(aspnet_PersonalizationPerUserRow value)
        {
            IDbCommand cmd = _db.CreateCommand("dbo._aspnet_PersonalizationPerUser_Update", true);

            AddParameter(cmd, "PathId",
                         value.IsPathIdNull ? DBNull.Value : (object)value.PathId);
            AddParameter(cmd, "UserId",
                         value.IsUserIdNull ? DBNull.Value : (object)value.UserId);
            AddParameter(cmd, "PageSettings", value.PageSettings);
            AddParameter(cmd, "LastUpdatedDate", value.LastUpdatedDate);
            AddParameter(cmd, "Id", value.Id);
            return(0 != cmd.ExecuteNonQuery());
        }
コード例 #2
0
        /// <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_PersonalizationPerUserRow"/> objects.</returns>
        protected virtual aspnet_PersonalizationPerUserRow[] 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 idColumnIndex              = reader.GetOrdinal("Id");
            int pathIdColumnIndex          = reader.GetOrdinal("PathId");
            int userIdColumnIndex          = reader.GetOrdinal("UserId");
            int pageSettingsColumnIndex    = reader.GetOrdinal("PageSettings");
            int lastUpdatedDateColumnIndex = reader.GetOrdinal("LastUpdatedDate");

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

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

                    record.Id = reader.GetGuid(idColumnIndex);
                    if (!reader.IsDBNull(pathIdColumnIndex))
                    {
                        record.PathId = reader.GetGuid(pathIdColumnIndex);
                    }
                    if (!reader.IsDBNull(userIdColumnIndex))
                    {
                        record.UserId = reader.GetGuid(userIdColumnIndex);
                    }
                    record.PageSettings    = (byte[])reader.GetValue(pageSettingsColumnIndex);
                    record.LastUpdatedDate = Convert.ToDateTime(reader.GetValue(lastUpdatedDateColumnIndex));

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

            totalRecordCount = 0 == totalRecordCount ? ri + startIndex : -1;
            return((aspnet_PersonalizationPerUserRow[])(recordList.ToArray(typeof(aspnet_PersonalizationPerUserRow))));
        }
コード例 #3
0
        /// <summary>
        /// Converts <see cref="System.Data.DataRow"/> to <see cref="aspnet_PersonalizationPerUserRow"/>.
        /// </summary>
        /// <param name="row">The <see cref="System.Data.DataRow"/> object to be mapped.</param>
        /// <returns>A reference to the <see cref="aspnet_PersonalizationPerUserRow"/> object.</returns>
        protected virtual aspnet_PersonalizationPerUserRow MapRow(DataRow row)
        {
            aspnet_PersonalizationPerUserRow mappedObject = new aspnet_PersonalizationPerUserRow();
            DataTable  dataTable = row.Table;
            DataColumn dataColumn;

            // Column "Id"
            dataColumn = dataTable.Columns["Id"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Id = (System.Guid)row[dataColumn];
            }
            // Column "PathId"
            dataColumn = dataTable.Columns["PathId"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.PathId = (System.Guid)row[dataColumn];
            }
            // Column "UserId"
            dataColumn = dataTable.Columns["UserId"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.UserId = (System.Guid)row[dataColumn];
            }
            // Column "PageSettings"
            dataColumn = dataTable.Columns["PageSettings"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.PageSettings = (byte[])row[dataColumn];
            }
            // Column "LastUpdatedDate"
            dataColumn = dataTable.Columns["LastUpdatedDate"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.LastUpdatedDate = (System.DateTime)row[dataColumn];
            }
            return(mappedObject);
        }
コード例 #4
0
 /// <summary>
 /// Deletes the specified object from the <c>aspnet_PersonalizationPerUser</c> table.
 /// </summary>
 /// <param name="value">The <see cref="aspnet_PersonalizationPerUserRow"/> object to delete.</param>
 /// <returns>true if the record was deleted; otherwise, false.</returns>
 public bool Delete(aspnet_PersonalizationPerUserRow value)
 {
     return(DeleteByPrimaryKey(value.Id));
 }