Skip to content

Commit a63fb26

Browse files
committed
ToString
1 parent 97b5244 commit a63fb26

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

src/Lifetime/InjectionSingletonLifetimeManager.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ public class InjectionSingletonLifetimeManager : ContainerControlledLifetimeMana
88
#region Fields
99

1010
private readonly ILifetimeContainer _container;
11-
private bool _disposed;
1211

1312
#endregion
1413

@@ -30,23 +29,24 @@ public InjectionSingletonLifetimeManager(ILifetimeContainer container)
3029
protected override void SynchronizedSetValue(object newValue, ILifetimeContainer container)
3130
{
3231
base.SynchronizedSetValue(newValue, container);
33-
if (newValue is IDisposable) _container.Add(new DisposableAction(() =>
34-
{
35-
RemoveValue(_container);
36-
_disposed = true;
37-
}));
32+
if (newValue is IDisposable) _container.Add(new DisposableAction(() => RemoveValue(_container) ));
3833
}
3934

4035
protected override LifetimeManager OnCreateLifetimeManager()
4136
{
4237
return new InjectionSingletonLifetimeManager(_container);
4338
}
4439

45-
public override void RemoveValue(ILifetimeContainer container = null)
46-
{
47-
_disposed = true;
48-
base.RemoveValue(container);
49-
}
40+
#endregion
41+
42+
43+
#region Overrides
44+
45+
/// <summary>
46+
/// This method provides human readable representation of the lifetime
47+
/// </summary>
48+
/// <returns>Name of the lifetime</returns>
49+
public override string ToString() => "Lifetime:InjectionPerContainer";
5050

5151
#endregion
5252

src/Lifetime/InjectionTransientLifetimeManager.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,17 @@ public override bool InUse
2525
get => false;
2626
set { }
2727
}
28+
29+
30+
31+
#region Overrides
32+
33+
/// <summary>
34+
/// This method provides human readable representation of the lifetime
35+
/// </summary>
36+
/// <returns>Name of the lifetime</returns>
37+
public override string ToString() => "Lifetime:InjectionTransient";
38+
39+
#endregion
2840
}
2941
}

0 commit comments

Comments
 (0)