We are using a slightly hacked version of the Tridion Reference Implementation as we are using 2009sp1 (don't ask!)

We have a lot of things working well but we have an issue with the function GetMultiComponentLinks.

In the function I can see the following code that I assume goes and gets the data model for the linked components

MethodInfo method = GetType().GetMethod("GetCompLink" + (multival ? "s" : String.Empty), BindingFlags.NonPublic | BindingFlags.Instance);
method = method.MakeGenericMethod(new[] { linkedItemType });
return method.Invoke(this, new object[] { items, linkedItemType });

However when this runs the method is always null. I can't seem to find any reference to GetCompLink either either in the TRI source or DD4T source. If someone can point me in the right direction I would greatly appreciate it!

1 Answer 1


Interesting one - somehow the Sdl.Web.DD4T.Mapping.DD4TModelBuilder.GetCompLink(s) methods got removed, probably by some over-zealous code analysis which detected unused methods (as the only way they are called is by reflection). As the example models shipped with TRI do not use this (they always use String or Link types for linked content) it was never noticed. I dug out the original source:

private List<T> GetCompLinks<T>(IEnumerable<IComponent> components, Type linkedItemType)
    List<T> list = new List<T>();
    foreach (var comp in components)
        list.Add((T)Create(comp, linkedItemType));
    return list;

private T GetCompLink<T>(IEnumerable<IComponent> components, Type linkedItemType)
    return GetCompLinks<T>(components,linkedItemType)[0];

I added an issue to get this sorted for the next release, in the meantime you can add this code (it might need testing properly) to your web app.


You may also notice that these methods don't really need the linkedItemType parameter, you can replace them with the following:

list.Add((T)Create(comp, typeof(T)));
  • Ahhh now it all makes sense. I'm glad it wasn't me just being stupid! I'll pop the code in and test it all out. Thanks a lot. Commented Nov 19, 2014 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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