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)); }
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")); }
public void Handle(ProfileViewRegistred evt) { if (IsSocial(evt.Referrer)) { var points = evt.NrOfViews == 1 ? 10 : 1; _domainEntry.ExecuteCommand(new RegisterUserExperience(evt.UserId, points)); } }
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); }
public Task ExecuteCommandAsync <TCommand>(TCommand command) where TCommand : ICommand { return(Task.Run(() => DomainEntry.ExecuteCommand(command))); }
public void ExecuteCommand <TCommand>(TCommand command) where TCommand : ICommand { DomainEntry.ExecuteCommand(command); }