Skip to content

Commit 4411cfc

Browse files
committed
Fixed #210
1 parent 5b62003 commit 4411cfc

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/Strategies/LifetimeStrategy.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ public override void PreBuildUp(ref BuilderContext context)
5555

5656
if (policy is IDisposable)
5757
{
58-
context.Lifetime.Add(policy);
58+
var scope = policy is ContainerControlledLifetimeManager container
59+
? ((UnityContainer)container.Scope)?.LifetimeContainer ?? context.Lifetime
60+
: context.Lifetime;
61+
scope.Add(policy);
5962
}
6063
}
6164
}

src/UnityContainer.IUnityContainer.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,6 @@ bool IUnityContainer.IsRegistered(Type type, string name) => ReferenceEquals(All
233233
/// <inheritdoc />
234234
object IUnityContainer.Resolve(Type type, string name, params ResolverOverride[] overrides)
235235
{
236-
var n = type.FullName;
237-
238236
// Verify arguments
239237
if (null == type) throw new ArgumentNullException(nameof(type));
240238

src/UnityContainer.Resolution.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ private IPolicySet CreateRegistration(Type type, Type policyInterface, object po
8585
#endregion
8686

8787

88-
8988
#region Resolving Enumerable
9089

9190
internal IEnumerable<TElement> ResolveEnumerable<TElement>(Func<Type, string, InternalRegistration, object> resolve, string name)

0 commit comments

Comments
 (0)