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