Ejemplo n.º 1
0
        /// <summary>
        /// Retrieve a Guid value from an <see cref="IDbCommand" />.
        /// </summary>
        protected override Guid GetGuid(object parameterValue)
        {
            if (parameterValue == null || parameterValue == DBNull.Value)
            {
                throw new InvalidCastException(RM.Get_Error_CannotConvertDBNullToEnum());
            }

            try
            {
                return(new Guid(base.GetString(parameterValue, null)));
            }
            catch
            {
                throw new InvalidCastException(RM.Get_Error_CannotConvertParameterToEnum());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieve a Guid value from a data record.
        /// </summary>
        public override Guid GetGuid(IDataRecord dataRecord, int ordinal)
        {
            if (dataRecord == null)
            {
                throw new ArgumentNullException("dataRecord");
            }

            if (dataRecord.IsDBNull(ordinal))
            {
                throw new InvalidCastException(RM.Get_Error_CannotConvertDBNullToEnum());
            }

            try
            {
                return(new Guid(base.GetString(dataRecord, ordinal)));
            }
            catch
            {
                throw new InvalidCastException(RM.Get_Error_CannotConvertParameterToEnum());
            }
        }