0
Iは、Web API 2を使用

するものであり、ここで私のユニティ・コンテナの設定(私は私のRabbitMQの依存関係を設定する)である:UnityContainer:デフォルトのlifetimemanager

container.RegisterInstance(new ConnectionFactory { 
    Uri = AppSettings.RmqConnectionString 
}); 

container.RegisterType<IConnection, AutorecoveringConnection>(
    new InjectionConstructor(typeof(ConnectionFactory), "tm.resource-server.api"), 
    new InjectionMethod("Init") 
); 

今私が把握することはできません、デフォルトは何この依存関係の生涯?彼らは作成または既存のインスタンスを解決することになる何時間

は、私は自分のlifetimemanagerを使用するか(例えばPerThreadLifetimeManager)既存すでに使用する必要がありますか?

答えて

0
  1. RegisterInstanceのデフォルトの寿命があるContainerControlledLifetimeManager
  2. RegisterTypeのデフォルトの寿命はTransientLifetimeManager
です
関連する問題