I have a magic number in the following code…
Microsoft.Practices.EnterpriseLibrary.Data.Database db = /* code omitted */;
db.AddOutParameter(command, "@ParamName", DbType.Int32, 8);
Is there a clean way to get the length of DbType.Int32, as required for the last argument to AddOutParameter?
Not sure what you mean about length. It’s a 32 bit int so it’s 4 bytes which can be 10 digits as described in this quote from this MSDN page. An integral type representing signed 32-bit integers with values between -2147483648 and 2147483647.
I’m not sure hat specifying the size (the
8) for an int32 makes sense. For example, if it should map to an OracleNumberwith a specified size of 8 it should probably beDbType.Decimalrather than Int32.I’d suggest looking into just removing the 8 altogether since it’s an output parameter I don’t think it would affect anything.