Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generic Ditto take 2
using Our.Umbraco.Ditto;
using Umbraco.Core;
using Umbraco.Core.Models.PublishedContent;
namespace MappingDemo.Custom.Mvc
{
public class ConfigFactory : ApplicationEventHandler
{
protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
PublishedContentModelFactoryResolver.Current.SetFactory<PublishedContentModel>();
}
}
}
@inherits UmbracoTemplatePage<MappingDemo.Custom.Models.HomePage>
@{
Layout = "Master.cshtml";
}
<h1 style="color: red">@Model.Content.Name</h1>
<p>@Model.Content.SiteTitle</p>
@Model.Content.GetGridHtml("content", "fanoe")
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
namespace MappingDemo.Custom.Models
{
[PublishedContentModel("Home")]
public class HomePage : PublishedContentModel
{
public string SiteTitle { get; set; }
public HomePage(IPublishedContent content) : base(content)
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.