using Quadarax.Foundation.Core.Data.Interface.Entity; namespace Quadarax.Application.QLiberace.Base.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 TDtoResult? MapDto2Dto(this TDto? dto) where TDto : class, IDto, new() where TDtoResult : 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(); } } }