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

            AddParameter(cmd, "PropertyNames", value.PropertyNames);
            AddParameter(cmd, "PropertyValuesString", value.PropertyValuesString);
            AddParameter(cmd, "PropertyValuesBinary", value.PropertyValuesBinary);
            AddParameter(cmd, "LastUpdatedDate", value.LastUpdatedDate);
            AddParameter(cmd, "UserId", value.UserId);
            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_ProfileRow"/> objects.</returns>
        protected virtual aspnet_ProfileRow[] 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 userIdColumnIndex               = reader.GetOrdinal("UserId");
            int propertyNamesColumnIndex        = reader.GetOrdinal("PropertyNames");
            int propertyValuesStringColumnIndex = reader.GetOrdinal("PropertyValuesString");
            int propertyValuesBinaryColumnIndex = reader.GetOrdinal("PropertyValuesBinary");
            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_ProfileRow record = new aspnet_ProfileRow();
                    recordList.Add(record);

                    record.UserId               = reader.GetGuid(userIdColumnIndex);
                    record.PropertyNames        = Convert.ToString(reader.GetValue(propertyNamesColumnIndex));
                    record.PropertyValuesString = Convert.ToString(reader.GetValue(propertyValuesStringColumnIndex));
                    record.PropertyValuesBinary = (byte[])reader.GetValue(propertyValuesBinaryColumnIndex);
                    record.LastUpdatedDate      = Convert.ToDateTime(reader.GetValue(lastUpdatedDateColumnIndex));

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

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

            // Column "UserId"
            dataColumn = dataTable.Columns["UserId"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.UserId = (System.Guid)row[dataColumn];
            }
            // Column "PropertyNames"
            dataColumn = dataTable.Columns["PropertyNames"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.PropertyNames = (string)row[dataColumn];
            }
            // Column "PropertyValuesString"
            dataColumn = dataTable.Columns["PropertyValuesString"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.PropertyValuesString = (string)row[dataColumn];
            }
            // Column "PropertyValuesBinary"
            dataColumn = dataTable.Columns["PropertyValuesBinary"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.PropertyValuesBinary = (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_Profile</c> table.
 /// </summary>
 /// <param name="value">The <see cref="aspnet_ProfileRow"/> object to delete.</param>
 /// <returns>true if the record was deleted; otherwise, false.</returns>
 public bool Delete(aspnet_ProfileRow value)
 {
     return(DeleteByPrimaryKey(value.UserId));
 }