I am converting a DNX project to .net core. Because of dependency changes, I cannot use System.ComponentModel.Composition
anymore, instead must use .net core's ported version System.Composition
(which I believe is known as MEF 2).
However I could not find an equivalent functionality in MEF2 for setting the CreationPolicy
for singleton.
In MEF1, the code is
[PartCreationPolicy(CreationPolicy.Shared)]
How can you do this in MEF2?
Answering own since no answers received although don't have a very good one.
Reading multiple posts, it seems like the Default CreationPolicy is shared, aka singleton. So probably just deleting this line will work.
MEF2 introduced Export Factory, which can be look into to get more details for policy settings.