Copied to clipboard

Flag this post as spam?

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


  • Romix2017 23 posts 183 karma points
    Nov 04, 2017 @ 17:47
    Romix2017
    0

    DynamicPublishedContent to strong type

    Hello, guys! I have Examine node, but that node is in DynamicPublishedContent format, so when I try to use that node in strong typed model I get error Unable to cast object of type 'Umbraco.Web.Models.DynamicPublishedContent' to type but I want to use strong type model, I have strong typed model for this node document type and when I take that node by using umbraco means everything works perfectly well because I can convert from IPublishedContent to my strong typed model freely, but in case of Examine everyting is dynamic, is there any way to make it strong typed?

  • John Bergman 483 posts 1132 karma points
    Nov 04, 2017 @ 18:29
    John Bergman
    100

    if DynamicPublishedContent derives from IPublishedContent, you can do something like this

    var doc=new stronglytypeddoc(dynamicpublishedcontent).

    I've not had to do this specifically but...

  • Romix2017 23 posts 183 karma points
    Nov 05, 2017 @ 05:34
    Romix2017
    0

    Awesome! Thanks a lot!

Please Sign in or register to post replies

Write your reply to:

Draft