CompositionContainer.ComposePart is an extension method. why is that? Looking into the System.Componentmodel.Composition assembly, it looks like it’s because it is ONLY meant to work with the attributed programming model while the .Compose() method is able to take in exports as long as it is a composablepart. ComposePart is even hosted in the ‘AttributedModelServices’ class which makes me think I’m correct.
Am I correct on this? If not, why is it an extension method and not a method in the container class?
Yes. It would be possible to construct a
CompositionContainerwhich doesn’t use the attributed model at all. You can create your own export provider implementations or catalog implementations.But
ComposePartsrelies on import attributes being present on the properties of the given objects.