示例#1
0
        /// <summary>
        /// Parses the specified OData path template as an <see cref="ODataPathTemplate"/> that can be matched to an <see cref="ODataPath"/>.
        /// </summary>
        /// <param name="model">The model to use for path parsing.</param>
        /// <param name="pathTemplate">The OData path template to parse.</param>
        /// <param name="resolverSettings"></param>
        /// <returns>A parsed representation of the path template, or <c>null</c> if the path does not match the model.</returns>
        public virtual ODataPathTemplate ParseTemplate(IEdmModel model, string pathTemplate, ODataUriResolverSettings resolverSettings)
        {
            if (pathTemplate == null)
            {
                throw Error.ArgumentNull("pathTemplate");
            }

            return(Templatify(ODataPathParserHelper.Parse(model, null, pathTemplate, true, _serviceProvider, resolverSettings), pathTemplate));
        }
        /// <summary>
        /// Parses the specified OData path as an <see cref="ODataPath"/> that contains additional information about the EDM type and entity set for the path.
        /// </summary>
        /// <param name="model">The model to use for path parsing.</param>
        /// <param name="serviceRoot">The service root of the OData path.</param>
        /// <param name="path">The OData path to parse.</param>
        /// <param name="resolverSettings"></param>
        /// <returns>A parsed representation of the path, or <c>null</c> if the path does not match the model.</returns>
        public virtual ODataPath Parse(IEdmModel model, string serviceRoot, string path, ODataUriResolverSettings resolverSettings)
        {
            if (serviceRoot == null)
            {
                throw Error.ArgumentNull("serviceRoot");
            }

            if (path == null)
            {
                throw Error.ArgumentNull("path");
            }

            return(ODataPathParserHelper.Parse(model, serviceRoot, path, false, _serviceProvider, resolverSettings));
        }