我在unity
服务应用程序中使用WCF
容器。 NuGet软件包5.11.1。当前,我使用ContainerControlledLifetimeManager
生命周期管理器(单例),它在解析后会返回相同的对象。
我想给生存期管理器超时,以便在2分钟的特定时间后创建一个新对象。可以做到团结吗?
container.RegisterType<IMyInterface, MyConcrete>(); // register the interface
container.Resolve<IMyInterface>(); // it will create the object at first time
container.Resolve<IMyInterface>(); // it will return the same object object
// after 2 minutes
container.Resolve<IMyInterface>(); // it will create a new object object again