Copied to clipboard

Flag this post as spam?

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


  • Jamie Attwood 207 posts 501 karma points c-trib
    Jun 19, 2019 @ 19:14
    Jamie Attwood
    0

    Multinode Treepicker 2 as string of ids

    I am doing some complex linq querying and a lot of the queries rely on MNTP2.

    After reading about Umbraco performance, I am concerned that I am doing a lot of comparisons using IPublishedContent vs just string ids for example. The idea being that every time an IPublishedContent is created, there is memory allocation to this. Instead of returning a list of IPublishedContent for MNTP2 is there a way to just get a comma delimited string back instead of a bunch of IPublishedContents?

    For example, instead of this:

    var blacklist = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("exclusionList")
    

    I want something like:

    var blacklist = Model.Content.GetPropertyValue<string>("exclusionList")
    

    When I just use <string> I get:

    System.Collections.Generic.List`1[Umbraco.Core.Models.IPublishedContent] returned....

    I have tried doing something like this:

     var blacklist = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("exclusionList").Select(x => x.Id).ToList<int>();
    

    But it defeats the purpose as the IPublishedContent is still created and persisted to memory.

    Any thoughts appreciated.

    Jamie

Please Sign in or register to post replies

Write your reply to:

Draft