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

Use interfaces on publicly visible classes and structs to support dependency injection #29

Closed
scooter12 opened this issue Dec 5, 2024 · 4 comments

Comments

@scooter12
Copy link
Contributor

For instance SgfInitializationContext and SgfSourceProductionContext just to name the two I'm working around right now. Likely want to expose the original IncrementalGeneratorInitializationContext and ILogger objects as well, maybe with note that these are convenience accessors for advanced scenarios. That would allow either using the new interfaces, or just rolling your own if more convient.

scooter12 added a commit to flexpaymentsolutions/SourceGenerator.Foundations that referenced this issue Dec 5, 2024
@scooter12
Copy link
Contributor Author

Code complete but will wait to make pull req until we can catch up on the merge reqs

@ByronMayne
Copy link
Owner

I would want to hide the access to the wrapped context because if you use that you loose out on the exception handling that SGF provides. Rather then make it public we could hide it around an explicit interface cast. Some people just use api based on what comes up in intelisense. If you know about the implicit cast you must have a bit of inside knowledge .

@ByronMayne
Copy link
Owner

I think it's a good safe guard to have it exposed somehow so that if the API changes having to update SGF is not a blocker.

@scooter12
Copy link
Contributor Author

I would want to hide the access to the wrapped context because if you use that you loose out on the exception handling that SGF provides. Rather then make it public we could hide it around an explicit interface cast. Some people just use api based on what comes up in intelisense. If you know about the implicit cast you must have a bit of inside knowledge .

I compensated for that. Have a look in a few when I post that PR.

BTW, so I've been a .NET programmer since is was in alpha... And in all that time never had the need to become a git expert past my own projects and teams so if there's a methodology for these updates and fixes you prefer let me know, other I'm just going to make new branches for each unique feature and PR from those. And past that, I have no idea what I'm doing :)

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