Pipeline persistence
Once I define a pipeline, how can I persist it in a file/table and be able to reload it?
This is not built-in.
You would need to serialize/deserialize middleware types collection but this is unsafe: https://github.com/dotnet/runtime/issues/31567.
You could make it safer by reading type names from configuration store where you keep your other credentials/API keys/connection strings and validating a string against a whitelist of all known middleware type names (string[] knownMiddlewareTypeNames) before calling Type.GetType method. But you would still introduce a security antipattern to your codebase this way and someone would eventually mess it up.
Having said all this, it would be just:
Type[] middlewareTypes;
var pipeline = new Pipeline<Bitmap>(new ActivatorMiddlewareResolver());
foreach (var middlewareType in middlewareTypes)
{
pipeline.Add(middlewareType);
}
As @mariusz96 pointed out, you would have to create your own implementation for that.