Yup
SIASapphire - Imagine a framework
•Created by Yup on 2/13/2024 in #sapphire-support
Any way to register a database client to the application command
Let's take this example:
It registers nice. Now let's say we register out DB client:
Now since I don't wanna create new instances everytime a command is invoked. I need a way to register this. (With type safety).
My question: How can I register the db client onto the context of the command?
Singleton class? Well, if there are no other possibilites. I'd rather just instantiate it in main and keep references to it throughout the commands where I can invoke.
4 replies