Skip to content

Conversation

@alexeyzimarev
Copy link
Contributor

The MessageConsumeContextConverter class uses compiled expressions that are created at runtime (and cached) to convert IMessageConsumeContext to IMessageConsumeContext<T> for downstream processing in typed handlers such as projections. Although it's quite fast, this PR improves it further by generating conversion code so there's no need to use reflections.

Right now, it's only tested with sample and test projects, so some variations of syntax trees might be not handled. Therefore, the fallback is to use the reflection-based method if there's no static conversion registered. The converter will log a warning, asking to open a GitHub issue to improve the generator.

@github-actions
Copy link

github-actions bot commented Sep 26, 2025

Test Results

 30 files   30 suites   1h 1m 31s ⏱️
225 tests 225 ✅ 0 💤 0 ❌
460 runs  460 ✅ 0 💤 0 ❌

Results for commit c4710b1.

♻️ This comment has been updated with latest results.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 26, 2025

Deploying eventuous-main with  Cloudflare Pages  Cloudflare Pages

Latest commit: aea6c22
Status: ✅  Deploy successful!
Preview URL: https://bb4261a7.eventuous-main.pages.dev
Branch Preview URL: https://source-generator-for-context.eventuous-main.pages.dev

View logs

@alexeyzimarev alexeyzimarev merged commit 9c5e292 into dev Sep 27, 2025
4 checks passed
@alexeyzimarev alexeyzimarev deleted the source-generator-for-context-conversion branch September 27, 2025 11:41
alexeyzimarev added a commit that referenced this pull request Sep 27, 2025
)

* Added source generator for context conversion to avoid reflections
* Add a warning when reflections fallback is used
* Migrate to slnx
# Conflicts:
#	test/Eventuous.Sut.App/Commands.cs
alexeyzimarev added a commit that referenced this pull request Oct 1, 2025
)

* Added source generator for context conversion to avoid reflections
* Add a warning when reflections fallback is used
* Migrate to slnx
# Conflicts:
#	test/Eventuous.Sut.App/Commands.cs
alexeyzimarev added a commit that referenced this pull request Oct 1, 2025
)

* Added source generator for context conversion to avoid reflections
* Add a warning when reflections fallback is used
* Migrate to slnx
nmummau pushed a commit to nmummau/eventuous that referenced this pull request Oct 11, 2025
…ventuous#435)

* Added source generator for context conversion to avoid reflections
* Add a warning when reflections fallback is used
* Migrate to slnx
nmummau pushed a commit to nmummau/eventuous that referenced this pull request Oct 23, 2025
…ventuous#435)

* Added source generator for context conversion to avoid reflections
* Add a warning when reflections fallback is used
* Migrate to slnx
nmummau pushed a commit to nmummau/eventuous that referenced this pull request Oct 24, 2025
…ventuous#435)

* Added source generator for context conversion to avoid reflections
* Add a warning when reflections fallback is used
* Migrate to slnx
nmummau pushed a commit to nmummau/eventuous that referenced this pull request Oct 24, 2025
…ventuous#435)

* Added source generator for context conversion to avoid reflections
* Add a warning when reflections fallback is used
* Migrate to slnx
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.

2 participants