From 5e5740f0920c94e8dcff7dac17ad23aa0347faec Mon Sep 17 00:00:00 2001 From: Eugene Sadovoi Date: Tue, 13 Feb 2018 15:31:51 -0500 Subject: [PATCH] Releasing v3.2.0 --- package.props | 2 +- .../ExternallyControlledLifetimeManager.cs | 10 ---------- src/Lifetime/ILifetimeContainer.cs | 6 ++++++ src/Lifetime/LifetimeManager.cs | 4 ++-- src/Lifetime/PerResolveLifetimeManager.cs | 18 ------------------ src/Lifetime/PerThreadLifetimeManager.cs | 9 --------- src/Lifetime/TransientLifetimeManager.cs | 17 ----------------- 7 files changed, 9 insertions(+), 57 deletions(-) diff --git a/package.props b/package.props index d1d39cfc..db1dd671 100644 --- a/package.props +++ b/package.props @@ -1,7 +1,7 @@ - 3.1.3 + 3.2.0 This package is distributed as .NET Standard 1.0, 2.0, .Net Core 1.0 and .NET 4.0, 4.5, 4.7 diff --git a/src/Lifetime/ExternallyControlledLifetimeManager.cs b/src/Lifetime/ExternallyControlledLifetimeManager.cs index ad6cf8fa..966f99b3 100644 --- a/src/Lifetime/ExternallyControlledLifetimeManager.cs +++ b/src/Lifetime/ExternallyControlledLifetimeManager.cs @@ -32,16 +32,6 @@ public override void SetValue(object newValue, ILifetimeContainer container = nu _value = new WeakReference(newValue); } - /// - /// Remove the given object from backing store. - /// - /// Instance of container - public override void RemoveValue(ILifetimeContainer container = null) - { - // DO NOTHING - we don't own this instance. - } - - protected override LifetimeManager OnCreateLifetimeManager() { return new ExternallyControlledLifetimeManager(); diff --git a/src/Lifetime/ILifetimeContainer.cs b/src/Lifetime/ILifetimeContainer.cs index 5be572e7..0a107b28 100644 --- a/src/Lifetime/ILifetimeContainer.cs +++ b/src/Lifetime/ILifetimeContainer.cs @@ -15,6 +15,12 @@ namespace Unity.Lifetime /// public interface ILifetimeContainer : IEnumerable, IDisposable { + /// + /// The container that this context is associated with. + /// + /// The object. + IUnityContainer Container { get; } + /// /// Gets the number of references in the lifetime container /// diff --git a/src/Lifetime/LifetimeManager.cs b/src/Lifetime/LifetimeManager.cs index 2c85793b..b763fdbd 100644 --- a/src/Lifetime/LifetimeManager.cs +++ b/src/Lifetime/LifetimeManager.cs @@ -26,13 +26,13 @@ public abstract class LifetimeManager : ILifetimePolicy, ILifetimeFactoryPolicy /// /// The object being stored. /// The container this lifetime belongs to - public abstract void SetValue(object newValue, ILifetimeContainer container = null); + public virtual void SetValue(object newValue, ILifetimeContainer container = null) { } /// /// Remove the given object from backing store. /// The container this lifetime belongs to /// - public abstract void RemoveValue(ILifetimeContainer container = null); + public virtual void RemoveValue(ILifetimeContainer container = null) { } #endregion diff --git a/src/Lifetime/PerResolveLifetimeManager.cs b/src/Lifetime/PerResolveLifetimeManager.cs index 1bb3dd16..942ad2c5 100644 --- a/src/Lifetime/PerResolveLifetimeManager.cs +++ b/src/Lifetime/PerResolveLifetimeManager.cs @@ -32,24 +32,6 @@ public override object GetValue(ILifetimeContainer container = null) return value; } - /// - /// Stores the given value into backing store for retrieval later. In this class, - /// this is a noop, since it has special hooks down in the guts. - /// - /// Instance of container which owns the value - /// The object being stored. - public override void SetValue(object newValue, ILifetimeContainer container = null) - { - } - - /// - /// Remove the given object from backing store. Noop in this class. - /// - /// Instance of container - public override void RemoveValue(ILifetimeContainer container = null) - { - } - protected override LifetimeManager OnCreateLifetimeManager() { return new PerResolveLifetimeManager(); diff --git a/src/Lifetime/PerThreadLifetimeManager.cs b/src/Lifetime/PerThreadLifetimeManager.cs index b0f99e1e..8d8389f6 100644 --- a/src/Lifetime/PerThreadLifetimeManager.cs +++ b/src/Lifetime/PerThreadLifetimeManager.cs @@ -57,15 +57,6 @@ public override void SetValue(object newValue, ILifetimeContainer container = nu _values[_key] = newValue; } - /// - /// Remove the given object from backing store. - /// - /// Instance of container - /// Not implemented for this lifetime manager. - public override void RemoveValue(ILifetimeContainer container = null) - { - } - private static void EnsureValues() { // no need for locking, values is TLS diff --git a/src/Lifetime/TransientLifetimeManager.cs b/src/Lifetime/TransientLifetimeManager.cs index 7d4baf6f..c50cc77d 100644 --- a/src/Lifetime/TransientLifetimeManager.cs +++ b/src/Lifetime/TransientLifetimeManager.cs @@ -26,23 +26,6 @@ public override object GetValue(ILifetimeContainer container = null) return null; } - /// - /// Stores the given value into backing store for retrieval later. - /// - /// The object being stored. - /// Instance of container which owns the value - public override void SetValue(object newValue, ILifetimeContainer container = null) - { - } - - /// - /// Remove the given object from backing store. - /// Instance of container - /// - public override void RemoveValue(ILifetimeContainer container = null) - { - } - protected override LifetimeManager OnCreateLifetimeManager() { return Instance;