How to dispose view when using Lazy<object, IViewMetadata> to create view?

Jan 3, 2011 at 8:19 PM

Hi all, I using Lazy to import all ViewExport attributes and add view [lazy value] to the region. When i remove the view from region, value of lazy object still available. I can't modify or recreate value, what should I do? or show me other scenario to help me solve this problem.

Note: I using view service to add, remove, re-add and so on ...


Jan 4, 2011 at 5:35 AM

Are your views in the same project or are they in separate modules? I think for your Lazy collection to update you need to update the catalog for it to recompose.

Jan 4, 2011 at 7:19 AM

Recompose catalog does not match with my solution, because i need to keep all view created and remove the particular view. I look into MEF 2 Preview 2, ExportFactory<T, TMetadata> help me out of this problem. Thank you

Jan 4, 2011 at 7:31 AM

Recomposition will not recreate the views already loaded if the creationpolicy is Shared. However I would suggest you move this post to here.