Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added migration sections for Dependency Injection and Entity Framework #7634

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,42 @@ Things that have been removed or had a change in behavior that may cause your co
| @chillicream/bananacakepop-express-middleware | @chillicream/nitro-express-middleware | |
| @chillicream/bananacakepop-graphql-ide | @chillicream/nitro-embedded | `mode: "self"` is now `mode: "embedded"` |

## Dependency injection changes

- 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.
- Hot Chocolate will identify services automatically.
- Support for the `[FromServices]` attribute has been removed.
- As with the `[Service]` attribute above, this attribute is no longer necessary.
- Since the `RegisterService` method is no longer required, it has been removed, along with the `ServiceKind` enum.
- Scoped services injected into query resolvers are now resolver-scoped by default (not request scoped). For mutation resolvers, services are request-scoped by default.
- The default scope can be changed in two ways:

1. Globally, using `ModifyOptions`:

```csharp
builder.Services
.AddGraphQLServer()
.ModifyOptions(o =>
{
o.DefaultQueryDependencyInjectionScope =
DependencyInjectionScope.Resolver;
o.DefaultMutationDependencyInjectionScope =
DependencyInjectionScope.Request;
});
```

2. On a per-resolver basis, with the `[UseRequestScope]` or `[UseResolverScope]` attribute.
- Note: The `[UseServiceScope]` attribute has been removed.

For more information, see the [Dependency Injection](/docs/hotchocolate/v14/server/dependency-injection) documentation.

## Entity framework integration changes

- The `RegisterDbContext` method is no longer required, and has therefore been removed, along with the `DbContextKind` enum.
- Use `RegisterDbContextFactory` to register a DbContext factory.

For more information, see the [Entity Framework integration](/docs/hotchocolate/v14/integrations/entity-framework) documentation.

## New GID format

This release introduces a more performant GID serializer, which also simplifies the underlying format of globally unique IDs.
Expand Down
Loading