RegisterRemoteCommands
Registers remote command classes from one or more assemblies as transient services under their own concrete type, so RemoteCommandHandler can resolve one per request. Pair it with AddRemoteCommands, passing explicit assemblies when commands live outside the startup assembly. A class is discovered by inheriting RemoteCommand<T> and must declare RemoteCommandAttribute, whose name is what registration records, so a class without one throws here.
Usage
using AlmightyShogun.RemoteCommands;
builder.Services
.AddRemoteCommands(builder.Configuration)
.RegisterRemoteCommands();TIP
Each request resolves its command from its own scope, so a command may take scoped services such as a DbContext in its constructor and gets a fresh instance every time.
Parameters
assemblies: Assembly[]
The assemblies to scan, in the order they should be searched. An empty array registers nothing; the overload taking no assembly is the one that falls back to the calling assembly.
Returns
TheIServiceCollection instance with discovered remote command classes registered.Type signature
public IServiceCollection RegisterRemoteCommands();
public IServiceCollection RegisterRemoteCommands(
Assembly[] assemblies
);