/// <summary>
 /// Initializes a new instance of the <see cref="ApiVersionApiExplorer"/> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="options">The generation options</param>
 public ApiVersionApiExplorer(HttpConfiguration configuration, ApiExplorerUrlOptions options)
 {
     _configuration   = configuration;
     _options         = options;
     _apiDescriptions = new Lazy <Collection <ApiDescription> >(InitializeApiDescriptions);
     _apiExplorer     = new ApiExplorer(configuration);
 }
        /// <summary>
        /// Adds an <see cref="IApiExplorer"/> to the specified configuration that is aware of versionized routes.
        /// </summary>
        /// <param name="configuration">The <see cref="HttpConfiguration">configuration</see> that will use use service versioning.</param>
        /// <param name="setupAction">An <see cref="Action{T}">action</see> used to configure the provided options.</param>
        public static void AddApiVersioningAwareApiExplorer(this HttpConfiguration configuration, Action <ApiExplorerUrlOptions> setupAction)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (setupAction == null)
            {
                throw new ArgumentNullException(nameof(setupAction));
            }

            var options  = new ApiExplorerUrlOptions();
            var services = configuration.Services;

            setupAction(options);
            services.Replace(typeof(IApiExplorer), new ApiVersionApiExplorer(configuration, options));
        }