当前位置: 首页>>代码示例>>C#>>正文


C# HttpRequestMessage.GetSelectExpandClause方法代码示例

本文整理汇总了C#中System.Net.Http.HttpRequestMessage.GetSelectExpandClause方法的典型用法代码示例。如果您正苦于以下问题:C# HttpRequestMessage.GetSelectExpandClause方法的具体用法?C# HttpRequestMessage.GetSelectExpandClause怎么用?C# HttpRequestMessage.GetSelectExpandClause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Net.Http.HttpRequestMessage的用法示例。


在下文中一共展示了HttpRequestMessage.GetSelectExpandClause方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSelectClause

        private static string GetSelectClause(HttpRequestMessage request)
        {
            Contract.Assert(request != null);

            if (request.GetSelectExpandClause() != null)
            {
                // Include the $select clause only if it has been applied.
                IEnumerable<KeyValuePair<string, string>> queryOptions = request.GetQueryNameValuePairs();
                return queryOptions.Where(kvp => kvp.Key == "$select").Select(kvp => kvp.Value).FirstOrDefault();
            }

            return null;
        }
开发者ID:sstrazan,项目名称:aspnetwebstack,代码行数:13,代码来源:ODataMediaTypeFormatter.cs

示例2: GetSelectExpandClause_Returns_SetSelectExpandClause

        public void GetSelectExpandClause_Returns_SetSelectExpandClause()
        {
            // Arrange
            HttpRequestMessage request = new HttpRequestMessage();
            SelectExpandClause selectExpandCaluse = GetMockSelectExpandClause();

            // Act
            request.SetSelectExpandClause(selectExpandCaluse);
            var result = request.GetSelectExpandClause();

            // Assert
            Assert.Same(selectExpandCaluse, result);
        }
开发者ID:samgithub-duplicate,项目名称:aspnetwebstack,代码行数:13,代码来源:ODataHttpRequestMessageExtensionsTest.cs

示例3: ApplyTo_SetsRequestSelectExpandClause_IfSelectExpandIsNotNull

        public void ApplyTo_SetsRequestSelectExpandClause_IfSelectExpandIsNotNull()
        {
            // Arrange
            var model = new ODataModelBuilder().Add_Customers_EntitySet().GetEdmModel();
            var request = new HttpRequestMessage(HttpMethod.Get, new Uri("http://server/service/Customers?$select=Name"));
            ODataQueryOptions queryOptions = new ODataQueryOptions(new ODataQueryContext(model, typeof(Customer)), request);

            // Act
            queryOptions.ApplyTo(Enumerable.Empty<Customer>().AsQueryable());

            // Assert
            Assert.NotNull(request.GetSelectExpandClause());
        }
开发者ID:normalian,项目名称:aspnetwebstack,代码行数:13,代码来源:ODataQueryOptionTest.cs

示例4: GetSelectExpandClause_ReturnsNullByDefault

        public void GetSelectExpandClause_ReturnsNullByDefault()
        {
            HttpRequestMessage request = new HttpRequestMessage();

            Assert.Null(request.GetSelectExpandClause());
        }
开发者ID:samgithub-duplicate,项目名称:aspnetwebstack,代码行数:6,代码来源:ODataHttpRequestMessageExtensionsTest.cs


注:本文中的System.Net.Http.HttpRequestMessage.GetSelectExpandClause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。