v2.x → v3.x
Root registration method renamed
- The root registration method was renamed from
register(resp.registerAsync) toforRoot(resp.forRootAsync) to align with the convention.
- ClsModule.register({
+ ClsModule.forRoot({
middleware: { mount: true },
}),
Namespace support dropped
Namespace injection support with forFeature was dropped entirely, and now that method is used to register Proxy Providers. If you still have a use case for namespaces, you can create a namespaced ClsService and use a custom provider to inject it.
Example:
class MyContextService extends ClsService<MyStore> {}
const myContextService = new MyContextService(new AsyncLocalStorage());
// [...]
providers: [
{
provide: MyContextService,
useValue: myContextService,
},
];