diff --git a/website/src/docs/hotchocolate/v14/migrating/migrate-from-13-to-14.md b/website/src/docs/hotchocolate/v14/migrating/migrate-from-13-to-14.md index a1baebbf195..2881e8db11f 100644 --- a/website/src/docs/hotchocolate/v14/migrating/migrate-from-13-to-14.md +++ b/website/src/docs/hotchocolate/v14/migrating/migrate-from-13-to-14.md @@ -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.