Skip to content
This repository was archived by the owner on Feb 10, 2024. It is now read-only.

Call the model factory to support typed models when used. #79

Merged
merged 1 commit into from
Aug 29, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,20 @@ private static IPublishedContent ConvertValue(string id, string contentTypeAlias
var pcr = UmbracoContext.Current != null ? UmbracoContext.Current.PublishedContentRequest : null;
var containerNode = pcr != null && pcr.HasPublishedContent ? pcr.PublishedContent : null;

return new DetachedPublishedContent(nameObj != null ? nameObj.ToString() : null,
// Create the model based on our implementation of IPublishedContent
IPublishedContent content = new DetachedPublishedContent(
nameObj != null ? nameObj.ToString() : null,
contentTypes.PublishedContentType,
properties.ToArray(),
containerNode);

if (PublishedContentModelFactoryResolver.HasCurrent)
{
// Let the current model factory create a typed model to wrap our model
content = PublishedContentModelFactoryResolver.Current.Factory.CreateModel(content);
}

return content;
}

}
Expand Down