コード例 #1
0
        internal static IList <ODataPathSegment> GenerateBaseODataPathSegments(this ResourceContext resourceContext)
        {
            IList <ODataPathSegment> odataPath = new List <ODataPathSegment>();

            if (resourceContext.NavigationSource.NavigationSourceKind() == EdmNavigationSourceKind.Singleton)
            {
                // Per the OData V4 specification, a singleton is expected to be a child of the entity container, and
                // as a result we can make the assumption that it is the only segment in the generated path.
                odataPath.Add(new SingletonSegment((IEdmSingleton)resourceContext.NavigationSource));
            }
            else
            {
                resourceContext.GenerateBaseODataPathSegmentsForEntity(odataPath);
            }

            return(odataPath);
        }