Exemplo n.º 1
0
        public IEntitySet GetNavigationRoot(IModelContext modelContext, IEnumerable <ODataPathSegment> oDataPath)
        {
            if (!oDataPath.Any())
            {
                throw new ArgumentException("The path must not be empty.", nameof(oDataPath));
            }

            var translator = new NavigatablePathSegmentTranslator(modelContext);
            var root       = oDataPath.First().TranslateWith(translator);

            return(root.As <IEntitySet>());
        }
Exemplo n.º 2
0
        public INavigatable GetNavigationTarget(IModelContext modelContext, IEnumerable <ODataPathSegment> oDataPath)
        {
            if (!oDataPath.Any())
            {
                throw new ArgumentException("The path must not be empty.", nameof(oDataPath));
            }

            var translator   = new NavigatablePathSegmentTranslator(modelContext);
            var navigatables = oDataPath.Reverse().Select(segment => segment.TranslateWith(translator));

            return(navigatables.First(n => n != null));
        }