-
-
Notifications
You must be signed in to change notification settings - Fork 722
/
QueryMiddlewareOptions.cs
89 lines (77 loc) · 2.29 KB
/
QueryMiddlewareOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using System;
using HotChocolate.Language;
#if ASPNETCLASSIC
using Microsoft.Owin;
using HotChocolate.AspNetClassic.Interceptors;
#else
using Microsoft.AspNetCore.Http;
using HotChocolate.AspNetCore.Interceptors;
#endif
#if ASPNETCLASSIC
namespace HotChocolate.AspNetClassic
#else
namespace HotChocolate.AspNetCore
#endif
{
public class QueryMiddlewareOptions
{
private PathString _path = new PathString("/");
private PathString _subscriptionPath = new PathString("/");
private ParserOptions _parserOptions = new ParserOptions();
[Obsolete("Use query execution options.", true)]
public int QueryCacheSize { get; set; } = 100;
public int MaxRequestSize { get; set; } = 20 * 1000 * 1000;
public ParserOptions ParserOptions
{
get => _parserOptions;
set
{
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}
_parserOptions = value;
}
}
public PathString Path
{
get => _path;
set
{
if (!value.HasValue)
{
// TODO : resources
throw new ArgumentException(
"The path cannot be empty.");
}
_path = value;
SubscriptionPath = value;
}
}
public PathString SubscriptionPath
{
get => _subscriptionPath;
set
{
if (!value.HasValue)
{
// TODO : resurces
throw new ArgumentException(
"The subscription-path cannot be empty.");
}
_subscriptionPath = value;
}
}
#if !ASPNETCLASSIC
public bool EnableSubscriptions { get; set; } = true;
#endif
[Obsolete(
"Use serviceCollection.AddSocketConnectionInterceptor()",
true)]
public OnConnectWebSocketAsync OnConnectWebSocket { get; set; }
[Obsolete(
"Use serviceCollection.AddQueryRequestInterceptor()",
true)]
public OnCreateRequestAsync OnCreateRequest { get; set; }
}
}