using System.Collections.Generic; using System.Linq; using Quadarax.Foundation.Core.Data.Interface.Entity; namespace BO.AppServer.Business.Mapper { public static class MapperLongExt { public static TDto Map(this TDao dao) where TDao : class, IDao, new() where TDto : class, IDto, new() { if (dao == null) return null; return MapperLong.Instance.Map(dao); } public static TDao MapDto(this TDto dto) where TDao : class, IDao, new() where TDto : class, IDto, new() { if (dto == null) return null; return MapperLong.Instance.Map(dto); } public static void CopyToDto(this TDto @from, TDao to) where TDao : class, IDao, new() where TDto : class, IDto, new() { if (@from == null) return; if (to == null) return; MapperLong.Instance.Update(@from,to); } public static void CopyToDto(this TDao @from, TDto to) where TDao : class, IDao, new() where TDto : class, IDto, new() { if (to == null) return; if (@from == null) return; MapperLong.Instance.Update(@from,to); } public static List MapList(this IQueryable dao) where TDao : class, IDao, new() where TDto : class, IDto, new() { if (dao == null) return new List(); return MapperLong.Instance.MapList(dao); } public static List MapList(this IEnumerable dao) where TDao : class, IDao, new() where TDto : class, IDto, new() { if (dao == null) return new List(); return MapperLong.Instance.MapList(dao); } public static List MapList(this IList dao) where TDao : class, IDao, new() where TDto : class, IDto, new() { if (dao == null) return new List(); return MapperLong.Instance.MapList(dao); } public static IQueryable MapListDto(this IEnumerable dto) where TDao : class, IDao, new() where TDto : class, IDto, new() { if (dto == null) return new List().AsQueryable(); return MapperLong.Instance.MapList(dto.AsQueryable()).AsQueryable(); } } }