ParameterOut BUG?

Nov 15, 2012 at 2:55 AM

string str = builder.ParameterValue<string>("mid");

str is DbNull


 public TParameterType ParameterValue<TParameterType>(string outputParameterName)
            outputParameterName = _data.ContextData.Provider.GetParameterName(outputParameterName);
            if (!_data.InnerCommand.Parameters.Contains(outputParameterName))
                throw new FluentDataException(string.Format("Parameter {0} not found", outputParameterName));

            var value = (_data.InnerCommand.Parameters[outputParameterName] as System.Data.IDataParameter).Value;

            if (value == DBNull.Value || value==null)
                return default(TParameterType);

            if (value.GetType() == typeof(TParameterType))
                return (TParameterType)value;

            return (TParameterType)Convert.ChangeType(value, typeof(TParameterType));

Nov 26, 2012 at 12:27 AM

Thank you. This is fixed in the latest check in, however the latest source code includes some API changes/simplifications so I need to wait a few days until I make a new release in order to update the documentation. I will notify you when the release is out.