* Added "LazyInitialize" property to "HandlerDescriptor" to make post-creation operation (required for BranchingHandler)

* Tweaked "HandlersProvider" implementation to fit new HandlerDescriptor property
* Fixed "BranchingHandler"'s descriptor creation logic
This commit is contained in:
2025-07-28 03:53:13 +04:00
parent 5a93623469
commit 6a18d9765b
5 changed files with 51 additions and 37 deletions
@@ -49,6 +49,7 @@ namespace Telegrator.Hosting.Providers
if (handlerInstance is not UpdateHandlerBase updateHandler)
throw new InvalidOperationException("Failed to resolve " + descriptor.HandlerType + " as UpdateHandlerBase");
descriptor.LazyInitialization?.Invoke(updateHandler);
updateHandler.LifetimeToken.OnLifetimeEnded += _ => scope.Dispose();
return updateHandler;
}