internal RequestDescription(RequestTargetKind targetKind, RequestTargetSource targetSource, Uri resultUri) { SegmentInfo info = new SegmentInfo { TargetKind = targetKind, TargetSource = targetSource, SingleResult = true }; this.segmentInfos = new SegmentInfo[] { info }; this.resultUri = resultUri; this.responseVersion = DataServiceDefaultResponseVersion; this.actualResponseVersion = this.ResponseVersion; this.PreferenceApplied = System.Data.Services.PreferenceApplied.None; }
internal RequestDescription(RequestTargetKind targetKind, RequestTargetSource targetSource, Uri resultUri) { SegmentInfo info = new SegmentInfo { TargetKind = targetKind, TargetSource = targetSource, SingleResult = true }; this.segmentInfos = new SegmentInfo[] { info }; this.resultUri = resultUri; this.responseVersion = DataServiceDefaultResponseVersion; this.actualResponseVersion = this.ResponseVersion; this.PreferenceApplied = System.Data.Services.PreferenceApplied.None; }
private static void RunPayloadKindTest(RequestTargetKind requestTargetKind, RequestTargetSource requestTargetSource, ResourceType targetResourceType, bool singleResult, bool isLinkUri, ODataPayloadKind expectedKind) { var segment = new SegmentInfo { TargetKind = requestTargetKind, TargetSource = requestTargetSource, TargetResourceType = targetResourceType, SingleResult = singleResult, Identifier = "Fake", }; var operation = new ServiceOperation("Fake", ServiceOperationResultKind.Void, null, null, "GET", null); operation.SetReadOnly(); segment.Operation = new OperationWrapper(operation); segment.ProjectedProperty = new ResourceProperty("Fake", ResourcePropertyKind.Primitive, ResourceType.GetPrimitiveResourceType(typeof(int))); SegmentInfo[] segmentInfos; if (isLinkUri) { segmentInfos = new[] { new SegmentInfo(), new SegmentInfo { TargetKind = RequestTargetKind.Link, }, segment }; } else { segmentInfos = new[] { new SegmentInfo { Identifier = "Fake", }, new SegmentInfo(), segment }; } var requestDescription = new RequestDescription(segmentInfos, new Uri("http://temp.org/")); requestDescription.ResponsePayloadKind.Should().Be(expectedKind); }
/// <summary> /// Initializes a new RequestDescription for a query specified by the /// request Uri. /// </summary> /// <param name="targetKind">The kind of target for the request.</param> /// <param name="targetSource">The source for this target.</param> /// <param name="resultUri">URI to the results requested (with no query component).</param> internal RequestDescription(RequestTargetKind targetKind, RequestTargetSource targetSource, Uri resultUri) { WebUtil.DebugEnumIsDefined(targetKind); Debug.Assert(resultUri != null, "resultUri != null"); Debug.Assert(resultUri.IsAbsoluteUri, "resultUri.IsAbsoluteUri(" + resultUri + ")"); SegmentInfo segment = new SegmentInfo(); segment.TargetKind = targetKind; segment.TargetSource = targetSource; segment.SingleResult = true; this.segmentInfos = new SegmentInfo[] { segment }; this.resultUri = resultUri; this.requireMinimumVersion = new Version(1, 0); this.responseVersion = DataServiceDefaultResponseVersion; this.maxFeatureVersion = new Version(1, 0); }
/// <summary> /// Initializes a new RequestDescription for a query specified by the /// request Uri. /// </summary> /// <param name="targetKind">The kind of target for the request.</param> /// <param name="targetSource">The source for this target.</param> /// <param name="resultUri">URI to the results requested (with no query component).</param> internal RequestDescription(RequestTargetKind targetKind, RequestTargetSource targetSource, Uri resultUri) { WebUtil.DebugEnumIsDefined(targetKind); Debug.Assert(resultUri != null, "resultUri != null"); Debug.Assert(resultUri.IsAbsoluteUri, "resultUri.IsAbsoluteUri(" + resultUri + ")"); SegmentInfo segment = new SegmentInfo { TargetKind = targetKind, TargetSource = targetSource, SingleResult = true }; this.segmentInfos = new[] { segment }; this.resultUri = resultUri; #if DEBUG this.maxFeatureVersion = VersionUtil.Version4Dot0; #endif this.ResponseVersion = VersionUtil.DataServiceDefaultResponseVersion; this.ActualResponseVersion = this.ResponseVersion; this.Preference = ClientPreference.None; }
private static void RunPayloadKindTest(RequestTargetKind requestTargetKind, RequestTargetSource requestTargetSource, ResourceType targetResourceType, bool singleResult, bool isLinkUri, ODataPayloadKind expectedKind) { var segment = new SegmentInfo { TargetKind = requestTargetKind, TargetSource = requestTargetSource, TargetResourceType = targetResourceType, SingleResult = singleResult, Identifier = "Fake", }; var operation = new ServiceOperation("Fake", ServiceOperationResultKind.Void, null, null, "GET", null); operation.SetReadOnly(); segment.Operation = new OperationWrapper(operation); segment.ProjectedProperty = new ResourceProperty("Fake", ResourcePropertyKind.Primitive, ResourceType.GetPrimitiveResourceType(typeof(int))); SegmentInfo[] segmentInfos; if (isLinkUri) { segmentInfos = new[] { new SegmentInfo(), new SegmentInfo { TargetKind = RequestTargetKind.Link, }, segment }; } else { segmentInfos = new[] { new SegmentInfo { Identifier = "Fake", }, new SegmentInfo(), segment }; } var requestDescription = new RequestDescription(segmentInfos, new Uri("http://temp.org/")); requestDescription.ResponsePayloadKind.Should().Be(expectedKind); }
/// <summary> /// Initializes a new RequestDescription for a query specified by the /// request Uri. /// </summary> /// <param name="targetKind">The kind of target for the request.</param> /// <param name="targetSource">The source for this target.</param> /// <param name="resultUri">URI to the results requested (with no query component).</param> internal RequestDescription(RequestTargetKind targetKind, RequestTargetSource targetSource, Uri resultUri) { WebUtil.DebugEnumIsDefined(targetKind); Debug.Assert(resultUri != null, "resultUri != null"); Debug.Assert(resultUri.IsAbsoluteUri, "resultUri.IsAbsoluteUri(" + resultUri + ")"); SegmentInfo segment = new SegmentInfo(); segment.TargetKind = targetKind; segment.TargetSource = targetSource; segment.SingleResult = true; this.segmentInfos = new SegmentInfo[] { segment }; this.resultUri = resultUri; this.requireMinimumVersion = new Version(1, 0); this.responseVersion = DataServiceDefaultResponseVersion; this.maxFeatureVersion = new Version(1, 0); }