Beispiel #1
0
        /// <inheritdoc/>
        public override bool TryMatch(ODataPathSegment pathSegment, IDictionary <string, object> values)
        {
            if (pathSegment.SegmentKind == ODataSegmentKinds.Navigation)
            {
                NavigationPathSegment navigationSegment = (NavigationPathSegment)pathSegment;
                return(navigationSegment.NavigationProperty == NavigationProperty &&
                       navigationSegment.NavigationPropertyName == NavigationPropertyName);
            }

            return(false);
        }
Beispiel #2
0
        private static void CheckNavigableProperty(ODataPath path, IEdmModel model)
        {
            Contract.Assert(path != null);
            Contract.Assert(model != null);

            foreach (ODataPathSegment segment in path.Segments)
            {
                NavigationPathSegment navigationPathSegment = segment as NavigationPathSegment;

                if (navigationPathSegment != null)
                {
                    if (EdmLibHelpers.IsNotNavigable(navigationPathSegment.NavigationProperty, model))
                    {
                        throw new ODataException(Error.Format(
                                                     SRResources.NotNavigablePropertyUsedInNavigation,
                                                     navigationPathSegment.NavigationProperty.Name));
                    }
                }
            }
        }