C# DryIoc:Can';我不知道如何注册IDisposable Decorator对象

C# DryIoc:Can';我不知道如何注册IDisposable Decorator对象,c#,dependency-injection,dryioc,C#,Dependency Injection,Dryioc,我正在尝试围绕IDisposabledb上下文设置装饰程序: c.Register<IContext, DbContext>(setup: Setup.With(trackDisposableTransient: true)); // c.Register<IContext, ConsoleTimedContext>(setup: Setup.Decorator); c.寄存器(设置:setup.With(trackDisposableTransient:true)

我正在尝试围绕
IDisposable
db上下文设置装饰程序:

c.Register<IContext, DbContext>(setup: Setup.With(trackDisposableTransient: true));

// c.Register<IContext, ConsoleTimedContext>(setup: Setup.Decorator); 
c.寄存器(设置:setup.With(trackDisposableTransient:true));
//c.注册(设置:setup.Decorator);
如果我取消注释最后一行,程序将抛出:

DryIoc.ContainerException:container不会处理注册表项为{no key}的注册一次性临时服务Lib.DI.IContext和工厂容器。DryIoc不引用已解决的瞬态,因此不控制其处置。要使此异常寄存器静音(setup:setup.With(allowDisposableTransient:true))或设置规则容器(rules=>rules.withoutthrownregisteringdisposabletransient())。要启用跟踪,请使用寄存器(setup:setup.With(trackDisposableTransient:true))或设置规则容器(rules=>rules.WithTrackingDisposableTransient())
它(Int32错误,对象arg0,对象arg1,对象arg2,对象arg3)
△DryIoc.Container.ThrowIfInvalidRegistration(工厂工厂、类型serviceType、对象serviceKey、布尔值isStaticallyChecked)
△DryIoc.Container.Register(工厂工厂、类型serviceType、对象serviceKey、IfAlreadyRegistered IfAlreadyRegistered、布尔值isStaticallyChecked)
§DryIoc.Registrator.Registrate[t服务,t实施](IRegistrator注册器,IReuse重用,制造,设置,IfAlreadyRegistered,IfAlreadyRegistered,对象服务密钥)


如何将
Setup.Decorator
trackDisposableTransient
混合使用?

该设置不适用于每个Decorator注册(最新版本为DryIoc v2.8.3)

现在,您需要为decorator指定非瞬时重用


请随时在以下网址提出问题:

我是DryIoc的绝对初学者,您介意解释一下吗?还有什么副作用,如果有的话?瞬态跟踪功能有点争议,首先是为了符合新的.NET内核MS.DI而引入的。所以我尽可能地限制它,看看它是如何进行的。将其添加到Decodators(希望如此)中不是问题。但首先是一个问题:您的装饰服务是否被重用?我不确定重用在DI上下文中是什么意思,但每次我查询数据库时都会使用它。我的意思是装饰服务是否注册了
重用。Singleton
或其他重用,或者根本没有指定重用?根本没有指定重用。(必须提高我的知识…)