예제 #1
0
        public static Uri UriBuilder(Uri queryUri, ODataUrlConventions urlConventions, ODataUriParserSettings settings)
        {
            ODataUriParser odataUriParser = new ODataUriParser(HardCodedTestModel.TestModel, ServiceRoot, queryUri);
            SetODataUriParserSettingsTo(settings, odataUriParser.Settings);
            odataUriParser.UrlConventions = urlConventions;
            ODataUri odataUri = odataUriParser.ParseUri();

            ODataUriBuilder odataUriBuilder = new ODataUriBuilder(urlConventions, odataUri);
            return odataUriBuilder.BuildUri();
        }
        /// <summary>
        /// Set the UrlConventions in DefaultODataPathHandler.
        /// </summary>
        /// <param name="configuration">The server configuration.</param>
        /// <param name="conventions">The <see cref="ODataUrlConventions"/></param>
        public static void SetUrlConventions(this HttpConfiguration configuration, ODataUrlConventions conventions)
        {
            if (configuration == null)
            {
                throw Error.ArgumentNull("configuration");
            }

            ODataUriResolverSetttings settings = configuration.GetResolverSettings();
            settings.UrlConventions = conventions;
        }
예제 #3
0
 /// <summary>
 /// Constructor of the ODataUriBuilder
 /// </summary>
 /// <param name="urlConventions">ODataUriBuilder constructor</param>
 /// <param name="odataUri">semantic tree of the uri</param>
 public ODataUriBuilder(ODataUrlConventions urlConventions, ODataUri odataUri)
 {
     this.urlConventions = urlConventions;
     this.odataUri = odataUri;
 }