c# - AutoMapper Resolver: cannot convert -
cannot convert 'project.core.appcontainer.usertyperesolver' 'automapper.ivalueresolver'
mapper config
public class mapperconfigurationfactory { public static mapperconfiguration getconfiguration() { return new mapperconfiguration(cfg => { cfg.disableconstructormapping(); cfg.createmap<user, userviewmodel>() .formember(dest => dest.isinternal, opt => opt.resolveusing(new usertyperesolver())); }); } }
resolver
public class usertyperesolver : ivalueresolver<user, userviewmodel, string> { public string resolve(user user, userviewmodel userviewmodel, string usertype, resolutioncontext context) { return user.issuperuser ? "yes" : "no"; } }
i went through several tutorials , can't find wrong. tried change line .formember this, doesn't work either.
.formember(dest => dest.isinternal, opt => opt.resolveusing<usertyperesolver>());
perhaps isinternal not string?
Comments
Post a Comment