private static void RegisterRoutes(IServiceProvider serviceProvider, ErpOptions options) { var appAssembly = Assembly.GetExecutingAssembly(); var routeManager = serviceProvider.GetRequiredService <RouteManager>(); routeManager.RegisterRoutesInAssembly(appAssembly, options.AreaName); }
private static void RegisterLayout(IServiceProvider serviceProvider, ErpOptions options) { if (options.Layout != null) { var layoutProvider = serviceProvider.GetRequiredService <ILayoutProvider>(); var appAssembly = Assembly.GetExecutingAssembly(); var pageComponentTypes = appAssembly .ExportedTypes .Where(t => t.Namespace != null && (t.IsSubclassOf(typeof(ComponentBase)) && t.Namespace.Contains(".Pages"))); foreach (var pageType in pageComponentTypes) { if (pageType.FullName == null) { continue; } layoutProvider.Register(pageType.FullName, options.Layout); } } }