❔ Creating a "Lazy" Factory with a Fluent API
I'm looking to create a kind of factory, which creates commands instead of the actual results. The results are then conditionally returned upon a call to the factory's
Assume these result objects;
These objects are all "created" differently (as in, they have different constructor parameters), meaning the factory must also have
But unfortunately, that's not it. All implementations of
This means that the factory needs some way to create a parent which then has at least 1 or more children.
I also want to modify some of the objects' properties fluently;
Potential implementations I've considered use a setup such as this;
Run() or Execute() method. The reason for the "laziness" of the factory is that executing one of these commands may fail (TryExecute()). This command is then skipped (the failure may be logged) and tried again later, at which point it may no longer fail.Assume these result objects;
These objects are all "created" differently (as in, they have different constructor parameters), meaning the factory must also have
MakeFoo<T>, MakeBar<T>, and MakeQux.But unfortunately, that's not it. All implementations of
FooBase take an instance of IFoo as a sort-of parent. This can be nested infinitely. Let's assume something like this;This means that the factory needs some way to create a parent which then has at least 1 or more children.
I also want to modify some of the objects' properties fluently;
Potential implementations I've considered use a setup such as this;
