示例#1
0
        public MultiConduitInfoProjection(IRouteNetworkState routeNetworkQueryService, IConduitNetworkQueryService conduitNetworkQueryService)
        {
            this.routeNetworkQueryService   = routeNetworkQueryService;
            this.conduitNetworkQueryService = (ConduitNetworkQueryService)conduitNetworkQueryService;

            ProjectEvent <MultiConduitPlaced>(OnMultiConduitPlaced);
            ProjectEvent <MultiConduitOuterConduitCut>(OuterConduitCut);
        }
示例#2
0
        public SingleConduitInfoProjection(IRouteNetworkState routeNetworkQueryService, IConduitNetworkQueryService conduitNetworkQueryService)
        {
            this.routeNetworkQueryService   = routeNetworkQueryService;
            this.conduitNetworkQueryService = (ConduitNetworkQueryService)conduitNetworkQueryService;


            // New single conduits
            ProjectEvent <SingleConduitPlaced>(
                (session, singleConduitPlaced) =>
            {
                return(singleConduitPlaced.SingleConduitId);
            },
                SingleConduitPlaced);

            // Single conduits connected
            ProjectEvent <SingleConduitConnected>(
                (session, singleConduitConnected) =>
            {
                return(singleConduitConnected.SingleConduitId);
            },
                SingleConduitConnected);


            // We also want to update single conduit info when a inner conduit of a multi conduit is added
            ProjectEvent <MultiConduitInnerConduitAdded>(
                (session, innerConduitAdded) =>
            {
                return(innerConduitAdded.ConduitInfo.Id);
            },
                InnerConduitAdded);


            // We also want to update the single conduit info when a inner conduit of a multi conduit is cut
            ProjectEvent <MultiConduitInnerConduitCut>(
                (session, innerConduitAdded) =>
            {
                // To get to the right single conduit, we need look it up through the multi conduit
                var mutltiConduitInfo = this.conduitNetworkQueryService.GetMultiConduitInfo(innerConduitAdded.MultiConduitId);
                return(mutltiConduitInfo.Children.OfType <ConduitInfo>().Single(c => c.SequenceNumber == innerConduitAdded.InnerConduitSequenceNumber).Id);
            },
                InnerConduitCut);


            // We also want to update the single conduit info when a inner conduit of a multi conduit is connected
            ProjectEvent <MultiConduitInnerConduitConnected>(
                (session, innerConduitConnected) =>
            {
                // To get to the right single conduit, we need look it up through the multi conduit
                var mutltiConduitInfo = this.conduitNetworkQueryService.GetMultiConduitInfo(innerConduitConnected.MultiConduitId);
                return(mutltiConduitInfo.Children.OfType <ConduitInfo>().Single(c => c.SequenceNumber == innerConduitConnected.InnerConduitSequenceNumber).Id);
            },
                InnerConduitConnected);
        }
示例#3
0
 public ConduitCutHandler(IRouteNetworkState routeNetworkQueryService, IConduitNetworkQueryService conduitNetworkQueryService)
 {
     this.routeNetworkQueryService   = routeNetworkQueryService;
     this.conduitNetworkQueryService = (ConduitNetworkQueryService)conduitNetworkQueryService;
 }