Esempio n. 1
0
        /// <summary>
        /// 创建指定对象的实体代理对象
        /// </summary>
        /// <returns>实体代理对象</returns>
        /// <param name="object">对象</param>
        /// <typeparam name="T"></typeparam>
        public static T CreateProxy <T>(T @object)
        {
            T target = CreateProxy <T>();

            var handler = DynamicHelper.CreateDynamicMapHandler(typeof(T), target.GetType());

            handler(@object, target);

            ((IEntityObject)target).Reset();

            return(target);
        }
Esempio n. 2
0
        /// <summary>
        /// 创建指定对象的实体代理对象
        /// </summary>
        /// <returns>实体代理对象</returns>
        /// <param name="object">对象</param>
        public static object CreateProxy(object @object)
        {
            object target = CreateProxy(@object.GetType());

            var handler = DynamicHelper.CreateDynamicMapHandler(@object.GetType(), target.GetType());

            handler(@object, target);

            ((IEntityObject)target).Reset();

            return(target);
        }