Inheritance: IPayAsYouGoAccountRepository
Esempio n. 1
0
        public void Import_test_data_for_temporal_queries_and_projections_example_in_the_book()
        {
            using (var con = EventStoreConnection.Create(endpoint))
            {
                con.Connect();
                var es = new GetEventStore(con);
                var repo = new PayAsYouGoAccountRepository(es);

                Create5EmptyAccounts();

                SimulateCustomerActivityFor3rdJune();
                SimulateCustomerActivityFor4thJune();
                SimulateCustomerActivityFor5thJune();

                PersistAllUncommittedEvents(repo);
            }
        }
Esempio n. 2
0
        public void Run()
        {
            while(true)
            {
                foreach (var id in GetIds())
                {
                    using (var session = documentStore.OpenSession())
                    {
                        var repository = new PayAsYouGoAccountRepository(new EventStore(session));
                        var account = repository.FindBy(Guid.Parse(id));
                        var snapshot = account.GetPayAsYouGoAccountSnapshot();
                        repository.SaveSnapshot(snapshot, account);
                    }
                }

                // Create a new snapshot for each Aggregate every 12 hours
                Thread.Sleep(TimeSpan.FromHours(12));
            }
        }
Esempio n. 3
0
        public void Run()
        {
            while (true)
            {
                foreach (var id in GetIds())
                {
                    using (var session = documentStore.OpenSession())
                    {
                        var repository = new PayAsYouGoAccountRepository(new EventStore(session));
                        var account    = repository.FindBy(Guid.Parse(id));
                        var snapshot   = account.GetPayAsYouGoAccountSnapshot();
                        repository.SaveSnapshot(snapshot, account);
                    }
                }

                // Create a new snapshot for each Aggregate every 12 hours
                Thread.Sleep(TimeSpan.FromHours(12));
            }
        }
Esempio n. 4
0
 private void PersistAllUncommittedEvents(PayAsYouGoAccountRepository repo)
 {
     repo.Save(account1);
     repo.Save(account2);
     repo.Save(account3);
     repo.Save(account4);
     repo.Save(account5);
 }