コード例 #1
0
        /// <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;
        }
コード例 #2
0
        public static Uri UriBuilder(Uri queryUri, ODataUrlConventions urlConventions, ODataUriParserSettings settings)
        {
            ODataUriParser odataUriParser = new ODataUriParser(HardCodedTestModel.TestModel, ServiceRoot, queryUri);

            odataUriParser.UrlConventions = urlConventions;
            ODataUri odataUri = odataUriParser.ParseUri();

            ODataUriBuilder odataUriBuilder = new ODataUriBuilder(urlConventions, odataUri);

            return(odataUriBuilder.BuildUri());
        }
コード例 #3
0
 /// <summary>
 /// Get the string representation of <see cref="ODataPath"/>.
 /// mainly translate Query Url path.
 /// </summary>
 /// <param name="path">Path to perform the computation on.</param>
 /// <param name="urlConventions">Mark whether key is segment</param>
 /// <returns>The string representation of the Query Url path.</returns>
 public static string ToResourcePathString(this ODataPath path, ODataUrlConventions urlConventions)
 {
     return(string.Concat(path.WalkWith(new PathSegmentToResourcePathTranslator(urlConventions.UrlConvention)).ToArray()).TrimStart('/'));
 }
コード例 #4
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;
 }
コード例 #5
0
 /// <summary>
 /// Get the string representation of <see cref="ODataPath"/>.
 /// mainly translate Query Url path.
 /// </summary>
 /// <param name="path">Path to perform the computation on.</param>
 /// <param name="urlConventions">Mark whether key is segment</param>
 /// <returns>The string representation of the Query Url path.</returns>
 public static string ToResourcePathString(this ODataPath path, ODataUrlConventions urlConventions)
 {       
      return string.Concat(path.WalkWith(new PathSegmentToResourcePathTranslator(urlConventions.UrlConvention)).ToArray()).TrimStart('/');
 }