You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|@chillicream/bananacakepop-graphql-ide|@chillicream/nitro-embedded|`mode: "self"` is now `mode: "embedded"`|
46
46
47
+
## Dependency injection changes
48
+
49
+
- It is no longer necessary to use the `[Service]` attribute unless you're using keyed services, in which case the attribute is used to specify the key.
50
+
- Hot Chocolate will identify services automatically.
51
+
- Support for the `[FromServices]` attribute has been removed.
52
+
- As with the `[Service]` attribute above, this attribute is no longer necessary.
53
+
- Since the `RegisterService` method is no longer required, it has been removed, along with the `ServiceKind` enum.
54
+
- Scoped services injected into query resolvers are now resolver-scoped by default (not request scoped). For mutation resolvers, services are request-scoped by default.
55
+
- The default scope can be changed in two ways:
56
+
57
+
1. Globally, using `ModifyOptions`:
58
+
59
+
```csharp
60
+
builder.Services
61
+
.AddGraphQLServer()
62
+
.ModifyOptions(o=>
63
+
{
64
+
o.DefaultQueryDependencyInjectionScope=
65
+
DependencyInjectionScope.Resolver;
66
+
o.DefaultMutationDependencyInjectionScope=
67
+
DependencyInjectionScope.Request;
68
+
});
69
+
```
70
+
71
+
2. Onaper-resolverbasis, withthe `[UseRequestScope]` or `[UseResolverScope]` attribute.
0 commit comments