コード例 #1
0
        public void GenerateNewGame(Guid gameId)
        {
            var  domainEventChannel = Maybe <IDomainEventChannel> .Nothing;
            Game game = (Game)gameBuilder.Create(domainEventChannel);

            gameRepository.Add(gameId, game);
        }
コード例 #2
0
        public CompositionRoot(IDomainEventChannelFactory domainEventChannelFactory,
                               IGameBuilder gameBuilder,
                               IUICommandChannelFactory commandChannelFactory,
                               IGameViewFactory gameViewFactory)
        {
            // Domain
            this.domainEventChannel = domainEventChannelFactory.Create();
            this.game = gameBuilder.Create(this.domainEventChannel);

            // View
            this.uiCommandChannel = commandChannelFactory.Create();
            this.gameView         = gameViewFactory.Create(this.uiCommandChannel);

            // Handlers
            this.fromUICommandsToDomainHandler =
                new FromUICommandsToDomainHandler(this.uiCommandChannel, this.game);

            this.fromDomainEventsToViewHandler =
                new FromDomainEventsToViewHandler(this.domainEventChannel, this.gameView);
        }