2
Vote

SprocAccessor.Execute Bug EL 6

description

The Execute method of the SprocAccessor is returning base.Execute(command):
        using (DbCommand command = Database.GetStoredProcCommand(procedureName))
        {
            parameterMapper.AssignParameters(command, parameterValues);
            return base.Execute(command);
        }
When trying to iterate through the returned IEnumerable an exception is thrown stating that the DbCommand object has already been disposed.

Shouldn't it do what the SqlStringAccessor does? Namely:
        foreach (var result in base.Execute(command))
        {
            yield return result;
        }
I changed the SprocAccessor.Execute method to mirror SqlStringAccessor and that fixed it:
    public override IEnumerable<TResult> Execute(params object[] parameterValues)
    {
            using (DbCommand command = Database.GetStoredProcCommand(procedureName))
            {
                parameterMapper.AssignParameters(command, parameterValues);
                foreach (var result in base.Execute(command))
                    yield return result;
            }
    }
Mike

comments

Michael_Lopez wrote Jun 5, 2014 at 1:38 PM

P.S. I should mention that I'm using IBM's .Net provider for System I (assembly IBM.Data.DB2.iSeries.dll)

cperriot wrote Jul 2, 2014 at 9:51 AM

exact same problem and resolution with Sybase ASE 15.
provider: Sybase.Data.AseClient