Copied to clipboard

Flag this post as spam?

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


  • MaxD23 5 posts 72 karma points
    Aug 05, 2017 @ 15:15
    MaxD23
    0

    Issue when upgrading to 7.6

    Hello,

    I have upgraded sucessfully a site from 7.2.6 to 7.5.14 but when upgrading to 7.6, things get nasty.

    'Umbraco.Core.Models.PublishedContent.PublishedContentEnumerable' does not contain a definition for 'Split'*

    Line 19: @if (CurrentPage.HasValue("carouselItems")) {
    Line 20:     var itemIds = CurrentPage.CarouselItems.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
    Line 21:     var carouselItems = Umbraco.Media(itemIds);
    

    Does anyone can point me where to look?

    Thank you

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Aug 07, 2017 @ 08:20
    Alex Skrypnyk
    101

    Hi Max

    Since version 7.6 Umbraco Property Value Converters are part of the core, it means that CurrentPage.CarouselItems returns list of PublishedContents, not list of ids.

    Now life of developers easier, you can just iterate over list:

    var carouselItems = CurrentPage.CarouselItems
    

    Is the same as:

    var itemIds = CurrentPage.CarouselItems.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
    var carouselItems = Umbraco.Media(itemIds);
    

    Also, you can turn off Property Value Converters, look at umbracoSetting.config setting: in section settings/content, setting EnablePropertyValueConverters needs to be present and true to activate them.

    Read more about breaking changes for version 7.6:

    https://our.umbraco.org/documentation/getting-started/setup/upgrading/760-breaking-changes

    Thanks,

    Alex

  • MaxD23 5 posts 72 karma points
    Aug 07, 2017 @ 08:43
    MaxD23
    0

    Hi Alex,

    I found the switch after posting my comment. It works well but your comments makes me want to switch it back and modify the code :)

    Returning objects instead of csv style strings is definitely better to reason about :)

    I am discovering Umbraco to get a different taste and experience. I am coming from PHP.

    Thank you for the support.

    Best

    Maxime

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Aug 07, 2017 @ 08:46
    Alex Skrypnyk
    1

    Definitely, new way of working with data in Umbraco is cool, enjoy it.

Please Sign in or register to post replies

Write your reply to:

Draft