Skip to content

Add Error event in Blazor ViewModel (#3279)#3915

Merged
rockfordlhotka merged 3 commits into
MarimerLLC:mainfrom
rrrooommmaaa:3279-error-event-blazor-viewmodel
May 6, 2024
Merged

Add Error event in Blazor ViewModel (#3279)#3915
rockfordlhotka merged 3 commits into
MarimerLLC:mainfrom
rrrooommmaaa:3279-error-event-blazor-viewmodel

Conversation

@rrrooommmaaa

Copy link
Copy Markdown
Contributor

Close #3279

await vm.SaveAsync();

// Assert
Assert.AreEqual("Inserted", TestResults.GetResult("FakePerson"));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is problem using TestResults for this test. It's probably due to multiple ConfigureAwait(false) that AsyncLocal is sometimes addressed from different execution contexts.
I'd wire a dedicated variable in the test and a handler to update variable.
Thoughts?

Comment thread Source/Csla.Blazor/ViewModel.cs Outdated
HookChangedEvents(Model);
IsBusy = false;
if (Exception != null)
Error?.Invoke();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the event should provide the exception to the handler as a parameter.

I know the value is a property on the viewmodel, but it would be simpler for the person writing the event handler to just get the exception directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@rockfordlhotka rockfordlhotka added the pr/NeedContributorAgreement Need contributor agreement label May 5, 2024
@rockfordlhotka

Copy link
Copy Markdown
Member

@rrrooommmaaa thank you for the updates to the PR. We do still need your contributor agreement.

https://github.com/MarimerLLC/csla/blob/main/CONTRIBUTING.md

@rrrooommmaaa rrrooommmaaa marked this pull request as ready for review May 6, 2024 13:06
@rrrooommmaaa

Copy link
Copy Markdown
Contributor Author

@rockfordlhotka rockfordlhotka removed the pr/NeedContributorAgreement Need contributor agreement label May 6, 2024
@rockfordlhotka rockfordlhotka merged commit db84ef0 into MarimerLLC:main May 6, 2024
@github-actions

github-actions Bot commented May 7, 2025

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an OnError Event to the Blazor ViewModel

2 participants