Copied to clipboard

Flag this post as spam?

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


  • glenatron 37 posts 132 karma points
    Dec 30, 2013 @ 17:49
    glenatron
    0

    Can I make a SearchResult into a RenderModel derived model?

    I am working on the Search facility for my Umbraco MVC site ( build on 6.1.6 ) and I have managed to get an idea of the Examine stuff enough to get started.

    The problem is that if I want to be able to integrate my Examine results with my existing display logic, I need to be able to turn a SearchResult object into my ViewModel type, and those all derive from RenderModel in order to provide a whole lot of Umbraco-related goodness, but I can't see a way to create a RenderModel without an IPublishedContent object, although my SearchResult contains all the fields I need.

    Is there a way to do this, or do I have to create two- effectively identical- ViewModels, one derived from RenderModel the other entirely self-contained?

  • glenatron 37 posts 132 karma points
    Jan 05, 2014 @ 01:30
    glenatron
    0

    My solution was to create an IPublishedContent object that was created from a SearchResult. I couldn't find anything like this built in, but it wasn't a big trial to do it myself once I arrived at the strategy.

Please Sign in or register to post replies

Write your reply to:

Draft