Skip to content

Commit

Permalink
Added migration sections for Dependency Injection and Entity Framework (
Browse files Browse the repository at this point in the history
  • Loading branch information
glen-84 authored Oct 23, 2024
1 parent eb2a553 commit aa80b4a
Showing 1 changed file with 36 additions and 0 deletions.
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

0 comments on commit aa80b4a

Please sign in to comment.