private static bool HasETagOnRetrieve(ODataUri uri) { if (uri.ExpandSegments.Any()) { return(false); } if (uri.IsEntity()) { return(true); } if (uri.IsProperty()) { return(true); } if (uri.IsPropertyValue() || uri.IsMediaResource()) { // this covers media-resources as well return(true); } if (uri.IsNamedStream()) { return(true); } return(false); }
internal static HttpStatusCode GetExpectedStatusCode(ODataUri uri, IODataUriEvaluator evaluator) { bool specialStatusCodeIfNull = false; specialStatusCodeIfNull |= uri.IsNamedStream(); specialStatusCodeIfNull |= uri.IsMediaResource(); specialStatusCodeIfNull |= uri.IsEntity(); specialStatusCodeIfNull |= uri.IsEntityReferenceLink(); specialStatusCodeIfNull |= uri.IsPropertyValue(); bool uriIsValue = uri.IsNamedStream() || uri.IsMediaResource(); // For an action it is evaluated specially via the actionresponse verifier, skip eval here if (!uri.IsAction() && specialStatusCodeIfNull && evaluator.Evaluate(uri).IsNull) { if (uriIsValue) { return(HttpStatusCode.NoContent); } else { return(HttpStatusCode.NotFound); } } return(HttpStatusCode.OK); }