| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Quadarax.Foundation.Core.Data.Interface.Entity;
- namespace Quadarax.Foundation.Core.Data.Mapper
- {
- /*
- public static class MapperExt
- {
- public static TDto Map<TDao, TDto, TKey>(this TDao dao)
- where TDao : class, IDao<TKey>, new()
- where TDto : class, IDto, new()
- where TKey : IEquatable<TKey>
- {
- if (dao == null) return null;
- return Mapper.Instance.Map<TDao, TDto>(dao);
- }
- public static TDao MapDto<TDto, TDao, TKey>(this TDto dto)
- where TDao : class, IDao<TKey>, new()
- where TDto : class, IDto, new()
- where TKey : IEquatable<TKey>
- {
- if (dto == null) return null;
- return Mapper.Instance.Map<TDto, TDao>(dto);
- }
- public static List<TDto> MapList<TDao, TDto, TKey>(this IQueryable<TDao> dao)
- where TDao : class, IDao<TKey>, new()
- where TDto : class, IDto, new()
- where TKey : IEquatable<TKey>
- {
- if (dao == null) return new List<TDto>();
- return Mapper.Instance.MapList<TDao, TDto>(dao);
- }
- public static List<TDto> MapList<TDao, TDto,TKey>(this IEnumerable<TDao> dao)
- where TDao : class, IDao<TKey>, new()
- where TDto : class, IDto, new()
- where TKey : IEquatable<TKey>
- {
- if (dao == null) return new List<TDto>();
- return Mapper.Instance.MapList<TDao, TDto>(dao);
- }
- public static IQueryable<TDao> MapListDto<TDto,TDao,TKey>(this IEnumerable<TDto> dto)
- where TDao : class, IDao<TKey>, new()
- where TDto : class, IDto, new()
- where TKey : IEquatable<TKey>
- {
- if (dto == null) return new List<TDao>().AsQueryable();
- return Mapper.Instance.MapList<TDto, TDao>(dto.AsQueryable()).AsQueryable();
- }
- }
- */
- }
|