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.
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
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?
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:
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
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
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
is working on a reply...