日期:2014-05-16 浏览次数:20418 次
namespace aop
{
[AopAttribute]
public class mod
{
public int Age
{
get;
set;
}
public string Name
{
get;
set;
}
}
public class AopAttribute : ProxyAttribute
{
public override MarshalByRefObject CreateInstance(Type serverType)
{
AopProxy realProxy = new AopProxy(serverType);
return realProxy.GetTransparentProxy() as MarshalByRefObject;
}
}
public class AopProxy : RealProxy
{
public AopProxy(Type serverType)
: base(serverType)
{
}
public override IMessage Invoke(IMessage msg)
{
//中间的代码省略了
return msg;
}
}
}