Ejemplo n.º 1
0
        public static ICollection <T> Maps <T>(this object objs)
        {
            var mapper = ServiceGet.GetProvider()?.GetService <IMapper>();

            if (mapper == null)
            {
                throw new Exception("无法获取IMapper实例");
            }
            return(mapper.Map <ICollection <T> >(objs));
        }
Ejemplo n.º 2
0
        public static T Map <T>(this object obj, T target)
        {
            var mapper = ServiceGet.GetProvider()?.GetService <IMapper>();

            if (mapper == null)
            {
                throw new Exception("无法获取IMapper实例");
            }
            return(mapper.Map(obj, target));
        }