Copied to clipboard

Flag this post as spam?

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


  • David Brendel 786 posts 2949 karma points c-trib
    Nov 16, 2016 @ 15:16
    David Brendel
    0

    ModelsBuilder generate property in each model

    Hi all,

    I have a question regarding to the models builder.

    I want to use an approach where I have a general settings node under my website root node. In this note some general settings are maintained like site logo and similar.

    Now I don't want to query for that node on each of my templates when I need some information stored in it.

    Is there a way to provide content from this node as a property on my generated models?

    So I can do

    Model.Content.GeneralSettings.xyz
    

    on the pages?

    Regards David

  • Dave Woestenborghs 3325 posts 11170 karma points MVP 5x admin c-trib
    Nov 16, 2016 @ 15:34
    Dave Woestenborghs
    0

    Hi David,

    What your are trying to do is not possible.

    For such kind of scenario's I usually write a extension method no the IPublishedContent object.

    That ways it's available on each model.

    Dave

  • David Brendel 786 posts 2949 karma points c-trib
    Nov 18, 2016 @ 07:39
    David Brendel
    0

    Hi Dave,

    thanks for the answer.

    Sad to hear but yes then I think I will also stick to the extension method to do this.

    Thanks!

    David

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies