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");
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.
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:
...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:
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
is working on a reply...