Exemplo 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_CannotConvertDBNullToGuid());

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

            if (dataRecord.IsDBNull(ordinal))
                throw new InvalidCastException(RM.Get_Error_CannotConvertDBNullToGuid());
            
            try
            {
                return new Guid(base.GetString(dataRecord, ordinal));
            }
            catch
            {
                throw new InvalidCastException(RM.Get_Error_CannotConvertParameterToGuid());
            }
        }
Exemplo n.º 3
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_CannotConvertDBNullToGuid());
            }

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