/// <summary>
        /// Configure the default services.
        /// </summary>
        /// <param name="routeBuilder">The <see cref="IEndpointRouteBuilder"/>.</param>
        /// <param name="configureAction">The configuring action to add the services to the root container.</param>
        /// <returns>A configuring action to add the services to the root container.</returns>
        internal static Action <IContainerBuilder> ConfigureDefaultServices(IEndpointRouteBuilder routeBuilder, Action <IContainerBuilder> configureAction)
        {
            return(builder =>
            {
                // Add platform-specific services here. Add Configuration first as other services may rely on it.
                // For assembly resolution, add the and internal (IWebApiAssembliesResolver) where IWebApiAssembliesResolver
                // is transient and instantiated from ApplicationPartManager by DI.
                builder.AddService <IWebApiAssembliesResolver, WebApiAssembliesResolver>(ServiceLifetime.Transient);
                builder.AddService <IODataPathTemplateHandler, DefaultODataPathHandler>(ServiceLifetime.Singleton);
                builder.AddService <IETagHandler, DefaultODataETagHandler>(ServiceLifetime.Singleton);

                // Access the default query settings and options from the global container.
                builder.AddService(ServiceLifetime.Singleton, sp => routeBuilder.GetDefaultQuerySettings());
                builder.AddService(ServiceLifetime.Singleton, sp => routeBuilder.GetDefaultODataOptions());

                // Add the default webApi services.
                builder.AddDefaultWebApiServices();

                // Add custom actions.
                configureAction?.Invoke(builder);
            });
        }