Currently I have class Context
which I inject in some places in my code, like:
protected override object GenerateSomething (object input, Context ctx)
Depending on Context, Generate
method gives different results.
But, would it be better to create interface IGeneratorContext
like this:
public interface IGeneratorContext
{
ISomething1 GetX ();
ISomething2 GetY ();
}
And change method signature to this:
protected override object GenerateSomething (object input, IGeneratorContext ctx)
And I will still pass Context object to this method. Ofcourse I wil add interface IGeneratorContext to Context class. So now I will pass same object, but as interface with less methods exposed.
Is it a good idea?