public void REGISTER_PROJECTIONS() { var appendStore = new FileAppendOnlyStore( @"C:\Users\wydev\Documents\GitHub\Clones\lokad-iddd-sample\DomainTests\Store\"); var eventStore = new EventStore(appendStore); var publisher = new DomainEventPublisher(eventStore,0,500); var store = new FileDocumentReaderWriter<CustomerId,CustomerTransactions>(@"C:\Users\wydev\Documents\GitHub\Clones\lokad-iddd-sample\DomainTests\Store\", new ViewStrategy(@"C:\Users\wydev\Documents\GitHub\Clones\lokad-iddd-sample\DomainTests\Views\")); IDocumentWriter<CustomerId,CustomerTransactions> writer = store; var projection = new CustomerTransactionsProjection(writer); publisher.RegisterProjection(projection); var id = new CustomerId(2); var @event = new CustomerCreated { Id = id, Name = "Microsoft", Currency = Currency.Eur }; IList<IEvent> Changes = new List<IEvent>(); Changes.Add(@event); eventStore.AppendToStream(id,0,Changes); publisher.ProcessNewEvents(); }
public static void Main() { if (File.Exists("Readme.md")) Console.WriteLine(File.ReadAllText("Readme.md")); // persistence var store = CreateFileStoreForTesting(); var events = new EventStore(store); // various domain services var pricing = new PricingService(); var server = new Server(); server.Handlers.Add(new LoggingWrapper(new CustomerApplicationService(events, pricing))); server.Dispatch(new CreateCustomer { Id = new CustomerId(12), Name = "Lokad", Currency = Currency.Eur}); server.Dispatch(new RenameCustomer { Id = new CustomerId(12), NewName = "Lokad SAS"}); server.Dispatch(new ChargeCustomer { Id = new CustomerId(12), Amount = 20m.Eur(), Name = "Forecasting"}); Console.WriteLine("Press any key to continue"); Console.ReadKey(true); }