Microsoft.Practices.EnterpriseLibrary.Data DiscoverParameters() Error

I’m generally against the Enterprise Library, but for reasons that are not to be discussed they are consumed in the framework I have developed.

Yesterday I encountered a serious error, that I tracked to the enterprise library.

Keep in mind that the target provider is SQL Server 2005.

At some point the framework builds an sql command that will be user to execute a stored procedure. One of the only two commands used from the library is DiscoverParameters which queries the procedure on the server and fills the paramaters collection on the command object.

The problem is that even though a parameter is defined as OUTPUT on the database server, the enterprise library insists on marking the parameter with INPUTOUTPUT direction. I surveyed the problem through Internet and Reflector and the database reported the parameters as trully OUTPUT only.

The solution is to either write your own DiscoverParameters which is not that difficult rather time consuming, or in my case tamper your code to work with some additional assumptions that are not correct and you I will surelly come across as a problem in the future.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s