Skip to content

Commit ee085a2

Browse files
committed
Fixed #113
1 parent 2ff8634 commit ee085a2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Strategies/BuildKeyMappingStrategy.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,18 @@ public override void PreBuildUp(IBuilderContext context)
3939

4040
if (!policy.RequireBuild && ((UnityContainer)context.Container).RegistrationExists(context.BuildKey.Type, context.BuildKey.Name))
4141
{
42+
var type = context.BuildKey.Type;
43+
var name = context.BuildKey.Name;
44+
var existing = context.Existing;
45+
4246
context.Registration.Set(typeof(IBuildPlanPolicy),
4347
new DynamicMethodBuildPlan(c =>
4448
{
45-
((BuilderContext)c).ChildContext = new BuilderContext(c, context.BuildKey.Type, context.BuildKey.Name);
49+
((BuilderContext)c).ChildContext = new BuilderContext(c, type, name);
4650
((BuilderContext)c.ChildContext).BuildUp();
4751

4852
c.Existing = c.ChildContext.Existing;
49-
c.BuildComplete = null != context.Existing;
53+
c.BuildComplete = null != existing;
5054

5155
((BuilderContext)c).ChildContext = null;
5256
}));

0 commit comments

Comments
 (0)