Added Objects DebugProfile and DebugDBTrack for command-line parameters /Profile and /DBTrack

Added code to retrieve command-line parameters.
Added property CalledFromCSLA to retrieve the CSLA object and method used by DBTracking.
Added ProfileTimer object to track CPU using by methods
This commit is contained in:
Rich
2015-01-19 20:52:32 +00:00
parent 25719bf869
commit 6a973a288b
4 changed files with 243 additions and 0 deletions

View File

@@ -140,6 +140,27 @@ namespace Volian.Base.Library
return "No Local Method";
}
}
public static string CalledFromCSLA
{
get
{
StackTrace st = new StackTrace(true);
StackFrame[] sfs = st.GetFrames();
int count = 0;
string lastWasCSLA = null;
foreach (StackFrame sf in sfs)
{
string sType = sf.GetMethod().ReflectedType.FullName;
string sMethod = sf.GetMethod().Name;
if (sType.StartsWith("VEPROMS.CSLA.Library") && !sType.StartsWith("VEPROMS.CSLA.Library.Database")
&& !sMethod.StartsWith("DataPortal") && !sMethod.StartsWith("SetParentSectionAndDocVersion"))// Only look at Local Methods
lastWasCSLA = string.Format("{0}.{1}[{2}]", sType, sMethod, sf.GetFileLineNumber());
else
if (lastWasCSLA != null) return lastWasCSLA;
}
return "No CSLA Method";
}
}
private static StackFrame[] _LastSFS;
private static int MatchingStackFrame(StackFrame[] sfs)
{