优先顺序从上至下
AddTransient<>();
AddScoped<>();
AddSingleton<>();
使用注意!
用AddTransient或AddSingleton
AddScoped 不是给注入构造器用的
使用建议
infrustruction(基础设施)如eventBus,windowManager,Apiserver建议用Singleton
无状态的service才考虑AddTransient
优先顺序从上至下
AddTransient<>();
AddScoped<>();
AddSingleton<>();
使用注意!
用AddTransient或AddSingleton
AddScoped 不是给注入构造器用的
使用建议
infrustruction(基础设施)如eventBus,windowManager,Apiserver建议用Singleton
无状态的service才考虑AddTransient