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

Generate non-generic write logic with source generators #3513

Merged
merged 2 commits into from
Feb 8, 2021

Conversation

roji
Copy link
Member

@roji roji commented Feb 8, 2021

Removes a lot of ugly runtime code generation with expression trees.

I'm not completely sure if the complexity really is worth it - maybe just doing this manually everywhere makes more sense and is more maintainable (e.g. as in #3507 (review)). But this is just an opt-in mechanism which can be used where it makes sense, or the relevant code can be written manually.

Note that this doesn't cover all cases - some type handlers would have required more work to get their logic source-generated, and it didn't seem worth the effort.

Part of #2940
Part of #3300

/cc @Brar

@roji roji requested a review from vonzshik as a code owner February 8, 2021 12:16
Copy link
Contributor

@vonzshik vonzshik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks scary :D

@roji
Copy link
Member Author

roji commented Feb 8, 2021

Yep :) But I think it's actually less scary than the previous runtime code generation - whatever happens, happens at build time and you get simple, C# sources out of it. Feels better.

@roji roji enabled auto-merge (squash) February 8, 2021 12:49
@roji roji merged commit ff8b794 into npgsql:main Feb 8, 2021
@roji roji deleted the SourceGenerators branch February 8, 2021 12:55
@roji roji linked an issue Feb 10, 2021 that may be closed by this pull request
3 tasks
@roji roji mentioned this pull request Jun 3, 2021
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use source generators to get rid of (most?) runtime code generation
2 participants