コード例 #1
0
        private void annotation_Click(object sender, RoutedEventArgs e)
        {
            ExceptionFriendly(() =>
            {
                _context.SendingRequest2 += (requestSender, eventArgs) =>
                {
                    eventArgs.RequestMessage.SetHeader("Prefer", "odata.include-annotations=\"*\"");
                };

                var people = WaitForResult(_context.People.ExecuteAsync());
                var person = people.Single(p => p.UserName == "russellwhyte");

                string annotationValue;
                if (_context.TryGetAnnotation(person, "TestAnnotation", "TestQualifier", out annotationValue))
                {
                    SetText($"Annotation on People('russellwhyte') is '{annotationValue}'.");
                }
                else
                {
                    SetText("No annotation on People('russellwhyte').");
                }
            });
        }