mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 11:39:48 +00:00
Refactor IDisposable implementation in MSGComponentBase to improve resource management
This commit is contained in:
parent
8f2728127d
commit
18aadebfff
@ -76,20 +76,6 @@ public abstract class MSGComponentBase : ComponentBase, IDisposable, IMessageBus
|
|||||||
{
|
{
|
||||||
return Task.FromResult<TResult?>(default);
|
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)
|
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());
|
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
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user