tmenier / AsyncPoco

A long-"awaited" fully asynchronous PetaPoco fork
Other
127 stars 33 forks source link

Please fix blocking exception with Devart Oracle provider #22

Closed jonnybee closed 8 years ago

jonnybee commented 9 years ago

Introduced with PR #17.

In my opinion one must always check if the property exists when using reflection. Now we will always get null-recerence exception when using AsyncPoco with Devart dotConnect for Oracle.

I can submit PR if you want.

Code should be:

public override void PreExecute(IDbCommand cmd)
{
    var bbnProperty = cmd.GetType().GetProperty("BindByName");
    if (bbnPropery != null)
    { 
        bbnProperty.SetValue(cmd, true, null);
    }
    //see http://docs.oracle.com/html/A96160_01/features.htm#1048395
    //if command does not have "InitialLONGFetchSize" property this code 
    // will not throw NullReferenceException
    var ilfsProperty = cmd.GetType().GetProperty("InitialLONGFetchSize");
    if (ilfsProperty != null)
    {
       ilfsProperty.SetValue(cmd, -1);
    }
}
tmenier commented 8 years ago

Apologies for not responding way back. It's getting fixed for 1.2.

tmenier commented 8 years ago

released https://www.nuget.org/packages/AsyncPoco/1.2.0