如果我TableAdapter
只有Table Adapter
.
因此,例如,有这个类:
public class example
{
public User _user;
public TableAdapter _adapter;
someMethods();
.
.
.
}
我使用面向方面的框架 PostSharp。出于日志记录的目的,我有一个日志记录类,该类具有在调用 get_Adapter 方法时执行的方法。因此,在我的日志记录类中,我得到了TableAdapter
作为参数。我最终需要的是 User 对象。
不幸的是,我无法更改我需要获得的课程设计中的任何内容,所以我只有这个TableAdapter
。我的日志记录类看起来像这样(简化):
public class logger
{
public override void OnExit(MethodExecutionArgs args)
{
TableAdapter = (TableAdapter)args.Instance;
//here I need the example object in order to get the current user object
}
}
有没有办法做到这一点?反射,也许?任何事物?
提前感谢您的帮助。
哦,顺便说一下,我使用 C# 和 WinForms。