I have an application that does data processing. Exists
class Pipeline { IEnumerable<IFilter> Filters {get; set;}
I register filter implementations as
builder.RegisterType<DiversityFilter>().As<IFilter>(); builder.RegisterType<OverflowFilter>().As<IFilter>(); ...
So far so good. Now, for experimentation and fine tuning, I want to override any filter implementation in the configuration file using a program (script) that will read data from stdin, process and send data to stdout. I implemented a module with custom properties "file_name", "args" and "instead ofOf", described the module in xml and got it.
In the module I register my “ExecutableFilter”, but how do I get it to run “instead of the“ desired service ”? If I try to do it like this:
builder.RegisterType<ExecutableFilter>().As<DiversityFilter>()
then i get an exception. The type "ExecutableFilter" is not assigned to the "DiversityFilter" service. ". Well, that’s logical. But what are my options?
autofac
Vadim chekan
source share