Descendent State Class Service Registration #340
LyleStanton
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
State<> classes that descend further than child do not get registered in the call to ServiceCollectionExtensions.AddBlazorState().
So if a grandchild of State<> is required, the user of the library is has to manually register it after the call to AddBlazorState().
I'm unsure if this is by design, but I believe the line of code causing this behavior is line #146 ServiceCollectionExtensions.
"aType.BaseType.GetGenericTypeDefinition() == typeof(State<>)"
I tried to clone the repository to debug, but it didn't work "out of the box", so I haven't debugged yet.
I believe the MediatR RegisterServicesFromAssemblies correctly recognizes and registers the grand children classes.
On another note, I also started to create my own implementation of the AddBlazorState() extension, to configure the services myself. That was quickly run aground, because so many of the necessary Blazor-State classes are internal. Such as the Store class, RenderSubscriptionsPostProcessor, CloneStateBehavior, ChangeRouteHandler, ect. Which again, is maybe by design and the user is required to create their own implementation of these if they need to change the order of the Service configurations?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions