Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# methoddecorator.fody是否可以使用方法OnExit调用实例方法_C#_Aop - Fatal编程技术网

C# methoddecorator.fody是否可以使用方法OnExit调用实例方法

C# methoddecorator.fody是否可以使用方法OnExit调用实例方法,c#,aop,C#,Aop,我正在处理一个AOP项目,其中有一个类(称为classA)继承自另一个类(称为ParentClass)。暗号 [Interceptor] class ParentClass { protected void Init() { ... } } 创建classA的新实例时,我希望AOP调用ParentClass的Init(),但我发现这对我来说很难。 请帮忙 更新。 嗨,伙计们。有一件事你们应该知道,我想要一个AOP截取,而不是来自子类的方法调用。因为我有太多

我正在处理一个AOP项目,其中有一个类(称为classA)继承自另一个类(称为ParentClass)。暗号

[Interceptor]
class ParentClass
{
    protected void Init()
    {
       ...
    }
}
创建classA的新实例时,我希望AOP调用ParentClass的Init(),但我发现这对我来说很难。 请帮忙

更新。

嗨,伙计们。有一件事你们应该知道,我想要一个AOP截取,而不是来自子类的方法调用。因为我有太多的对象,我希望在.ctor

公共类MyParentClass的onExit中立即调用
public class MyParentClass
{
    public virtual void SomeMethod()
    {
    /* do parent class stuff here */
    }
}

public class MyChildClass : MyParentClass
{
   public override void SomeMethod()
   {
    /* do child class stuff here */
    base.SomeMethod(); // <--- This will call the parent class method
   }
}
{ 公共虚拟方法() { /*在这里做家长课的事情*/ } } 公共类MyChildClass:MyParentClass { 公共重写无效方法() { /*在这里做儿童课的事情*/
base.SomeMethod();//您使用的是哪种AOP框架?有用我喜欢这段代码只参考代码链接:-@YuriyFaktorovich,AOP框架是MethodDecorator.fody这是一个直接的父方法调用,而不是AOP
public class MyParentClass
{
    public virtual void SomeMethod()
    {
    /* do parent class stuff here */
    }
}

public class MyChildClass : MyParentClass
{
   public override void SomeMethod()
   {
    /* do child class stuff here */
    base.SomeMethod(); // <--- This will call the parent class method
   }
}