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

            // Column "ApplicationId"
            dataColumn = dataTable.Columns["ApplicationId"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.ApplicationId = (System.Guid)row[dataColumn];
            }
            // Column "PathId"
            dataColumn = dataTable.Columns["PathId"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.PathId = (System.Guid)row[dataColumn];
            }
            // Column "Path"
            dataColumn = dataTable.Columns["Path"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Path = (string)row[dataColumn];
            }
            // Column "LoweredPath"
            dataColumn = dataTable.Columns["LoweredPath"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.LoweredPath = (string)row[dataColumn];
            }
            return(mappedObject);
        }
Example #2
0
        /// <summary>
        /// Updates a record in the <c>aspnet_Paths</c> table.
        /// </summary>
        /// <param name="value">The <see cref="aspnet_PathsRow"/>
        /// object used to update the table record.</param>
        /// <returns>true if the record was updated; otherwise, false.</returns>
        public virtual bool Update(aspnet_PathsRow value)
        {
            IDbCommand cmd = _db.CreateCommand("dbo._aspnet_Paths_Update", true);

            AddParameter(cmd, "ApplicationId", value.ApplicationId);
            AddParameter(cmd, "Path", value.Path);
            AddParameter(cmd, "LoweredPath", value.LoweredPath);
            AddParameter(cmd, "PathId", value.PathId);
            return(0 != cmd.ExecuteNonQuery());
        }
Example #3
0
        /// <summary>
        /// Adds a new record into the <c>aspnet_Paths</c> table.
        /// </summary>
        /// <param name="value">The <see cref="aspnet_PathsRow"/> object to be inserted.</param>
        public virtual void Insert(aspnet_PathsRow value)
        {
            IDbCommand cmd = _db.CreateCommand("dbo._aspnet_Paths_Insert", true);

            AddParameter(cmd, "ApplicationId", value.ApplicationId);
            AddParameter(cmd, "PathId", value.PathId);
            AddParameter(cmd, "Path", value.Path);
            AddParameter(cmd, "LoweredPath", value.LoweredPath);
            cmd.ExecuteNonQuery();
        }
Example #4
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_PathsRow"/> objects.</returns>
        protected virtual aspnet_PathsRow[] 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 pathIdColumnIndex        = reader.GetOrdinal("PathId");
            int pathColumnIndex          = reader.GetOrdinal("Path");
            int loweredPathColumnIndex   = reader.GetOrdinal("LoweredPath");

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

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

                    record.ApplicationId = reader.GetGuid(applicationIdColumnIndex);
                    record.PathId        = reader.GetGuid(pathIdColumnIndex);
                    record.Path          = Convert.ToString(reader.GetValue(pathColumnIndex));
                    record.LoweredPath   = Convert.ToString(reader.GetValue(loweredPathColumnIndex));

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

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