static void Main(string[] args) { var services = new ServiceContext(); RouteNetworkBuilder.Run("../../../../Demo.BuildTestNetwork/Data/", services.CommandBus); ConduitBuilder.Run(services.ServiceProvider.GetService <IConduitNetworkQueryService>(), services.CommandBus); }
public DemoNetwork(IHostingEnvironment env, IDocumentStore documentStore, IMediator commandBus, IConduitClosureRepository conduitClosureRepository, IRouteNetworkState routeNetwork, IConduitNetworkQueryService conduitNetwork, IFiberNetworkQueryService fiberNetworkQueryService) { Description = "API for invoking the demo/test data builder"; Field <StringGraphType>( "rebuild", description: "Deletes the database and rebuild the demo data from the GeoJson files created using QGIS", resolve: context => { try { // First delete everything in the database documentStore.Advanced.Clean.CompletelyRemoveAll(); // Clean everything in projected in-memory read models routeNetwork.Clean(); conduitNetwork.Clean(); conduitClosureRepository.Clean(); fiberNetworkQueryService.Clean(); var iisExpressFolder = AppDomain.CurrentDomain.BaseDirectory; var pathToData = env.ContentRootPath; if (iisExpressFolder.Contains("Debug\\netcoreapp")) { pathToData = iisExpressFolder; } pathToData += Path.DirectorySeparatorChar.ToString() + "Data" + Path.DirectorySeparatorChar.ToString(); // Rebuild demo data RouteNetworkBuilder.Run(pathToData, commandBus); ConduitBuilder.Run(conduitNetwork, commandBus); EquipmentBuilder.Run(routeNetwork, conduitNetwork, commandBus); // Reload everything again routeNetwork.Clean(); conduitNetwork.Clean(); conduitClosureRepository.Clean(); fiberNetworkQueryService.Clean(); return("Read models cleaned and test data was rebuilt."); } catch (Exception ex) { context.Errors.Add(new ExecutionError(ex.Message, ex)); return("Failed"); } } ); }
public void Run() { RouteNetworkBuilder.Run(_migrationBuilder); ConduitBuilder.Run(_migrationBuilder); }