This content type is used in a composition already
Hey, everyone. So I'm currently revamping my whole backend to use compositions instead of inheritance, but I have a question.
Right now I have my Document Types like this:
Master
Home
News page
News article
SEO Composition
I have inheritance on my news page, because that makes most sense (right?). However. When I go to add my SEO composition to News page, I get this error:
This content type is used in a composition, and therefore cannot be composed itself
It is not being used in a composition already, but rather being a parent in an inheritance.
Is that why I get this error?
Should I make my News article Document Type into a composition instead?
Should I just create a folder called "Compositions" and move all compositions in there?
My SEO composition is at the root of my Document Types. Completely isolated from everything else. My News page Document Type, however, is inheriting from the Master Document Type.
Well that sucks. I don't see the use for compositions then, if all my Document Types has to be placed in folders and have no connection to each other what so ever. What a bummer.
I agree. Composition and inheritance should work together. They don't today, and that seems rather short-sighted.
For what it's worth:
It's possible to "trick" the user interface by adding your compositions to the parent type prior to creating any derived types from it. Of course, you need to know exactly what compositions you want in advance. You can, though, add properties to the compositions after-the-fact.
Bump. Just wondered if this was on the radar for anytime soon. It is pretty hard to refactor documents without having the ability to add a composition to a base document type that has derived types.... just saying.
I have several cases where this would have come in handy now, and since I have a ton of content anyone have a recommendation on how to do this type of refactor?
We steer away from inheritance for a few years now. The real advantage in my eyes is using compositions and modelsbuilder together.
Every composition has it's own partial class that you can use in partial views for common presentation. In this way you can really make modular code that you can easily pick up and reuse over your projects.
In our older projects we just leave the documenttypes as is and don't use compositions until a rebuild is in play.
This content type is used in a composition already
Hey, everyone. So I'm currently revamping my whole backend to use compositions instead of inheritance, but I have a question.
Right now I have my Document Types like this:
I have inheritance on my news page, because that makes most sense (right?). However. When I go to add my SEO composition to News page, I get this error:
It is not being used in a composition already, but rather being a parent in an inheritance.
Thanks!
Hi Morten,
This is because a inherited document is also a composition technically. Why can't you add the SEO composition to your master ?
Dave
Because I get the same error. If I try to add SEO to the Master Document Type, I get the:
Does your SEO composition inherits from another doctype. Or maybe it's using another doctype as composition ?
Nested composition is not possible.
Dave
My SEO composition is at the root of my Document Types. Completely isolated from everything else. My
News page
Document Type, however, is inheriting from theMaster
Document Type.Does it work when you try to set it in the News Article doctype ?
Dave
Yes.
Hi Morten,
I think this is because technically speaking a doctype that is inherited is a composition itself. And you can't add composition to compositions.
Dave
Well that sucks. I don't see the use for compositions then, if all my Document Types has to be placed in folders and have no connection to each other what so ever. What a bummer.
I agree. Composition and inheritance should work together. They don't today, and that seems rather short-sighted.
For what it's worth:
Bump. Just wondered if this was on the radar for anytime soon. It is pretty hard to refactor documents without having the ability to add a composition to a base document type that has derived types.... just saying.
I have several cases where this would have come in handy now, and since I have a ton of content anyone have a recommendation on how to do this type of refactor?
Bump and second this, we also need to add compositions to a base document that has derived types.
The derived types are associated with a load of content so we can't just delete and recreate them.
To be fair we should have had better advance knowledge of what was required in the base type but this doesn't always happen IRL...
We steer away from inheritance for a few years now. The real advantage in my eyes is using compositions and modelsbuilder together.
Every composition has it's own partial class that you can use in partial views for common presentation. In this way you can really make modular code that you can easily pick up and reuse over your projects.
In our older projects we just leave the documenttypes as is and don't use compositions until a rebuild is in play.
We use all three, compositions, inheritance and models builder.
There are advantages to having polymorphic pages.
What are the advantages to inheritance?
is working on a reply...