コード例 #1
0
        public object CreateEntityProxy(Type baseType, Puzzle.NPersist.Framework.Persistence.IObjectFactory objectFactory, Puzzle.NPersist.Framework.Mapping.IClassMap classMap, object[] ctorArgs)
        {
            Type proxyType = aopEngine.CreateProxyType(baseType);

            object[] proxyArgs = aopEngine.AddStateToCtorParams(context, ctorArgs);

            return(context.ObjectFactory.CreateInstance(proxyType, proxyArgs));
        }
コード例 #2
0
        public Puzzle.NPersist.Framework.Interfaces.IInterceptableList CreateListProxy(Type baseType, Puzzle.NPersist.Framework.Persistence.IObjectFactory objectFactory, params object[] ctorArgs)
        {
            //	return Puzzle.NPersist.Framework.Proxy.ListProxyFactory.CreateProxy(baseType,objectFactory,ctorArgs) ;

            if (baseType == typeof(IInterceptableList) || baseType == typeof(InterceptableList) || baseType == typeof(IList))
            {
                baseType = typeof(InterceptableList);
                return((Puzzle.NPersist.Framework.Interfaces.IInterceptableList)context.ObjectFactory.CreateInstance(baseType, ctorArgs));
            }
#if NET2
            else if (baseType.IsGenericType && baseType.IsInterface)
            {
                Type subType     = baseType.GetGenericArguments()[0];
                Type genericType = typeof(InterceptableGenericsList <>).MakeGenericType(subType);

                return((Puzzle.NPersist.Framework.Interfaces.IInterceptableList)context.ObjectFactory.CreateInstance(genericType, ctorArgs));
            }
#endif
            else
            {
                Type     proxyType = aopEngine.CreateProxyType(baseType);
                object[] proxyArgs = aopEngine.AddStateToCtorParams(context, ctorArgs);

                return((Puzzle.NPersist.Framework.Interfaces.IInterceptableList)context.ObjectFactory.CreateInstance(proxyType, proxyArgs));
                //return Puzzle.NPersist.Framework.Proxy.ListProxyFactory.CreateProxy(baseType,objectFactory,ctorArgs) ;
            }
        }