using System; using Umbraco.Core.DI; namespace Umbraco.Core.Models.PublishedContent { /// /// Provides strongly typed published content models services. /// internal static class PublishedContentExtensionsForModels { /// /// Creates a strongly typed published content model for an internal published content. /// /// The internal published content. /// The strongly typed published content model. public static IPublishedContent CreateModel(this IPublishedContent content) { if (content == null) return null; // get model // if factory returns nothing, throw var model = Current.PublishedContentModelFactory.CreateModel(content); if (model == null) throw new Exception("IPublishedContentFactory returned null."); return model; } } }