Beispiel #1
0
        /// <summary>
        /// A <see cref="System.String"/> that represents the current
        /// <see cref="Spring.Aop.Framework.ProxyConfig"/> configuration.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents the current
        /// <see cref="Spring.Aop.Framework.ProxyConfig"/> configuration.
        /// </returns>
        public override string ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("proxyTargetType=" + ProxyTargetType + "; ");
            buffer.Append("proxyTargetAttributes=" + ProxyTargetAttributes + "; ");
            buffer.Append("exposeProxy=" + ExposeProxy + "; ");
            buffer.Append("isFrozen=" + IsFrozen + "; ");
            buffer.Append("optimize=" + Optimize + "; ");
            buffer.Append("aopProxyFactory=" + AopProxyFactory.GetType().FullName + "; ");
            return(buffer.ToString());
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            //ILogic obj = AopProxyFactory.GetProxy<ILogic>();
            ILogic obj = AopProxyFactory.GetProxy <ILogic, LogicObject>();

            obj.Add(3, 3);
            obj.Add(-2, 12);
            int result = obj.Result;

            obj.ShowResult();
            Console.WriteLine("*********************************************");

            Console.WriteLine("start performance test, please input invoke times:");
            string strTimes = Console.ReadLine();
            int    times    = Convert.ToInt32(strTimes);

            Stopwatch watcher = new Stopwatch();

            watcher.Start();

            for (float i = 0; i < times; i++)
            {
                obj.Add(i, i);
            }

            watcher.Stop();


            TimeSpan time = watcher.Elapsed;

            double total    = watcher.Elapsed.TotalMilliseconds;
            double preTimes = total / times;

            Console.WriteLine("total: {0} \tPreTimes: {1}", total, preTimes);
            Console.Read();
        }
Beispiel #3
0
 /// <summary>
 /// Creates the specified instance.
 /// </summary>
 /// <param name="instance">The instance.</param>
 /// <param name="injectionDelegates">The injection delegates.</param>
 /// <returns></returns>
 public static AopProxy <T> Create(T instance, MethodInjectionDelegates injectionDelegates = null)
 {
     return(AopProxyFactory.AsAopInterfaceProxy(instance, injectionDelegates) as AopProxy <T>);
 }