Fazer uma PerguntaFazer uma Pergunta
 

PerguntaMEF and singletons

  • terça-feira, 23 de junho de 2009 9:47Gerhard Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    Hi,

    I have an object with more than one interface and I want to resolve this dependancies with MEF. But its important, that the instance of the object is a singleton, so how can I tell MEF to do so?

    Thanks

    Gerhard
    • MovidoMathias SchifferMSFTterça-feira, 23 de junho de 2009 10:28English Language Post (From:.NET Framework)
    •  

Todas as Respostas

  • segunda-feira, 17 de agosto de 2009 10:04Craig Kuhnert Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    When you export your class use the creationpolicy attribute
    [PartCreationPolicy(CreationPolicy.Shared)]
    [Export(typeof(IMyInterface))]
    public class MyClass : IMyInterface
    {
    }