From 18aadebfffe7bc533177c8a2a58a2043f3d0fe4f Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sun, 27 Apr 2025 12:22:13 +0200 Subject: [PATCH] Refactor IDisposable implementation in MSGComponentBase to improve resource management --- .../Components/MSGComponentBase.cs | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/MindWork AI Studio/Components/MSGComponentBase.cs b/app/MindWork AI Studio/Components/MSGComponentBase.cs index a8e0fb43..739f6c68 100644 --- a/app/MindWork AI Studio/Components/MSGComponentBase.cs +++ b/app/MindWork AI Studio/Components/MSGComponentBase.cs @@ -76,20 +76,6 @@ public abstract class MSGComponentBase : ComponentBase, IDisposable, IMessageBus { return Task.FromResult(default); } - - protected virtual void DisposeResources() - { - } - - #region Implementation of IDisposable - - public void Dispose() - { - this.MessageBus.Unregister(this); - this.DisposeResources(); - } - - #endregion protected async Task SendMessage(Event triggeredEvent, T? data = default) { @@ -117,4 +103,18 @@ public abstract class MSGComponentBase : ComponentBase, IDisposable, IMessageBus this.MessageBus.ApplyFilters(this, filterComponents, eventsList.ToArray()); } + + protected virtual void DisposeResources() + { + } + + #region Implementation of IDisposable + + public void Dispose() + { + this.MessageBus.Unregister(this); + this.DisposeResources(); + } + + #endregion } \ No newline at end of file