mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 02:18:00 +00:00
Refactor IDisposable implementation in MSGComponentBase to improve resource management
This commit is contained in:
1 file changed
+14
-14
@@ -76,20 +76,6 @@ public abstract class MSGComponentBase : ComponentBase, IDisposable, IMessageBus
|
||||
{
|
||||
return Task.FromResult<TResult?>(default);
|
||||
}
|
||||
|
||||
protected virtual void DisposeResources()
|
||||
{
|
||||
}
|
||||
|
||||
#region Implementation of IDisposable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.MessageBus.Unregister(this);
|
||||
this.DisposeResources();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected async Task SendMessage<T>(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
|
||||
}
|
||||
Reference in new issue
Block a user