Proxy 目标类型为的spring.net代理工厂需要虚拟属性吗?

Proxy 目标类型为的spring.net代理工厂需要虚拟属性吗?,proxy,properties,virtual,aop,spring.net,Proxy,Properties,Virtual,Aop,Spring.net,我在代码中创建spring.net代理,方法是使用ProxyFactory对象,将ProxyTargetType设置为true,以便在非接口复杂对象上使用代理。 在我调用该对象上的方法之前,代理似乎还可以。该方法引用公共属性,如果该属性不是虚拟的,则其值为null 如果在Spring配置文件中使用Spring.Aop.Framework.AutoProxy.InheritanceBaseDaopConfiger,则不会发生这种情况,但在这种情况下,我不能使用它,因为Spring上下文不拥有此对象

我在代码中创建spring.net代理,方法是使用ProxyFactory对象,将ProxyTargetType设置为true,以便在非接口复杂对象上使用代理。 在我调用该对象上的方法之前,代理似乎还可以。该方法引用公共属性,如果该属性不是虚拟的,则其值为null

如果在Spring配置文件中使用Spring.Aop.Framework.AutoProxy.InheritanceBaseDaopConfiger,则不会发生这种情况,但在这种情况下,我不能使用它,因为Spring上下文不拥有此对象

有这样的行为是正常的还是有一个调整来执行我想要的(代理对象虚拟方法而不必更改虚拟属性)? 请注意,我尝试了factory.AutoDetectInterface和factory.ProxyTargetAttribute值,但没有帮助

我的代理创建代码:

public static T CreateMethodCallStatProxy<T>()
  {
   // Proxy factory
   ProxyFactory factory = new ProxyFactory();
   factory.AddAdvice(new CallMonitorTrackerAdvice());
   factory.ProxyTargetType = true;   

   // Create instance
   factory.Target = Activator.CreateInstance<T>();

   // Get proxy
   T proxiedClass = (T)factory.GetProxy();

   return proxiedClass;
  }
public static T CreateMethodCallStatProxy()
{
//代理工厂
ProxyFactory工厂=新的ProxyFactory();
factory.AddAdvice(新的callMonitorTrackRadvice());
factory.ProxyTargetType=true;
//创建实例
factory.Target=Activator.CreateInstance();
//获取代理
T proxiedClass=(T)factory.GetProxy();
返回代理类;
}

感谢您的帮助

好的,所以属性需要是虚拟的