コード例 #1
0
        // TODO: Remove this - but keeping it in for now until we prove in all cases that the ctor below is better.
        public ODataServerConfigurer(HttpConfiguration webApiConfig, IContainerMetadata containerMetadata)
        {
            Contract.Requires <ArgumentNullException>(webApiConfig != null);

            _webApiConfig      = webApiConfig;
            _containerMetadata = containerMetadata;

            _controllerSelector = EntityRepositoryControllerSelector.Install(webApiConfig, this);
        }
コード例 #2
0
        public ODataServerConfigurer(HttpConfiguration webApiConfig)
        {
            Contract.Requires <ArgumentNullException>(webApiConfig != null);

            _webApiConfig = webApiConfig;

            // Obtain the container metadata from the DI service
            _containerMetadata = webApiConfig.DependencyResolver.Resolve <IContainerMetadata>();
            if (_containerMetadata == null)
            {
                throw new ArgumentException("IContainerMetadata could not be resolved from HttpConfiguration.DependencyResolver.");
            }

            _controllerSelector = EntityRepositoryControllerSelector.Install(webApiConfig, this);
        }