My Razor Page project implement CQRS and FluentValidation, every Command or Query needs to be added in the Program.cs class like this:
builder.Services.AddScoped<IValidator < GetPhonesQuery >, GetPhonesQueryValidator>();
Is there any way in which I create a Dictionary or something that allow me to save all the queries/commands classes and their validator class and iterating this Dictionary allow me to create a dynamic service?