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

move BeforeSaveChanges before ProcessEvents #3008

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

borgez
Copy link

@borgez borgez commented Mar 2, 2024

No description provided.

@borgez
Copy link
Author

borgez commented Mar 2, 2024

#3004

@borgez
Copy link
Author

borgez commented Mar 27, 2024

@jeremydmiller everything is ok? maybe set plan to merge?

@jeremydmiller
Copy link
Member

@borgez It's a breaking change in behavior. I can't take this in. What was the purpose of this? Why did you need this?

@borgez
Copy link
Author

borgez commented Apr 2, 2024

@jeremydmiller

I want to add general data like uid, etc... to the event, and expected behavior: projections handle this changes in "inline" mode.

The current behavior doesn't seem quite as expected because the changes are applied to projections before the hook.
Maybe then add another hook for this case like BeforeApplyChanges, but it doesn't seem very good?

The test describes my case:

      public override void BeforeSaveChanges(IDocumentSession session)
      {
          var streams = session.PendingChanges.Streams();
          foreach (var stream in streams)
          {
              foreach (var e in stream.Events)
              {
                  if (e.Data is EnrichedUserEvent eueb)
                  {
                      eueb.Actor = "some user from identity";
                  }
              }
          }
      }

@jeremydmiller
Copy link
Member

@borgez We can revisit this, but you'll have to add something new or custom. We can't change the BeforeSaveChanges() before a potential Marten 8 release.

@borgez
Copy link
Author

borgez commented May 20, 2024

@jeremydmiller maybe add hook BeforeEventProcessing or BeforeEventApply?

@borgez borgez force-pushed the Move-BeforeSaveChanges-BeforeProcessEvents branch from 2304ac4 to 32ff2fa Compare May 29, 2024 14:26
@borgez
Copy link
Author

borgez commented May 29, 2024

@jeremydmiller revorked

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