-
-
Notifications
You must be signed in to change notification settings - Fork 299
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
Rewrite DSharp plus to use Actions and Functions instead initializing classes #1712
Comments
Hey, thanks for opening up an issue! Could we get a little bit more information? This sounds like you're working with a command framework. Is this with CommandsNext or SlashCommands? Secondly, could we get a small code example of what you're currently doing and how the behavior is different from what you're expecting? |
Is this with |
Yes its connected with command next but there is no issue with the lifetime. Its an improvement of the structure of the code. |
Can you specifiy what api/internal change you would want? |
Well sorry for the delay i was just figuring out how it will happen with the command context. Here is example code leave your feedback if its possible to implement. `
|
Hi I provided an example of what I meant in my comment. Its my latest reply to Plerx2493 |
we have plans for a similar feature, albeit slightly different for technical reasons. it'll probably be tested soon-ish and published to nightly thereafter. that said, please also avoid cross-linking unrelated issues |
Sorry didn't saw the last comment and accidently linked this one. Removed my comment for your issue you can unlink it. Best regards, Rosen |
What is the problem: Now with existing logic a command module/class is initialize once and its lifetime is singleton until the application is shut down. This leads to the need to register all our services as singleton which is not wanted behavior in most scenarios.
If we use the attribute and change the command lifetime to transient each time a new command is received the module will be instantiated which is completely no sense as only the method in the class is used.
With usage of functions and actions we can pass dependencies directly to the function with any lifetime.
The text was updated successfully, but these errors were encountered: