private void Publish(JobView job) { using (var pipeStream = new NamedPipeClientStream("EventSourcingSample")) { pipeStream.Connect(); using (var sw = new StreamWriter(pipeStream)) { sw.AutoFlush = true; sw.WriteLine(JsonConvert.SerializeObject(job, Formatting.Indented)); } } }
public void Execute(JobCreated @event) { Printer.Print("Updating JobView in effect of JobCreated event", ConsoleColor.Magenta); var customerRepository = new MyRepository <Customer>(); var customer = customerRepository.Fetch(@event.CustomerId); var jobView = new JobView { Id = @event.JobId, CustomerName = customer.Name.ToString(), Location = @event.Location }; var jobViewRepository = new MyRepository <JobView>(); jobViewRepository.Add(jobView); Publish(jobView); }