Unityのこのコード(DryIoC)に相当するものは何ですか?
Container.Register<IAuthenticationService, AuthenticationService>( Reuse.Singleton );
これはサンプルコードです Prism XamarinのHamburgerMenuプロジェクト
ありがとう!
回答:
回答№1は0Container.RegisterType<IAuthenticationService, AuthenticationService>( new ContainerControlledLifetimeManager() );
それは、 AuthenticationService
コンテナの寿命と一致します。コンテナを破棄して再作成しなければ、常に同じサービスインスタンスを取得します。