When overriding SitecoreFieldLinkMapper, I add my new custom mapper to the CreateResolver method so it can be ran with all the other custom mappers. How do I ensure that only this custom mapper is ran and not the standard glass link field mapper? I think both might be executing.


You can replace the standard link resolve in the Glass Dependency resolver. This is done in the CreateResolver method:

 public static IDependencyResolver CreateResolver(){
        var config = new Glass.Mapper.Sc.Config();
        var dependencyResolver = new DependencyResolver(config);
        // add any changes to the standard resolver here

        dependencyResolver.DataMapperFactory.Replace<SitecoreFieldLinkMapper, MyLinkResolver>(()=> new MyLinkResolver());

        return dependencyResolver;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.