Npoco Debugging and Profiling with version 3

136 Views Asked by At

trying to implement this sample code to show last sql statement in the exception.

   public class MyDb : Database 
{
    public MyDb(string connectionStringName) : base(connectionStringName) { }

    public override void OnException(Exception e)
    {
        base.OnException(e);
        e.Data["LastSQL"] = this.LastSQL;
    }
}

but i am getting error on OnException.

cannot change access modifier when overriding protected inherited memeber 'Database.OnException'

Any idea.

1

There are 1 best solutions below

0
JAZ On

The function override is protected and not public per the error message

public override void OnException(Exception e)

should be

protected override void OnException(Exception e)