Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace AspNetCoreTemplate.Services.Mapping
- {
- using System;
- using System.Linq;
- using System.Linq.Expressions;
- using AutoMapper.QueryableExtensions;
- public static class QueryableMappingExtensions
- {
- public static IQueryable<TDestination> To<TDestination>(
- this IQueryable source,
- params Expression<Func<TDestination, object>>[] membersToExpand)
- {
- if (source == null)
- {
- throw new ArgumentNullException(nameof(source));
- }
- return source.ProjectTo(AutoMapperConfig.MapperInstance.ConfigurationProvider, null, membersToExpand);
- }
- public static IQueryable<TDestination> To<TDestination>(
- this IQueryable source,
- object parameters)
- {
- if (source == null)
- {
- throw new ArgumentNullException(nameof(source));
- }
- return source.ProjectTo<TDestination>(AutoMapperConfig.MapperInstance.ConfigurationProvider, parameters);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement