Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Generalize Factory Class Method Signatures #2270

Open
develop-gby opened this issue Jun 21, 2024 · 1 comment
Open

[Feature Request] Generalize Factory Class Method Signatures #2270

develop-gby opened this issue Jun 21, 2024 · 1 comment
Labels

Comments

@develop-gby
Copy link

develop-gby commented Jun 21, 2024

Is your feature request related to a problem? Please describe.

I am referring to the following file Factory.cs.
I would like to understand if there is a particular reason why the concrete type CsvConfiguration is present in the signatures of the methods of this class.

Describe the solution you'd like

Couldn't the concrete type be replaced by the reference interface?
For example, The following method could become

//NOW
public virtual IParser CreateParser(TextReader reader, Configuration.CsvConfiguration configuration)
{
    return new CsvParser(reader, configuration);
}
//AFTER
public virtual IParser CreateParser(TextReader reader, IParserConfiguration configuration)
{
    return new CsvParser(reader, configuration);
}

I make this request in order to improve the use of this class and enable a more effective dependency injection.

@jzabroski
Copy link

This makes sense, in that the context for a CsvParser is reading and not writing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants