// Helper methods for adding and removing the tracker policy.
 /// <summary>
 /// Get an instance that implements <see cref="IDependencyResolverTrackerPolicy"/>,
 /// either the current one in the policy set or creating a new one if it doesn't
 /// exist.
 /// </summary>
 /// <param name="policies">Policy list to look up from.</param>
 /// <param name="buildKey">Build key to track.</param>
 /// <returns>The resolver tracker.</returns>
 public static IDependencyResolverTrackerPolicy GetTracker(IPolicyList policies, object buildKey)
 {
     IDependencyResolverTrackerPolicy tracker =
         policies.Get<IDependencyResolverTrackerPolicy>(buildKey);
     if (tracker == null)
     {
         tracker = new DependencyResolverTrackerPolicy();
         policies.Set<IDependencyResolverTrackerPolicy>(tracker, buildKey);
     }
     return tracker;
 }
Esempio n. 2
0
        // Helper methods for adding and removing the tracker policy.

        /// <summary>
        /// Get an instance that implements <see cref="IDependencyResolverTrackerPolicy"/>,
        /// either the current one in the policy set or creating a new one if it doesn't
        /// exist.
        /// </summary>
        /// <param name="policies">Policy list to look up from.</param>
        /// <param name="buildKey">Build key to track.</param>
        /// <returns>The resolver tracker.</returns>
        public static IDependencyResolverTrackerPolicy GetTracker(IPolicyList policies, object buildKey)
        {
            IDependencyResolverTrackerPolicy tracker =
                policies.Get <IDependencyResolverTrackerPolicy>(buildKey);

            if (tracker == null)
            {
                tracker = new DependencyResolverTrackerPolicy();
                policies.Set <IDependencyResolverTrackerPolicy>(tracker, buildKey);
            }
            return(tracker);
        }