'Marten - use DI to dispose of database connections
Using Marten, I got an issue where connections were not being disposed of. I was able to fix these by manually disposing of connections. This is error-prone and I was wondering if there is a better approach.
In this post, it is recommended to:
I'd personally recommend to not do manual disposal of the DocumentSession but let the Dependency Injection container let manage it properly - so eg. use request scope registration for DocumentSession and Singleton for Document Store.
How would I configure this? Currently, the extent of my DI for Marten is to use AddMarten method.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
