We use the code below to get NestedContent, on v7 was working fine, but when we tried to migrate to v8 and changed the IPublishedContent with IPublishedElement, we get an error:
System.MissingMethodException: 'Constructor on type 'Models.Fields.Section' not found.
protected List<T> GetNestedList<T>(string alias)
{
Type type = typeof(T);
List<T> list = new List<T>();
IPublishedElement singleResult = Get<IPublishedElement>(alias);
if (singleResult != null)
{
list.Add((T)Activator.CreateInstance(type, singleResult));
}
IEnumerable<IPublishedElement> multipleResults = Get<IEnumerable<IPublishedElement>>(alias);
if (multipleResults != null)
{
foreach (IPublishedElement result in multipleResults)
{
list.Add((T)Activator.CreateInstance(type, result));
}
}
return list;
}
The only change we did to the code was replacing IPublishedContent -> IPublishedElement.
Nested Content
We use the code below to get NestedContent, on v7 was working fine, but when we tried to migrate to v8 and changed the IPublishedContent with IPublishedElement, we get an error:
The only change we did to the code was replacing IPublishedContent -> IPublishedElement.
We really need help on this.
Maybe a stupid question, but what does "Get" refer to? In fx
is that a wrapper or helper you have defined another place?
Best regards.
is working on a reply...