using System;
using System.Linq.Expressions;
using AutoMapper;

namespace Infra.Shared.AutoMapping
{
    public static class AutoMappingExtensions
    {
        public static IMappingExpression<TSource, TDest> Ignore<TSource, TDest>(
            this IMappingExpression<TSource, TDest> expression,
            Expression<Func<TDest, object>> memberToIgnore)
        {
            return expression.ForMember(memberToIgnore, opt => opt.Ignore());
        }

        public static IMappingExpression<TSource, TDest> IgnoreAll<TSource, TDest>(
           this IMappingExpression<TSource, TDest> expression)
        {
            expression.ForAllMembers(opt => opt.Ignore());
            return expression;
        }
    }
}