Redefine the method in parent class without making too many changes
am 17.10.2007 23:02:02 von Fir5tSightI have the following pseudo code:
------------------------------------------------------------ -------------
class Report
{
Files()
{
CoreConnection cc = new CoreConnection ();
cc.GetListFromStoredProcedure();
}
}
class CoreConnection
{
GetListFromStoredProcedure()
{
//blah blah blah
RunSafeSql();
//blah blah blah
}
RunSafeSql()
{
//blah blah blah
InternalExecuteGenericSqlCall();
//blah blah blah
}
InternalExecuteGenericSqlCall()
{
//blah blah blah
WriteSqlCallEndEvent(); // This should be skipped if the original
caller is from JoinConsoleCoreConnection
//blah blah blah
}
}
class JoinConsoleCoreConnection : CoreConnection
{
FilterReportFiles()
{
//blah blah blah
Report aReport = new Report();
aReport.Files();
//blah blah blah
}
}
------------------------------------------------------------ -------------
As you can see, "aReport.Files()" will eventually call
"WriteSqlCallEndEvent" through relay of calls. However, if the
original caller is anywhere (or at least from "FilterReportFiles" in
"JoinConsoleCoreConnection", "WriteSqlCallEndEvent" should be skipped,
which means that the "InternalExecuteGenericSqlCall" method should be
redefined for caller from "JoinConsoleCoreConnection". Any advice on
how to make a minimum changes to accomplish this?
Thanks!