@@ -99,10 +99,15 @@ public interface IBuilderContext
9999 object CurrentOperation { get ; set ; }
100100
101101 /// <summary>
102- /// The build context used to resolve a dependency during the build operation represented by this context.
102+ /// The child build context.
103103 /// </summary>
104104 IBuilderContext ChildContext { get ; }
105105
106+ /// <summary>
107+ /// The parent build context.
108+ /// </summary>
109+ IBuilderContext ParentContext { get ; }
110+
106111 /// <summary>
107112 /// Add a new set of resolver override objects to the current build operation.
108113 /// </summary>
@@ -118,16 +123,15 @@ public interface IBuilderContext
118123 IDependencyResolverPolicy GetOverriddenResolver ( Type dependencyType ) ;
119124
120125 /// <summary>
121- /// A convenience method to do a new buildup operation on an existing context. This
122- /// overload allows you to specify extra policies which will be in effect for the duration
123- /// of the build.
126+ /// A method to do a new buildup operation on an existing context.
124127 /// </summary>
125- /// <param name="newBuildKey">Key defining what to build up.</param>
128+ /// <param name="type">Type of to build</param>
129+ /// <param name="name">Name of the type to build</param>
126130 /// <param name="childCustomizationBlock">A delegate that takes a <see cref="IBuilderContext"/>. This
127131 /// is invoked with the new child context before the build up process starts. This gives callers
128132 /// the opportunity to customize the context for the build process.</param>
129- /// <returns>Created object. </returns>
130- object NewBuildUp ( INamedType newBuildKey , Action < IBuilderContext > childCustomizationBlock = null ) ;
133+ /// <returns>Resolved object</returns>
134+ object NewBuildUp ( Type type , string name , Action < IBuilderContext > childCustomizationBlock = null ) ;
131135 }
132136
133137 /// <summary>
@@ -136,6 +140,24 @@ public interface IBuilderContext
136140 /// </summary>
137141 public static class BuilderContextExtensions
138142 {
143+
144+ /// <summary>
145+ /// A convenience method to do a new buildup operation on an existing context. This
146+ /// overload allows you to specify extra policies which will be in effect for the duration
147+ /// of the build.
148+ /// </summary>
149+ /// <param name="newBuildKey">Key defining what to build up.</param>
150+ /// <param name="childCustomizationBlock">A delegate that takes a <see cref="IBuilderContext"/>. This
151+ /// is invoked with the new child context before the build up process starts. This gives callers
152+ /// the opportunity to customize the context for the build process.</param>
153+ /// <returns>Created object.</returns>
154+ public static object NewBuildUp ( this IBuilderContext context , INamedType newBuildKey , Action < IBuilderContext > childCustomizationBlock = null )
155+ {
156+ return ( context ?? throw new ArgumentNullException ( nameof ( context ) ) )
157+ . NewBuildUp ( newBuildKey ? . Type , newBuildKey ? . Name , childCustomizationBlock ) ;
158+ }
159+
160+
139161 /// <summary>
140162 /// Start a recursive build up operation to retrieve the default
141163 /// value for the given <typeparamref name="TResult"/> type.
@@ -145,7 +167,8 @@ public static class BuilderContextExtensions
145167 /// <returns>Resulting object.</returns>
146168 public static TResult NewBuildUp < TResult > ( this IBuilderContext context )
147169 {
148- return context . NewBuildUp < TResult > ( null ) ;
170+ return ( TResult ) ( context ?? throw new ArgumentNullException ( nameof ( context ) ) )
171+ . NewBuildUp ( typeof ( TResult ) , null , null ) ;
149172 }
150173
151174 /// <summary>
@@ -159,7 +182,7 @@ public static TResult NewBuildUp<TResult>(this IBuilderContext context)
159182 public static TResult NewBuildUp < TResult > ( this IBuilderContext context , string name )
160183 {
161184 return ( TResult ) ( context ?? throw new ArgumentNullException ( nameof ( context ) ) )
162- . NewBuildUp ( NamedTypeBuildKey . Make < TResult > ( name ) ) ;
185+ . NewBuildUp ( typeof ( TResult ) , name , null ) ;
163186 }
164187
165188 /// <summary>
0 commit comments