0

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?

4

1 回答 1

0

it looks like it's because it is ONLY meant to work with the attributed programming model

Yes. It would be possible to construct a CompositionContainer which doesn't use the attributed model at all. You can create your own export provider implementations or catalog implementations.

But ComposeParts relies on import attributes being present on the properties of the given objects.

于 2012-06-21T14:59:37.307 回答