Scenario:
I have a Blazor Server Side app with basic routing and after navigation I need to check whether current page implements particular interface. e.g.:
NavigationService.LocationChanged += (sender, args) =>
{
Type componentType = GetComponetFromLocation(args.Location);
if (!componentType.GetInterfaces().Contains(typeof(PageBase)) {
}
}
Question:
How do I get the Component Type for current or a specific url/location?
You can add an OnParametersSet method in your MainLayout component...
Also add:
@using System.Reflection;