I am exposing the Dto generated from AutoMapper to my WCF services. I would like to offer something like that from WCF: IList GetPersonByQuery(Expression> predicate); Unfortunately I need back an expression tree of Person as my DAL doesn't know the DTO. I am trying this wihtout success:
var func = new Func<Person, bool>(x => x.FirstName.Contains("John"));
var funcDto = Mapper.Map<Func<Person, bool>, Func<PersonDto, bool>>(func);
Console.WriteLine(func.ToString());
Console.WriteLine(funcDto.ToString());
THe error that I get is:
----> System.ArgumentException : Type 'System.Func`2[TestAutoMapper.PersonDto,System.Boolean]' does not have a default constructor
Do you have any suggestions?