Created
May 18, 2019 19:20
-
-
Save seangwright/4b0b3d1f4e7670194c8d76c427d83bcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// DependencyConfiguration.cs | |
/// -------------------------- | |
// ContainerBuilder builder from Autofac | |
builder.RegisterAssemblyTypes(assemblies) | |
.Where(t => t.IsClass && !t.IsAbstract && t.Name.EndsWith("RouteRegistry")) | |
.AsImplementedInterfaces(); | |
/// RouteConfig.cs | |
/// -------------- | |
public class RouteConfig | |
{ | |
public static void RegisterRoutes(RouteCollection routes, IContainer container) | |
{ | |
var routeRegistries = container | |
.Resolve<IEnumerable<IRouteRegistry>>() | |
.OrderBy(r => r.Priority); | |
foreach (var routeRegistry in routeRegistries) | |
{ | |
routeRegistry.RegisterRoutes(routes); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment