csharpfritz / csharpfritz/Fritz.StreamTools

Add Commands Explicitly to ServiceCollection

Open
#391 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
153
Forks
71
PR merge metrics
No merged PRs in 30d

Description

Hello @csharpfritz .
Right now all `IBasicCommand` and `IExtendedCommand` are got via scanning Assembly and added to `IServiceCollection` with singleton lifetime.
https://github.com/csharpfritz/Fritz.StreamTools/blob/78587eb030cf08ffc479079b858b8b89d2bf7d97/Fritz.Chatbot/FritzBot.cs#L63-L80
I'm suggesting changing this behavior to adding commands explicitly in startup for two reasons :

1. In order to inject a scoped service like `DbContext`, the command needs to be scoped or transient.
2. We could prevent adding some command in startup based on configuration and prevent running a command (even `CanExecute`).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.