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

Resolve references when initializing Domain #419

Merged
merged 3 commits into from
May 16, 2024
Merged

Conversation

subhashb
Copy link
Contributor

This pull request moves resolving references, as well as validating domain constructs to domain initialization (domain.init()), not activation (domain.domain.context().push()). This ensures they happen one time, at the beginning of domain setup. If they are in activation, the resolution would be triggered every time a domain context is activated, which would be every time the domain processes a request!

This commit also has the following fixes:

  • Ensure Value Object field's class resolution works
  • All Events and Commands need to be associated with an Aggregate or a stream
  • Validation to ensure events are not associated with multiple event sourced aggregates
  • Allow Abstract events and commands to be defined without an Aggregate or a stream
  • Scope setup_db fixtures to Module level (Having them at session level
    was resulting in the wrong context being popped)
  • Move fetch_element_cls_from_registry under Domain object to avoid using current_domain
  • Pass domain during class resolution to avoid using current_domain
  • Resolve classes in Meta linkages (specifically meta_.aggregate_cls)
  • Add missing domain.init() statements in tests

subhashb added 3 commits May 15, 2024 18:17
This commit moves resolving references, as well as validating domain constructs
to domain initialization, not activation. This ensures they happen one time, at
the beginning of domain setup. If they are in activation, the resolution would
be triggered every time a domain context is activated, which would be every time
the domain processes a request!

This commit also has the following fixes:
* Ensure Value Object field's class resolution works
* All Events and Commands need to be associated with an Aggregate or a stream
* Validation to ensure events are not associated with multiple event sourced aggregates
* Allow Abstract events and commands to be defined without an Aggregate or a stream
* Scope `setup_db` fixtures to Module level (Having them at `session` level
was resulting in the wrong context being popped)
* Move `fetch_element_cls_from_registry` under Domain object to avoid using `current_domain`
* Pass `domain` during class resolution to avoid using `current_domain`
- Simplify element resolution and trigger in `init()`
- Resolve classes in Meta linkages (specifically `meta_.aggregate_cls`)
- Add missing `domain.init()` statements in tests
@subhashb subhashb self-assigned this May 16, 2024
@subhashb subhashb merged commit de0cb3f into main May 16, 2024
4 checks passed
@subhashb subhashb deleted the class-resolution-fixes branch May 16, 2024 18:35
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.

1 participant