c# - How to Use AutoMapper for Find Method? -
how map method using automapper
? example:
public ienumerable<paisviewmodel> find(expression<func<paisviewmodel, bool>> predicate) { return mapper.map<pais, paisviewmodel>( _paisservice.find(predicate)); }
if it's 1 1 mapping of simple objects then:
public ienumerable<paisviewmodel> find(expression<func<paisviewmodel, bool>> predicate) { return _paisservice.find(predicate).select(p => mapper.map(p, pais.gettype(), paisviewmodel.gettype())); }
if objects complex or properties not 1 1 have make calls map.createmap define object mapping.