Copied to clipboard

Flag this post as spam?

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


  • Shola 65 posts 273 karma points
    May 07, 2015 @ 17:50
    Shola
    0

    Possible to coexist with existing implementation?

    Hello,

    It appears that this package is smart enough to convert a property to its associated object, even without specifying the type in the generic brackets. (i.e. GetPropertyValue("mainImage") returns a IPublishedContent media entity without me having to say something like GetPropertyValue("mainImage")).

    Well, I use strongly typed objects in my views, so there's a lot of this sort of code going on:

    var img = Umbraco.TypedMedia(Model.Content.GetPropertyValue("mainImage"));

    ...where mainImage is just the alias for a media picker ID value. If I install this package, I'm assuming I'd get a lot of errors in my views, given that Umbraco.TypedMedia expects just an ID and not an already-converted IPublishedContent, correct? I'd probably have to convert all the code above to something like:

    var img = Model.Content.GetPropertyValue("mainImage");

     

     

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    May 08, 2015 @ 11:19
    Jeavon Leopold
    0

    Hi Shola,

    Yes, if you install this package you will need to update all of your code to use the new objects instead of the original strings. Your code should reduce a lot, and it generally doesn't take very long to update.

    Regards,

    Jeavon

Please Sign in or register to post replies

Write your reply to:

Draft