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

Children-relationship #55

Merged
merged 60 commits into from
Nov 8, 2021
Merged

Children-relationship #55

merged 60 commits into from
Nov 8, 2021

Conversation

einari
Copy link
Contributor

@einari einari commented Nov 8, 2021

Summary

This PR brings in the ability to have children on models based on events.
When using the C# client API you'll find it as this:

[Projection("8fdaaf0d-1291-47b7-b661-2eeba340a520")]
public class AccountsOverviewProjection : IProjectionFor<AccountsOverview>
{
    public void Define(IProjectionBuilderFor<AccountsOverview> builder)
    {
        builder
            .Children(_ => _.DebitAccounts, _ => _
                .IdentifiedBy(_ => _.Id)
                .From<DebitAccountOpened>(_ => _
                    .UsingParentKey(_ => _.Owner)
                    .Set(_ => _.Name).To(_ => _.Name)));
    }
}

You model the relationship by telling what is the property on the model that identifies every child, this is to be able to do the correct operation (Add, Remove, Update) on a child. The Event needs to have a property on it that identifies the parent object; the key. As a child relationship is considered a child projection, you have the same capabilities on a child as on a parent.

Added

  • Support for children on objects in projections.

Fixed

  • Internal restructuring for extensibility and improved maintainability across the board.

@einari einari added the minor label Nov 8, 2021
@einari einari merged commit f38818b into main Nov 8, 2021
@einari einari deleted the children-relationship branch November 8, 2021 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant