File tree Expand file tree Collapse file tree
StabilityMatrix.Avalonia/Services Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- namespace StabilityMatrix . Avalonia . Services ;
1+ using Microsoft . Extensions . DependencyInjection ;
2+
3+ namespace StabilityMatrix . Avalonia . Services ;
24
35internal class ScopedServiceManager < T > : IServiceManager < T >
46{
@@ -78,6 +80,13 @@ public T Get(Type serviceType)
7880
7981 // 3. If not scoped, delegate to the parent manager to resolve Singleton or Transient
8082 // (Parent's Get will throw if the type isn't registered there either)
81- return parentManager . Get ( serviceType ) ;
83+ // return parentManager.Get(serviceType);
84+
85+ // We don't use parent manager for scoped contexts anymore,
86+ // since we'll lose the scope through transients,
87+ // then we have to make Inference Cards scoped as well,
88+ // which cases samplers to be shared with Civit page and other issues.
89+ // 3. Just use the scoped service provider, since we might need to keep the scope through transients as well
90+ return ( T ) scopedServiceProvider . GetRequiredService ( serviceType ) ;
8291 }
8392}
You can’t perform that action at this time.
0 commit comments