Determining Creation Policy

Dec 8, 2009 at 1:59 PM

I have a retriever/manager class that gets a part based on metadata to isolate the decision making on which part is appropriate.

This an ImportMany of Lazy internally. Since the retriever/manager is a singleton, this sticks around for the life of the app.

When the underlying part is NonShared, I need to recreate the Lazy to get the new item (correct?)

I can recreate the Lazy by instantiating a nested class or something (unless there is an easier way you can describe). However, I want to create the new Lazy only when the underlying part is non-shared, not all the time.

So, is there a way to know whether a part is non-shared when retrieved by code like:

   <ImportMany()> _
   Public _set As IEnumerable(Of Lazy(Of IThing, IThingComposition))