コード例 #1
0
        public static Uri BuildLocationUri(QueryContext context, object target)
        {
            if (context.Target.NavigationSource == null)
            {
                throw new InvalidOperationException("Building Location URI for non-entity resource is not supported.");
            }

            if (context.Target.IsEntitySet)
            {
                var keySegment = BuildKeySegment(context.Target.ElementType as IEdmEntityType, context.Target.NavigationSource as IEdmEntitySetBase, target);
                return context.Target.BuildCanonicalUri(context.RootUri, keySegment);
            }

            return context.Target.BuildCanonicalUri(context.RootUri, null);
        }