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 792 posts 2970 karma points MVP 3x 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 3504 posts 12134 karma points MVP 9x 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 792 posts 2970 karma points MVP 3x 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

Please Sign in or register to post replies

Write your reply to:

Draft