Copied to clipboard

Flag this post as spam?

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


  • xrisdoc 54 posts 102 karma points
    Jul 29, 2016 @ 21:54
    xrisdoc
    0

    Models Builder Base Class

    I am developing a new site and I'm using Models Builder for the first time. I am using the API mode to generate the models within my project.

    I have managed to generate the models so that they inherit from a Base class that I have defined myself using the following:

    [assembly:ModelsBaseClass(typeof (BaseWebPage))]
    

    Now this all seems to work as expected, which is great. However, it now means that ALL of the generated models are now derived from my base class.

    I only want the models that represent my "Page" document types to inherit from the BaseWebPage class.

    So, basically, I was wondering if it is possible to specify specific document types that are to inherit from my Base class, so that only the ones I specify are the models that will derive from the base class.

    Thanks

  • Manjunatha Govindappa 20 posts 119 karma points
    Jul 30, 2016 @ 08:11
    Manjunatha Govindappa
    0

    Hi xrisdoc,

    Models inheritance follows your documents type tree hierarchy . if you want to restrict the inheritance for some of your models then you could move the respective document types in the same hierarchy of your base class

  • xrisdoc 54 posts 102 karma points
    Jul 30, 2016 @ 09:08
    xrisdoc
    0

    Hi,

    I have managed to get something working using the doc type inheritance as you have suggested. So, I guess that could be an option.

    However, I was hoping to identify a solution where it didn't require the use of doc type inheritance and instead using only the doc type compositions.

    I have a few sites with quite a number of doc types which use only compositions (no doc type inheritance) that I want to implement using this approach, with the models builder and custom base class.

    So, to restructure that to use inheritance would require me to re-create all document types using the inheritance structure and then change the document types on all of my content, which would be quite a task to go through them all.

    I was also wondering if there would be a way to tell models builder that I only want to use the base clas on a list of doc types that I specify?

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft