@@ -58,6 +58,32 @@ public void Execute(ResolveRequestContext context, Action<ResolveRequestContext>
5858 }
5959 }
6060
61+ /// <inheritdoc/>
62+ public override string ToString ( ) => nameof ( CircularDependencyDetectorMiddleware ) ;
63+
64+ private static string CreateDependencyGraphTo ( IComponentRegistration registration , IEnumerable < ResolveRequestContext > requestStack )
65+ {
66+ if ( registration == null )
67+ {
68+ throw new ArgumentNullException ( nameof ( registration ) ) ;
69+ }
70+
71+ if ( requestStack == null )
72+ {
73+ throw new ArgumentNullException ( nameof ( requestStack ) ) ;
74+ }
75+
76+ var dependencyGraph = Display ( registration ) ;
77+
78+ return requestStack . Select ( a => a . Registration )
79+ . Aggregate ( dependencyGraph , ( current , requestor ) => Display ( requestor ) + " -> " + current ) ;
80+ }
81+
82+ private static string Display ( IComponentRegistration registration )
83+ {
84+ return registration . Activator . DisplayName ( ) ;
85+ }
86+
6187 private void ExecuteCore ( ResolveRequestContext context , Action < ResolveRequestContext > next )
6288 {
6389 if ( context . Operation is not IDependencyTrackingResolveOperation dependencyTrackingResolveOperation )
@@ -116,30 +142,4 @@ private void ExecuteCore(ResolveRequestContext context, Action<ResolveRequestCon
116142 requestStack . Pop ( ) ;
117143 }
118144 }
119-
120- /// <inheritdoc/>
121- public override string ToString ( ) => nameof ( CircularDependencyDetectorMiddleware ) ;
122-
123- private static string CreateDependencyGraphTo ( IComponentRegistration registration , IEnumerable < ResolveRequestContext > requestStack )
124- {
125- if ( registration == null )
126- {
127- throw new ArgumentNullException ( nameof ( registration ) ) ;
128- }
129-
130- if ( requestStack == null )
131- {
132- throw new ArgumentNullException ( nameof ( requestStack ) ) ;
133- }
134-
135- var dependencyGraph = Display ( registration ) ;
136-
137- return requestStack . Select ( a => a . Registration )
138- . Aggregate ( dependencyGraph , ( current , requestor ) => Display ( requestor ) + " -> " + current ) ;
139- }
140-
141- private static string Display ( IComponentRegistration registration )
142- {
143- return registration . Activator . DisplayName ( ) ;
144- }
145145}
0 commit comments