コード例 #1
0
        /// <summary>
        /// Removes the given object from the backing store.
        /// </summary>
        public override void RemoveValue()
        {
            var disposable = this.GetValue() as IDisposable;

            if (disposable != null)
            {
                disposable.Dispose();
            }

            UnityPerRequestHttpModule.SetValue(this.lifetimeKey, null);
        }
コード例 #2
0
 /// <summary>
 /// Stores the given value into the backing store for retrieval later.
 /// </summary>
 /// <param name="newValue">The object being stored.</param>
 public override void SetValue(object newValue)
 {
     UnityPerRequestHttpModule.SetValue(this.lifetimeKey, newValue);
 }
コード例 #3
0
 /// <summary>
 /// Retrieves a value from the backing store associated with this lifetime policy.
 /// </summary>
 /// <returns>The desired object, or null if no such object is currently stored.</returns>
 public override object GetValue()
 {
     return(UnityPerRequestHttpModule.GetValue(this.lifetimeKey));
 }