Skip to content

Commit a0f65d6

Browse files
authored
Merge pull request #127 from unitycontainer/release/5.11
Release/5.11
2 parents 2e9266f + a937e29 commit a0f65d6

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

package.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<VersionBase>5.11.2</VersionBase>
4+
<VersionBase>5.11.3</VersionBase>
55
<TargetFrameworks>netstandard2.0;netstandard1.0;netcoreapp2.0;netcoreapp1.0;net47;net46;net45;net40</TargetFrameworks>
66
</PropertyGroup>
77

src/Lifetime/Managers/ExternallyControlledLifetimeManager.cs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Unity.Lifetime
66
/// A <see cref="LifetimeManager"/> that holds a weak reference to
77
/// it's managed instance.
88
/// </summary>
9-
public class ExternallyControlledLifetimeManager : LifetimeManager,
9+
public class ExternallyControlledLifetimeManager : SynchronizedLifetimeManager,
1010
IInstanceLifetimeManager,
1111
ITypeLifetimeManager,
1212
IFactoryLifetimeManager
@@ -18,35 +18,36 @@ public class ExternallyControlledLifetimeManager : LifetimeManager,
1818
#endregion
1919

2020

21-
#region Overrides
21+
#region SynchronizedLifetimeManager
2222

23-
/// <summary>
24-
/// Retrieve a value from the backing store associated with this Lifetime policy.
25-
/// </summary>
26-
/// <param name="container">Instance of container requesting the value</param>
27-
/// <returns>the object desired, or null if no such object is currently stored.</returns>
28-
public override object GetValue(ILifetimeContainer container = null)
23+
/// <inheritdoc/>
24+
protected override object SynchronizedGetValue(ILifetimeContainer container = null)
2925
{
3026
if (null == _value) return NoValue;
3127

3228
var target = _value.Target;
33-
if (_value.IsAlive) return target;
29+
if (null != target) return target;
3430

3531
_value = null;
3632

3733
return NoValue;
3834
}
3935

40-
/// <summary>
41-
/// Stores the given value into backing store for retrieval later.
42-
/// </summary>
43-
/// <param name="container">Instance of container which owns the value</param>
44-
/// <param name="newValue">The object being stored.</param>
45-
public override void SetValue(object newValue, ILifetimeContainer container = null)
36+
/// <inheritdoc/>
37+
protected override void SynchronizedSetValue(object newValue, ILifetimeContainer container = null)
4638
{
4739
_value = new WeakReference(newValue);
4840
}
4941

42+
43+
/// <inheritdoc/>
44+
public override void RemoveValue(ILifetimeContainer container = null) => _value = null;
45+
46+
#endregion
47+
48+
49+
#region Overrides
50+
5051
protected override LifetimeManager OnCreateLifetimeManager()
5152
{
5253
return new ExternallyControlledLifetimeManager();

src/Unity.Abstractions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
</PropertyGroup>
6464

6565
<ItemGroup>
66-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05">
66+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
6767
<PrivateAssets>all</PrivateAssets>
6868
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
6969
</PackageReference>

0 commit comments

Comments
 (0)