/// <summary>
        /// Initializes a new instance of the <see cref="ODataConventionModelBuilder"/> class.
        /// </summary>
        /// <param name="configuration">The <see cref="HttpConfiguration"/> to use.</param>
        /// <param name="isQueryCompositionMode">If the model is being built for only querying.</param>
        /// <remarks>The model built if <paramref name="isQueryCompositionMode"/> is <c>true</c> has more relaxed
        /// inference rules and also treats all types as entity types. This constructor is intended for use by unit testing only.</remarks>
        /// <remarks>This signature uses types that are AspNet-specific.</remarks>
        public ODataConventionModelBuilder(HttpConfiguration configuration, bool isQueryCompositionMode)
        {
            if (configuration == null)
            {
                throw Error.ArgumentNull("configuration");
            }

            // Create an IWebApiAssembliesResolver from configuration and initialize.
            IAssembliesResolver       aspnetResolver   = configuration.Services.GetAssembliesResolver();
            IWebApiAssembliesResolver internalResolver = new WebApiAssembliesResolver(aspnetResolver);

            Initialize(internalResolver, isQueryCompositionMode);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ODataConventionModelBuilder"/> class.
        /// The model built if <paramref name="isQueryCompositionMode"/> is <c>true</c> has more relaxed
        /// inference rules and also treats all types as entity types.
        /// </summary>
        /// <param name="provider">The service provider to use.</param>
        /// <param name="applicationPartManager">
        /// The application part manager to use. If null, the service
        /// provider will be queried for the application part manager.
        /// </param>
        /// <param name="isQueryCompositionMode">If the model is being built for only querying.</param>
        private ODataConventionModelBuilder(
            IServiceProvider provider,
            ApplicationPartManager applicationPartManager,
            bool isQueryCompositionMode)
        {
            // Create an IWebApiAssembliesResolver from configuration and initialize.
            if (applicationPartManager == null)
            {
                if (provider == null)
                {
                    throw Error.ArgumentNull("provider");
                }

                applicationPartManager = provider.GetRequiredService <ApplicationPartManager>();
            }

            IWebApiAssembliesResolver internalResolver = new WebApiAssembliesResolver(applicationPartManager);

            Initialize(internalResolver, isQueryCompositionMode);
        }