Skip to content

Commit 972edb7

Browse files
Allow [EnableQuery] to override query options
1 parent ab0bb06 commit 972edb7

File tree

1 file changed

+5
-33
lines changed

1 file changed

+5
-33
lines changed

src/Common/src/Common.OData.ApiExplorer/Conventions/ODataAttributeVisitor.cs

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -83,42 +83,14 @@ private void VisitEnableQuery( IReadOnlyList<EnableQueryAttribute> attributes )
8383
{
8484
var attribute = attributes[i];
8585

86-
if ( attribute.AllowedArithmeticOperators == AllowedArithmeticOperators.None )
87-
{
88-
context.AllowedArithmeticOperators = AllowedArithmeticOperators.None;
89-
}
90-
else
91-
{
92-
context.AllowedArithmeticOperators |= attribute.AllowedArithmeticOperators;
93-
}
86+
context.AllowedArithmeticOperators = attribute.AllowedArithmeticOperators;
87+
context.AllowedFunctions = attribute.AllowedFunctions;
88+
context.AllowedLogicalOperators = attribute.AllowedLogicalOperators;
9489

95-
if ( attribute.AllowedFunctions == AllowedFunctions.None )
96-
{
97-
context.AllowedFunctions = AllowedFunctions.None;
98-
}
99-
else
100-
{
101-
context.AllowedFunctions |= attribute.AllowedFunctions;
102-
}
90+
AllowedQueryOptions = attribute.AllowedQueryOptions;
10391

104-
if ( attribute.AllowedLogicalOperators == AllowedLogicalOperators.None )
92+
if ( attribute.MaxAnyAllExpressionDepth != @default.MaxAnyAllExpressionDepth )
10593
{
106-
context.AllowedLogicalOperators = AllowedLogicalOperators.None;
107-
}
108-
else
109-
{
110-
context.AllowedLogicalOperators |= attribute.AllowedLogicalOperators;
111-
}
112-
113-
if ( attribute.AllowedQueryOptions == AllowedQueryOptions.None )
114-
{
115-
AllowedQueryOptions = AllowedQueryOptions.None;
116-
}
117-
else
118-
{
119-
AllowedQueryOptions |= attribute.AllowedQueryOptions;
120-
}
121-
12294
if ( context.MaxAnyAllExpressionDepth == @default.MaxAnyAllExpressionDepth )
12395
{
12496
context.MaxAnyAllExpressionDepth = attribute.MaxAnyAllExpressionDepth;

0 commit comments

Comments
 (0)