0

I use from CreateFormDto Method and MapDto Method for convert DTO to Entity and also Entity to DTO. Now I can not convert these, for example:

public Paginated<TDomainDto> SearchPage(Expression<Func<TDomainDto, bool>> predicate, int page, int size)
{
    return BaseService.SearchPage(predicate: predicate, page: page, size: size);
}

I get error in this line (predicate: predicate, and this error is cannot convert from 'System.Linq.Expressions.Expression<System.Func<TDomainDto, bool>>' to 'System.Linq.Expressions.Expression<System.Func<TDomain, bool>>'

swatsonpicken
  • 873
  • 1
  • 7
  • 21
Amin Saadati
  • 133
  • 8
  • is TDomainDto inherited from TDomain? Try to add it into Generic type constraint – ASpirin Aug 11 '17 at 07:25
  • @ASpirin No, I have a TDomainDto and i want convert to TDomain. i do not Know how to resolve it because it is a Expression – Amin Saadati Aug 11 '17 at 07:39
  • Sounds like you have to translate `Expression>` to `Expression>` function `map` wouldn't help – ASpirin Aug 11 '17 at 07:48
  • 1
    Don't want to copy content of the answer, so check the answer to that question https://stackoverflow.com/questions/6698553/how-do-i-translate-an-expression-tree-of-one-type-to-a-different-expression-type – ASpirin Aug 11 '17 at 09:55

0 Answers0