Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions main/src/ReCode.Cocoon.Proxy/Proxy/BlazorRouteDiscovery.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Components;

namespace ReCode.Cocoon.Proxy.Proxy
{
Expand All @@ -14,11 +15,15 @@ public static IEnumerable<string> FindRoutes(Type type)
{
if (exportedType.BaseType?.Name == "ComponentBase")
{
var routeAttribute = exportedType
.GetCustomAttribute(typeof(RouteAttribute))
as RouteAttribute;
if (routeAttribute is null) continue;
yield return routeAttribute.Template;
// fix #31 - support multiple routeAttribute values
var routeAttributes = exportedType.GetCustomAttributes(typeof(RouteAttribute))
.Select(a => a as RouteAttribute);
if (!routeAttributes.Any()) continue;
foreach (var routeAttribute in routeAttributes)
{
if (routeAttribute != null)
yield return routeAttribute.Template;
}
}
}
}
Expand Down