/ / DryIoC - Unityプリズムに相当するレジスタ - xamarin、unity-container、prism、dryioc

DryIoC - Unityプリズムに相当するレジスタ - xamarin、unity-container、prism、dryioc

Unityのこのコード(DryIoC)に相当するものは何ですか?

Container.Register<IAuthenticationService, AuthenticationService>( Reuse.Singleton );

これはサンプルコードです Prism XamarinのHamburgerMenuプロジェクト

ありがとう!

回答:

回答№1は0
Container.RegisterType<IAuthenticationService, AuthenticationService>( new ContainerControlledLifetimeManager() );

それは、 AuthenticationService コンテナの寿命と一致します。コンテナを破棄して再作成しなければ、常に同じサービスインスタンスを取得します。