.NET Framework Bookmark and Share   
 index > Managed Extensibility Framework > Composite CompositionContainer or ValueResolvers?
 

Composite CompositionContainer or ValueResolvers?

I see you can create a CompositionContainer with a ParentContainer, however I don't see a way to compose multiple containers or ValueResolvers together. Do I need to make my own CompositeValueResolver, or is there something I've missed?
Ken Brubaker

That’s correct. Currently if youwant a composition chain that is more than the simple parent-child relationship you would need to create a custom ValueResolver to express that relationship.

To get a better understanding of the scenario you had in mind could you elaborate more?What sort of relationship where you thinking about?

Thanks


Blog: http://weblogs.asp.net/whaggard
Wes Haggard

That’s correct. Currently if youwant a composition chain that is more than the simple parent-child relationship you would need to create a custom ValueResolver to express that relationship.

To get a better understanding of the scenario you had in mind could you elaborate more?What sort of relationship where you thinking about?

Thanks


Blog: http://weblogs.asp.net/whaggard
Wes Haggard
I wanted to add a resolver that did not provide objects (which seems to be your common scenario) but typed values from a configuration database infrastructure. The configuration database would have its own resolver. I would like it to compose with whatever other strategy the rest of the application decides to use. For example:

[Import("configdb://Acme/PartsDepartment/Widget/WidgetStore/Database/CommandTimeout")]
publicTimeSpanCommandTimeout{get;set;}


Other import attributes would use your common strategies.

Although my interest may be non-normative, the issue is not. The simple fact is that users should not be pigeonholed into a single strategy. How could libraries using differing strategies be composed, for example? I'd prefer to drop everything in the same bag and stir (er...Bind) rather than having to maintain several isolated containers and remember which components are design to go with which resolvers.

This seems that it would be awfully common. Is there something I'm missing?
Ken Brubaker

I believe I understand your scenario and I agree that it is very reasonable and will likely be common to implement different discovery strategies.

I will ensure we have a work item to consider the scenario of aggregating or chaining resolvers together.

Thanksfor the feedback and be sure to let us know if you have other concerns.


Blog: http://weblogs.asp.net/whaggard
Wes Haggard
For clarity, I want to make sure that the parent-child container relationship is not a way to chain resolvers:

Since you can't assign both a parent container and a resolver at the same time, you cannot do any chaining using a parent container, correct?

So...what's the scenario supported by having a parent container? I suppose you can add specific Exports but no resolvers, correct?

Thanks for your help! I'm looking forward to the next iteration.
Ken Brubaker
You are correct the Parent-Child relationship isn't all that useful. Basically the parent container could have its own Resolver of choice but the child container currently is forced to have a ParentResolver (which is created for you if you pass a parent container)so it can't do any real interesting resolving.

As you stated the biggest thing (perhaps the only thing) you can do with child containers is addexports/exported objects directly to the child container and they would then override anything that the parent container holds.

Blog: http://weblogs.asp.net/whaggard
Wes Haggard

You can use google to search for other answers

Custom Search

More Threads

• MEF and singletons
• Order of ImportCompleted
• Comparison of CompositionContainer with traditional IoC Containers
• What is Managed Extensibility Framework and its relationship with Enterprise Library?
• Why Addin is not loaded?
• Is there any api to get start time of IIS webserver.
• not able to call vs 2005 c++ "clr" jni dll in other machines without vs 2005???????
• Create a Ribbon Control for MS Project
• EMAB
• How to pass an Enum to a Functon