public override void Configure(IApplicationBuilder app, IRouteBuilder routes, IServiceProvider serviceProvider) { var entries = serviceProvider.GetRequiredService<IAutorouteEntries>(); var settings = serviceProvider.GetRequiredService<ShellSettings>(); var session = serviceProvider.GetRequiredService<ISession>(); var autoroutes = session.QueryIndexAsync<AutoroutePartIndex>().List().Result; entries.AddEntries(autoroutes.Select(x => new AutorouteEntry { ContentItemId = x.ContentItemId, Path = x.Path })); var autorouteRoute = new AutorouteRoute(settings.RequestUrlPrefix, entries, routes.DefaultHandler); routes.Routes.Add(autorouteRoute); }
public override void Configure(IApplicationBuilder app, IRouteBuilder routes, IServiceProvider serviceProvider) { var entries = serviceProvider.GetRequiredService <IAutorouteEntries>(); var session = serviceProvider.GetRequiredService <ISession>(); var autoroutes = session.QueryIndexAsync <AutoroutePartIndex>().Where(o => o.Published).List().GetAwaiter().GetResult(); entries.AddEntries(autoroutes.Select(x => new AutorouteEntry { ContentItemId = x.ContentItemId, Path = x.Path })); var autorouteRoute = new AutorouteRoute(entries, routes.DefaultHandler); routes.Routes.Insert(0, autorouteRoute); }