【发布时间】:2011-05-20 18:41:21
【问题描述】:
我有下面的代码一个可绑定到我的用户存储库,另一个可绑定到缓存。我应该为 UserRepository 和 Cache 使用什么范围。 UserRepository 的 Scope 应该是 Singleton 吗?
this.Bind<IUserRepository>().To<UserRepositary>().InRequestScope();
this.Bind<IDistributedCacheService>().To<DistributedCacheService>().InSingletonScope();
【问题讨论】: