-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Request-scoped transaction is better served by NestJS Injection Scoping #2
Comments
Not really, there were some issues with that, iirc it was something with JWT middleware not supporting the nest di request scope. But we could have that available optionally, agreed it would be cleaner. Btw it is now possible to disable the automatic request scope middleware registration. |
I have been using a modified provider of the EnitityManager token and it's working fine for me (disabled the request context option):
I could create a PR with this change for you to test it (altough it's an easy fix)? |
The thing is that the native request scope from nest does not work with things like their JWT service. This is the issue I am talking about: This is for me the main reason why to prefer the So again, I am fine with supporting this optionally, feel free to send a PR, but it needs to be configurable, and I would keep the |
See my comment here why I prefer using this over RequestContext: mikro-orm/mikro-orm#315 (comment). Angular's zone.js and with this approach of getting the repositories you can't really use the Zone'js solution that easy either. Alright, will create a PR in a bit. |
nestjs/src/mikro-orm.middleware.ts
Lines 4 to 13 in d24dd06
It seems like this would be better served using a request-based injection-scope as described here (https://docs.nestjs.com/fundamentals/injection-scopes) and using that for the middleware.
I can prototype something up, too.
The text was updated successfully, but these errors were encountered: