Facade cleanup and refactoring

This commit is contained in:
Stephan
2017-09-26 14:57:50 +02:00
parent 91b8f073ad
commit c24fdc0ddf
53 changed files with 831 additions and 757 deletions

View File

@@ -20,13 +20,12 @@ namespace Umbraco.Core.Models.PublishedContent
// get model
// if factory returns nothing, throw
var model = Current.PublishedContentModelFactory.CreateModel(content);
var model = Current.PublishedModelFactory.CreateModel(content);
if (model == null)
throw new Exception("Factory returned null.");
// if factory returns a different type, throw
var publishedContent = model as IPublishedContent;
if (publishedContent == null)
if (!(model is IPublishedContent publishedContent))
throw new Exception($"Factory returned model of type {model.GetType().FullName} which does not implement IPublishedContent.");
return publishedContent;