Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Gareth Wright 32 posts 100 karma points c-trib
    Nov 22, 2016 @ 11:49
    Gareth Wright

    DittoPublishedContentModelFactory Method not found error

    Hi all,

    I've put a very simple sandbox together and I've used the latest versions of Ditto (0.10.0), Ditto.ModelFactory (0.1.1) and Umbraco (7.5.4).

    I want my models to auto bind on startup, so I'm using the following code:

     public class EventHandlers : ApplicationEventHandler
        protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            var types = PluginManager.Current.ResolveTypes<PublishedContentModel>();
            var factory = new DittoPublishedContentModelFactory(types);

    However, upon website load, I'm getting the following YSOD:

    Method not found: 'System.Object Our.Umbraco.Ditto.PublishedContentExtensions.As(Umbraco.Core.Models.IPublishedContent, System.Type, System.Globalization.CultureInfo, System.Object, System.Collections.Generic.IEnumerable1<Our.Umbraco.Ditto.DittoValueResolverContext>, System.Action1

    My two POCO's look as follows:

     public class Homepage : PublishedContentModel
        public Homepage(IPublishedContent content) : base(content)  {}
        public string Title { get; set; }
        public HtmlString Description { get; set; }
        public Image Hero { get; set; }


       public class Image : PublishedContentModel
        public Image(IPublishedContent content) : base(content) { }

    my view simply calls UmbracoTemplatePage with Homepage as my model.

    Any help would be great!

  • Lee Kelleher 3993 posts 15620 karma points MVP 12x admin c-trib
    Nov 22, 2016 @ 11:58
    Lee Kelleher

    Hi Gareth,

    My advice is, if you don't need to use DittoModelFactory, then take a different approach.

    I wrote the code as a prototype, then ran into all sorted of headaches with it, which I couldn't support.

    If you must use it, then it sounds like the DittoModelFactory code needs to be recompiled against the latest version of Ditto.

    The source-code can be found here:

    Our recommended approach is to use the DittoView<T> directive on your partial-view templates. We don't have much documentation about it yet, (we're working on it), but there is a demo site with some examples here:

    I hope this helps?

    - Lee

  • Gareth Wright 32 posts 100 karma points c-trib
    Nov 22, 2016 @ 12:01
    Gareth Wright

    Excellent, just reverted it out for DittoView and works perfectly.

    Thanks for your help!

  • Lee Kelleher 3993 posts 15620 karma points MVP 12x admin c-trib
    Nov 22, 2016 @ 12:04
    Lee Kelleher

    Awesome, glad it worked so smoothly!

Please Sign in or register to post replies

Write your reply to: