Skip to content

Refactor EventTypeRegistry for logging and faster lookups#151

Merged
cloudfy merged 2 commits intomainfrom
150-arcturuseventbus-cannot-resolve-type-to-ieventmessage-and-map-handler
Mar 11, 2026
Merged

Refactor EventTypeRegistry for logging and faster lookups#151
cloudfy merged 2 commits intomainfrom
150-arcturuseventbus-cannot-resolve-type-to-ieventmessage-and-map-handler

Conversation

@cloudfy
Copy link
Copy Markdown
Owner

@cloudfy cloudfy commented Mar 11, 2026

  • Add ILoggerFactory to EventTypeRegistry for debug logging of registrations.
  • Replace internal event registry with dictionaries for O(1) lookups.
  • Avoid redundant assembly scans by sharing initialization logic.
  • Simplify GetTypeByName/GetNameByType; remove EventTypeEntry.
  • Supplement event type/name mappings with handler-discovered types.
  • Update DI registration to inject ILoggerFactory.

Summary & Motivation

A brief description of the changes in this pull request explaining why these changes are necessary. Please delete this paragraph.

Checklist

  • I have added tests, or done manual regression tests
  • I have updated the documentation, if necessary

- Add ILoggerFactory to EventTypeRegistry for debug logging of registrations.
- Replace internal event registry with dictionaries for O(1) lookups.
- Avoid redundant assembly scans by sharing initialization logic.
- Simplify GetTypeByName/GetNameByType; remove EventTypeEntry.
- Supplement event type/name mappings with handler-discovered types.
- Update DI registration to inject ILoggerFactory.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors EventTypeRegistry to improve event type/name resolution performance and to add debug logging around type/handler registration within the EventBus core.

Changes:

  • Inject ILoggerFactory into EventTypeRegistry and add debug logs for discovered handlers and event message types.
  • Replace the previous event registry structure with name↔type dictionaries for O(1) lookups and shared initialization.
  • Update DI registration to pass ILoggerFactory when constructing EventTypeRegistry.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/Arcturus.EventBus/ServiceExtensions.cs Updates DI registration to construct EventTypeRegistry with an ILoggerFactory.
src/Arcturus.EventBus/EventTypeRegistry.cs Reworks internal storage to dictionaries and adds debug logging during registry construction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/Arcturus.EventBus/EventTypeRegistry.cs Outdated
Comment thread src/Arcturus.EventBus/EventTypeRegistry.cs Outdated
Comment thread src/Arcturus.EventBus/ServiceExtensions.cs
ILoggerFactory and ILogger<EventTypeRegistry> are now optional
dependencies in EventTypeRegistry, allowing construction without
a logger. Logging statements use structured logging instead of
string interpolation. DI registration uses GetService to make
the logger optional.
@cloudfy cloudfy merged commit 5ca7454 into main Mar 11, 2026
3 checks passed
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.

[Arcturus.EventBus] cannot resolve type to IEventMessage and map handler

2 participants