コード例 #1
0
 private OeModelBoundSettings GetSettingsOrAdd(IEdmNavigationProperty navigationProperty)
 {
     if (!_elementSettings.TryGetValue(navigationProperty, out OeModelBoundSettings settings))
     {
         _elementSettings.Add(navigationProperty, settings = new OeModelBoundSettings(navigationProperty));
     }
     return(settings);
 }
コード例 #2
0
 private OeModelBoundSettings GetSettingsOrAdd(IEdmEntityType entityType)
 {
     if (!_elementSettings.TryGetValue(entityType, out OeModelBoundSettings settings))
     {
         _elementSettings.Add(entityType, settings = new OeModelBoundSettings(entityType));
     }
     return(settings);
 }
コード例 #3
0
        private static void AddPageNextLinkSelectItems(OeModelBoundSettings settings, SelectExpandClause selectExpandClause, ref List<SelectItem>? selectItems)
        {
            if (settings != null && (settings.PageSize > 0 || settings.NavigationNextLink))
            {
                if (selectItems == null)
                    selectItems = new List<SelectItem>(selectExpandClause.SelectedItems);

                if (settings.PageSize > 0)
                    selectItems.Add(new Parsers.Translators.OePageSelectItem(settings.PageSize));

                if (settings.NavigationNextLink)
                    selectItems.Add(Parsers.Translators.OeNextLinkSelectItem.Instance);
            }
        }
コード例 #4
0
        public bool IsAllowed(OeModelBoundProvider modelBoundProvider, IEdmProperty property, OeModelBoundKind modelBoundKind)
        {
            SelectExpandType?propertySetting = GetPropertySetting(property, modelBoundKind);

            if (propertySetting != null)
            {
                return(propertySetting.Value != SelectExpandType.Disabled);
            }

            if (NavigationProperty != null)
            {
                OeModelBoundSettings entitySettings = modelBoundProvider.GetSettings((IEdmEntityType)property.DeclaringType);
                if (entitySettings != null && entitySettings.GetPropertySetting(property, modelBoundKind) == SelectExpandType.Disabled)
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #5
0
        private SelectExpandClause GetSelectItems(SelectExpandClause selectExpandClause, OeModelBoundSettings settings)
        {
            List <SelectItem> selectItems = null;
            int i = 0;

            foreach (SelectItem selectItem in selectExpandClause.SelectedItems)
            {
                if (selectItem is ExpandedNavigationSelectItem navigationSelectItem)
                {
                    ExpandedNavigationSelectItem item = Build(navigationSelectItem);
                    if (item != navigationSelectItem)
                    {
                        if (selectItems == null)
                        {
                            selectItems = new List <SelectItem>(selectExpandClause.SelectedItems);
                        }
                        selectItems[i] = item;
                    }
                }
                i++;
            }

            AddPageNextLinkSelectItems(settings, selectExpandClause, ref selectItems);
            return(selectItems == null ? selectExpandClause : new SelectExpandClause(selectItems, selectExpandClause.AllSelected));
        }