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)); } }
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)); } }