using Castle.DynamicProxy;

namespace Edu.AOP
{
    /// <summary>
    /// AOP帮助类
    /// </summary>
    public class AOPHelper
    {
        /// <summary>
        /// 生成代理类对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static T CreateAOPObject<T>() where T : class
        {
            ProxyGenerator generator = new ProxyGenerator();
            IOCInterceptor interceptor = new IOCInterceptor();
            T t = generator.CreateClassProxy<T>(interceptor);
            return t;
        }
    }
}
