Skip to content

Make WaitForIdle() methods virtual so a user can extend it's functionality#3979

Merged
rockfordlhotka merged 4 commits into
mainfrom
dev/make-waitForIdle-virtual
Jun 2, 2024
Merged

Make WaitForIdle() methods virtual so a user can extend it's functionality#3979
rockfordlhotka merged 4 commits into
mainfrom
dev/make-waitForIdle-virtual

Conversation

@StefanOssendorf

Copy link
Copy Markdown
Contributor
  • WaitForIdle() methods are now virtual
  • Reorganze WaitForIdle() methods to reduce code duplication

@rockfordlhotka
During the changes I've become unhappy with the currenty WaitForIdle() structure, because a user would now have to override two methods to get consistent behavior. The methods with TimeSpan and CancellationToken because the first throws a TimeoutException and the latter a TaskCanceledException. I understand why both implementation use different exceptions but from a user perspective it's awkward to override two methods to have consistent behavior. Any ideas?

Reorganze WaitForIdle() methods to reduce code duplication
@rockfordlhotka rockfordlhotka self-requested a review May 27, 2024 20:30
Comment thread Source/Csla/Core/BusinessBase.cs Outdated
/// Await this method to ensure business object is not busy.
/// </summary>
/// <param name="timeout">Timeout duration</param>
public virtual Task WaitForIdle(TimeSpan timeout)

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.

Is there a way to have just one virtual overload?

I've done this before, with two virtual overloads that "do the same thing" and it becomes a serious point of confusion and bugs for people who overload the method(s) over time.

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.

Yeah. I'll think about a proper solution :)

Comment thread Source/Csla/Core/BusinessBase.cs
@rockfordlhotka rockfordlhotka merged commit a6ef6c8 into main Jun 2, 2024
@rockfordlhotka rockfordlhotka deleted the dev/make-waitForIdle-virtual branch June 2, 2024 01:18
StefanOssendorf added a commit that referenced this pull request Jun 2, 2024
rockfordlhotka pushed a commit that referenced this pull request Jun 3, 2024
@github-actions

github-actions Bot commented Jun 3, 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 Jun 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants