Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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); PublishedContentModelFactoryResolver.Current.SetFactory(factory); } }
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
1<Our.Umbraco.Ditto.DittoValueResolverContext>, System.Action
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; } [UmbracoProperty] [UmbracoPicker] public Image Hero { get; set; } }
and
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!
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: https://github.com/leekelleher/umbraco-ditto-labs/tree/develop/src/Our.Umbraco.Ditto.ModelFactory
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: https://github.com/lars-erik/DittoDemoModelsBuilderified/tree/master/Dittoified
DittoView<T>
I hope this helps?
Cheers, - Lee
Excellent, just reverted it out for DittoView and works perfectly.
Thanks for your help!
Awesome, glad it worked so smoothly!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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:
However, upon website load, I'm getting the following YSOD:
My two POCO's look as follows:
and
my view simply calls UmbracoTemplatePage with Homepage as my model.
Any help would be great!
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:
https://github.com/leekelleher/umbraco-ditto-labs/tree/develop/src/Our.Umbraco.Ditto.ModelFactory
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:https://github.com/lars-erik/DittoDemoModelsBuilderified/tree/master/Dittoified
I hope this helps?
Cheers,
- Lee
Excellent, just reverted it out for DittoView and works perfectly.
Thanks for your help!
Awesome, glad it worked so smoothly!
is working on a reply...