I have a method returning an ISomething
. I am trying to use Inversion of Control throughout my program... but I have no idea how to do it when it comes to the return value - I cannot pass it to the method, or to the object when constructing it, because this method is supposed to create the object.
The only solution I see is to pass an ISomething
factory (Func<ISomething>
) to the object when constructing it. Is this the usual / correct solution or is something else recommended?
[Edit] Weird - nobody else had this problem? I mean, there's no up- (or even down-) voting...
[Edit] More details: the method is supposed to import an IExcel into an ITable. The consensus below seems to be that I should think of this method as a converter, transforming an IExcel into an ITable, thus receiving both as arguments instead of returning the ITable value. I'll leave this up for one more day and then go with one of the responses if nothing new shows up.