关于Autofac生命周期设置的问题
var builder = new ContainerBuilder();
builder.RegisterType<MyClass>().InstancePerLifetimeScope();
IContainer container = builder.Build();
// 第一次HTTP请求
var myClass1 = container.Resolve<MyClass>();
//第二次HTTP请求
var myClass2 = container.Resolve<MyClass>();现在是myClass1 不会被丢掉,而是共享给myClas2继续用,我想要的是,myClass1 和myClas2是两个全新的实例。应该怎么侬?
相关推荐
Autofac Dispose Issue[项目代码]
This repository is a reproduction for an issue related to Autofac.Extensions.DependencyInjection where the disposal of objects is not functioning as expected. The issue is documented at https://github.com/autofac/Autofac.Extensions.DependencyInjection/issues/68. The project includes C# files demonstrating the problem, such as MyDisposable.cs, Program.cs, and Startup.cs, under the MIT license. The repository aims to provide a clear example of the issue to facilitate debugging and resolution.
Autofac.dll3.5.2.0和Autofac.Configuration.dll3.3.0.0
Autofac.dll3.5.2.0和Autofac.Configuration.dll3.3.0.0
AutoFac使用方法总结
AutoFac使用方法总结
Autofac.Configuration.4.0.0-beta6-248
Autofac.Configuration.4.0.0-beta6-248
Autofac.3.5.0
Autofac.3.5.0


