public bool IsOrderable(OrderByClause orderByClause, OeModelBoundSettings entitySettings) { while (orderByClause != null) { var propertyNode = (SingleValuePropertyAccessNode)orderByClause.Expression; if (!IsAllowed(propertyNode.Property, entitySettings, OeModelBoundKind.OrderBy)) { return(false); } if (propertyNode.Source is SingleNavigationNode navigationNode) { do { if (!IsAllowed(navigationNode.NavigationProperty, null, OeModelBoundKind.OrderBy)) { return(false); } }while ((navigationNode = navigationNode.Source as SingleNavigationNode) != null); } orderByClause = orderByClause.ThenBy; } return(true); }
public FilterableVisitor(OeModelBoundProvider modelBoundProvider, OeModelBoundSettings settings) { _modelBoundProvider = modelBoundProvider; _settings = new Stack <OeModelBoundSettings>(); IsFilterable = true; _settings.Push(settings); }
public bool IsFilterable(FilterClause filterClause, OeModelBoundSettings settings) { if (settings != null) { var filterableVisitor = new FilterableVisitor(this, settings); filterClause.Expression.Accept(filterableVisitor); return(filterableVisitor.IsFilterable); } return(true); }
private bool PushPropertySettings(IEdmNavigationProperty navigationProperty) { OeModelBoundSettings navigationSettings = _modelBoundProvider.GetSettings(navigationProperty); if (navigationSettings == null) { return(false); } _settings.Push(navigationSettings); return(true); }
private bool IsAllowed(IEdmProperty property, OeModelBoundSettings entitySettings, OeModelBoundKind modelBoundKind) { if (entitySettings == null) { entitySettings = GetSettings((IEdmEntityType)property.DeclaringType); if (entitySettings == null) { return(true); } } return(entitySettings.IsAllowed(this, property, modelBoundKind)); }
private bool IsSelectable(ODataPath path, OeModelBoundSettings entitySettings) { IEdmProperty property; if (path.LastSegment is NavigationPropertySegment navigationPropertySegment) { property = navigationPropertySegment.NavigationProperty; } else if (path.LastSegment is PropertySegment propertySegment) { property = propertySegment.Property; } else { return(false); } return(IsAllowed(property, entitySettings, OeModelBoundKind.Select)); }
public bool IsOrderable(OrderByClause orderByClause, OeModelBoundSettings entitySettings) { while (orderByClause != null) { if (orderByClause.Expression is SingleValuePropertyAccessNode propertyNode) { if (!IsAllowed(propertyNode.Property, entitySettings, OeModelBoundKind.OrderBy)) { return(false); } if (propertyNode.Source is SingleNavigationNode navigationNode) { for (; ;) { if (!IsAllowed(navigationNode.NavigationProperty, null, OeModelBoundKind.OrderBy)) { return(false); } if (navigationNode.Source is SingleNavigationNode navigationNode2) { navigationNode = navigationNode2; } else { break; } } } } orderByClause = orderByClause.ThenBy; } return(true); }
public bool IsTop(long top, IEdmNavigationProperty navigationProperty) { OeModelBoundSettings settings = GetSettings(navigationProperty); return(top <= (settings == null || settings.MaxTop == 0 ? Int32.MaxValue : settings.MaxTop)); }
public bool IsTop(long top, IEdmEntityType entityType) { OeModelBoundSettings settings = GetSettings(entityType); return(top <= (settings == null || settings.MaxTop == 0 ? Int32.MaxValue : settings.MaxTop)); }
public bool IsNavigationNextLink(IEdmNavigationProperty navigationProperty) { OeModelBoundSettings settings = GetSettings(navigationProperty); return(settings == null ? false : settings.NavigationNextLink); }
public bool IsCountable(IEdmNavigationProperty navigationProperty) { OeModelBoundSettings settings = GetSettings(navigationProperty); return(settings == null ? true : settings.Countable); }
public bool IsCountable(IEdmEntityType entityType) { OeModelBoundSettings settings = GetSettings(entityType); return(settings == null ? true : settings.Countable); }
public int GetPageSize(IEdmNavigationProperty navigationProperty) { OeModelBoundSettings settings = GetSettings(navigationProperty); return(settings == null ? 0 : settings.PageSize); }
public int GetPageSize(IEdmEntityType entityType) { OeModelBoundSettings settings = GetSettings(entityType); return(settings == null ? 0 : settings.PageSize); }