Skip to content

Commit d896569

Browse files
Scope factory method
1 parent 0988256 commit d896569

2 files changed

Lines changed: 535 additions & 1 deletion

File tree

src/Pure.DI.Core/Core/Code/RootCodeBuilder.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ private void FinishSingleInstanceCheck(CodeContext ctx)
171171
var parent = "";
172172
if (var.AbstractNode.ActualLifetime == Singleton && constructors.IsEnabled(ctx.RootContext.Graph))
173173
{
174-
parent = $"{Names.RootFieldName}.";
174+
parent = string.IsNullOrWhiteSpace(ctx.RootContext.Graph.Source.Hints.ScopeFactoryName)
175+
? $"{Names.RootFieldName}."
176+
: $"{Names.RootVarName}.";
175177
}
176178

177179
lines.AppendLine($"{parent}{Names.DisposablesFieldName}[{parent}{Names.DisposeIndexFieldName}++] = {var.Name};");

0 commit comments

Comments
 (0)