コード例 #1
0
        public HttpResponseMessage Execute(TCommand command)
        {
            var connection       = Web.Configuration.CreateConnection();
            var domainRepository = new EventStoreDomainRepository(connection);
            var application      = new DomainEntry(domainRepository);

            application.ExecuteCommand(command);
            return(Request.CreateResponse(HttpStatusCode.OK));
        }
コード例 #2
0
ファイル: DomainService.cs プロジェクト: Liteolika/FSDM
        public void Start()
        {
            //IServiceBus bus = ServiceBusFactory.New(cfg =>
            //{
            //    cfg.ReceiveFrom("loopback://localhost/temp");
            //});

            //InMemoryDomainRespository repo = new InMemoryDomainRespository();

            DomainRepository repo = new DomainRepository(EventDbContext.Create("EventStore"));

            DomainEntry entry = new DomainEntry(repo);

            Guid id = Guid.NewGuid();

            entry.ExecuteCommand<CreateNetworkDevice>(new CreateNetworkDevice(id, "SESM-01"));
            entry.ExecuteCommand<SetNetworkDeviceInactive>(new SetNetworkDeviceInactive(id));
            entry.ExecuteCommand<SetNetworkDeviceActive>(new SetNetworkDeviceActive(id));

            var a = 1;

            //bus.Publish(new CreateNetworkDevice(Guid.NewGuid(), "TESTAR"));
        }
コード例 #3
0
        public void Handle(ProfileViewRegistred evt)
        {
            if (IsSocial(evt.Referrer))
            {
                var points = evt.NrOfViews == 1 ? 10 : 1;

                _domainEntry.ExecuteCommand(new RegisterUserExperience(evt.UserId, points));
            }
        }
コード例 #4
0
        public Status Post()
        {
            try
            {
                var connection       = Configuration.CreateConnection();
                var domainRepository = new EventStoreDomainRepository(connection);
                var application      = new DomainEntry(domainRepository);
                application.ExecuteCommand(Input);
            }
            catch (Exception)
            {
                return(Status.InternalServerError);
            }

            return(Status.OK);
        }
コード例 #5
0
 public Task ExecuteCommandAsync <TCommand>(TCommand command) where TCommand : ICommand
 {
     return(Task.Run(() => DomainEntry.ExecuteCommand(command)));
 }
コード例 #6
0
 public void ExecuteCommand <TCommand>(TCommand command) where TCommand : ICommand
 {
     DomainEntry.ExecuteCommand(command);
 }