public void ShouldUpdateProductProjection() { var rootId = Guid.NewGuid(); var resolver = new MemoryResolver(); var eventBus = new MemoryEventBus(resolver); var appendOnly = new MemoryAppendOnlyStore(eventBus); var eventStore = new EventStore(appendOnly, eventBus); var view = new ProductView(); resolver.Register <ProductCreated>(view); var factory = new AggregateFactory(eventStore); var rootToSave = factory.Create <ProductCatalogAggregate>(rootId); eventStore.AppendToStream <ProductCatalogAggregate>(rootToSave.Id, 1, rootToSave.Changes, rootToSave.DomainEvents.ToArray()); var stream = eventStore.LoadEventStream(rootId); var root = new ProductCatalogAggregate(stream); root.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook", "Dell Inspiron 15000")); eventStore.AppendToStream <ProductCatalogAggregate>(root.Id, root.Version, root.Changes, root.DomainEvents.ToArray()); Assert.True(1 == view.Products.Count); Assert.Equal("Notebook", view.Products[0].Name); }
internal static async Task Main() { var redis = await ConnectionMultiplexer.ConnectAsync("localhost"); var eventStoreAggregateRepository = new RedisAggregateRepository <TodoAggregateRoot>(redis); IAggregateFactory factory = new AggregateFactory(); while (true) { Console.WriteLine("Press enter to create stuff"); Console.ReadLine(); var aggregateId = Guid.NewGuid(); var agg = factory.Create <TodoAggregateRoot>(); agg.Create(aggregateId, "My List"); agg.AddTask(Guid.NewGuid(), "get 1 egg"); agg.AddTask(Guid.NewGuid(), "get milk"); agg.AddTask(Guid.NewGuid(), "dry clothes"); agg.AddTask(Guid.NewGuid(), "solve world hunger"); await eventStoreAggregateRepository.SaveAsync(agg); var aggregate = await eventStoreAggregateRepository.GetAsync(agg.AggregateId); Console.WriteLine(JsonConvert.SerializeObject(aggregate, Formatting.Indented)); } }
static async Task Main(string[] args) { int DEFAULT_PORT = 1113; UserCredentials credentials = new UserCredentials("admin", "changeit"); var settings = ConnectionSettings.Create() .SetDefaultUserCredentials(credentials) .UseConsoleLogger() .Build(); var eventStoreConnection = EventStoreConnection.Create(settings, new IPEndPoint(IPAddress.Loopback, DEFAULT_PORT)); await eventStoreConnection.ConnectAsync(); var eventStoreAggregateRepository = new EventStoreAggregateRepository <TodoAggregateRoot>(eventStoreConnection); IAggregateFactory factory = new AggregateFactory(); var aggregateId = Guid.NewGuid(); var agg = factory.Create <TodoAggregateRoot>(); agg.Create(aggregateId, "My List"); agg.AddTask(Guid.NewGuid(), "get 1 egg"); agg.AddTask(Guid.NewGuid(), "get milk"); agg.AddTask(Guid.NewGuid(), "dry clothes"); agg.AddTask(Guid.NewGuid(), "solve world hunger"); await eventStoreAggregateRepository.SaveAsync(agg); var aggregate = await eventStoreAggregateRepository.GetAsync(agg.AggregateId); Console.WriteLine(JsonConvert.SerializeObject(aggregate, Formatting.Indented)); }
public void ShouldNotAllowCreateAggregatesWithSameId() { var queueService = new MemoryQueueService(); var appendOnly = new MemoryAppendOnlyStore(queueService); var eventStore = new EventStore(appendOnly); var rootId = Guid.NewGuid(); var factory = new AggregateFactory(eventStore); var root = factory.Create <ProductCatalogAggregate>(rootId); eventStore.AppendToStream <ProductCatalogAggregate>(root.Id, root.Version, root.Changes); Assert.Throws <DuplicatedRootException>(() => factory.Create <ProductCatalogAggregate>(rootId) ); }
public void ShouldThrowExceptionConflictEvents() { var rootId = Guid.NewGuid(); var eventBus = new MemoryEventBus(new MemoryResolver()); var appendOnly = new MemoryAppendOnlyStore(eventBus); var eventStore = new EventStore(appendOnly, eventBus); var snapShotRepo = new SnapshotRepository(); var factory = new AggregateFactory(eventStore, snapShotRepo); var productAggregate = factory.Create <ProductCatalogAggregate>(rootId); productAggregate.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook Acer Aspire 3", "Notebook Acer Aspire 3 A315-53-348W Intel Core i3-6006U RAM de 4GB HD de 1TB Tela de 15.6” HD Windows 10")); eventStore.AppendToStream <ProductCatalogAggregate>(productAggregate.Id, productAggregate.Version, productAggregate.Changes, productAggregate.DomainEvents.ToArray()); var user1 = factory.Load <ProductCatalogAggregate>(rootId); var user2 = factory.Load <ProductCatalogAggregate>(rootId); user1.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook Asus Vivobook", "Notebook Asus Vivobook X441B-CBA6A de 14 Con AMD A6-9225/4GB Ram/500GB HD/W10")); eventStore.AppendToStream <ProductCatalogAggregate>(user1.Id, user1.Version, user1.Changes, user1.DomainEvents.ToArray()); user2.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook 2 em 1 Dell", "Notebook 2 em 1 Dell Inspiron i14-5481-M11F 8ª Geração Intel Core i3 4GB 128GB SSD 14' Touch Windows 10 Office 365 McAfe")); Assert.Throws <EventStoreConcurrencyException>(() => eventStore.AppendToStream <ProductCatalogAggregate>(user2.Id, user2.Version, user2.Changes, user2.DomainEvents.ToArray()) ); }
public Result <object> When(CreateProductCatalog cmd) { while (true) { var productCatalog = _factory.Create <ProductCatalogAggregate>(cmd.Id); try { _eventStore.AppendToStream <ProductCatalogAggregate>(cmd.Id, productCatalog.Version, productCatalog.Changes); return(new Result <object>(null, new List <Exception>())); } catch (EventStoreConcurrencyException ex) { HandleConcurrencyException(ex, productCatalog); return(new Result <object>(null, new List <Exception>() { ex })); } catch (Exception) { throw; } } }
protected virtual TAggregateRoot CreateAggregate <TAggregateRoot>(Guid id) where TAggregateRoot : IAggregateRoot <TAuthenticationToken> { var aggregate = AggregateFactory.Create <TAggregateRoot>(id); return(aggregate); }
public void ShouldUpdateProductProjection() { var rootId = Guid.NewGuid(); var queueService = new MemoryQueueService(); var appendOnly = new MemoryAppendOnlyStore(queueService); var eventStore = new EventStore(appendOnly); var view = new ProductView(); queueService.Subscribe <ProductCreated>(view); var factory = new AggregateFactory(eventStore); var rootToSave = factory.Create <ProductCatalogAggregate>(rootId); eventStore.AppendToStream <ProductCatalogAggregate>(rootToSave.Id, 1, rootToSave.Changes); var stream = eventStore.LoadEventStream(rootId); var root = new ProductCatalogAggregate(stream); root.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook", "Dell Inspiron 15000")); eventStore.AppendToStream <ProductCatalogAggregate>(root.Id, root.Version, root.Changes); Assert.True(1 == view.Products.Count); Assert.Equal("Notebook", view.Products[0].Name); }
public void ShouldNotAllowCreateAggregatesWithSameId() { var eventBus = new MemoryEventBus(new MemoryResolver()); var appendOnly = new MemoryAppendOnlyStore(eventBus); var eventStore = new EventStore(appendOnly, eventBus); var rootId = Guid.NewGuid(); var factory = new AggregateFactory(eventStore); var root = factory.Create <ProductCatalogAggregate>(rootId); eventStore.AppendToStream <ProductCatalogAggregate>(root.Id, root.Version, root.Changes, root.DomainEvents.ToArray()); Assert.Throws <DuplicatedRootException>(() => factory.Create <ProductCatalogAggregate>(rootId) ); }
protected virtual TAggregateRoot LoadAggregate <TAggregateRoot>(Guid id, IList <IEvent <TAuthenticationToken> > events = null) where TAggregateRoot : IAggregateRoot <TAuthenticationToken> { var aggregate = AggregateFactory.Create <TAggregateRoot>(id); LoadAggregateHistory(aggregate, events); return(aggregate); }
public void ShouldCreateMultiplesSnapshots() { var rootId = Guid.NewGuid(); var eventBus = new MemoryEventBus(); var appendOnly = new MemoryAppendOnlyStore(eventBus); var eventStore = new EventStore(appendOnly); var snapShotRepo = new SnapshotRepository(); var factory = new AggregateFactory(eventStore, snapShotRepo); var productAggregate = factory.Create <ProductCatalogAggregate>(rootId); productAggregate.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook Acer Aspire 3", "Notebook Acer Aspire 3 A315-53-348W Intel Core i3-6006U RAM de 4GB HD de 1TB Tela de 15.6” HD Windows 10")); eventStore.AppendToStream <ProductCatalogAggregate>(productAggregate.Id, productAggregate.Version, productAggregate.Changes); var stream = eventStore.LoadEventStream(rootId); snapShotRepo.SaveSnapshot(rootId, productAggregate, stream.Version); productAggregate = factory.Load <ProductCatalogAggregate>(rootId); productAggregate.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook Asus Vivobook", "Notebook Asus Vivobook X441B-CBA6A de 14 Con AMD A6-9225/4GB Ram/500GB HD/W10")); eventStore.AppendToStream <ProductCatalogAggregate>(productAggregate.Id, productAggregate.Version, productAggregate.Changes); stream = eventStore.LoadEventStream(rootId); snapShotRepo.SaveSnapshot(rootId, productAggregate, stream.Version); productAggregate = factory.Load <ProductCatalogAggregate>(rootId); productAggregate.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook 2 em 1 Dell", "Notebook 2 em 1 Dell Inspiron i14-5481-M11F 8ª Geração Intel Core i3 4GB 128GB SSD 14' Touch Windows 10 Office 365 McAfe")); eventStore.AppendToStream <ProductCatalogAggregate>(productAggregate.Id, productAggregate.Version, productAggregate.Changes); stream = eventStore.LoadEventStream(rootId); snapShotRepo.SaveSnapshot(rootId, productAggregate, stream.Version); productAggregate = factory.Load <ProductCatalogAggregate>(rootId); productAggregate.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook Gamer Dell", "Notebook Gamer Dell G3-3590-M60P 9ª Geração Intel Core i7 8GB 512GB SSD Placa Vídeo NVIDIA 1660Ti 15.6' Windows 10")); eventStore.AppendToStream <ProductCatalogAggregate>(productAggregate.Id, productAggregate.Version, productAggregate.Changes); stream = eventStore.LoadEventStream(rootId); snapShotRepo.SaveSnapshot(rootId, productAggregate, stream.Version); productAggregate = factory.Load <ProductCatalogAggregate>(rootId); productAggregate.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook Lenovo 2 em 1 ideapad C340", "Notebook Lenovo 2 em 1 ideapad C340 i7-8565U 8GB 256GB SSD Win10 14' FHD IPS - 81RL0001BR")); eventStore.AppendToStream <ProductCatalogAggregate>(productAggregate.Id, productAggregate.Version, productAggregate.Changes); stream = eventStore.LoadEventStream(rootId); snapShotRepo.SaveSnapshot(rootId, productAggregate, stream.Version); var aggregateReloadedFromSnapshot = factory.Load <ProductCatalogAggregate>(rootId); ProductCatalogAggregate root; long snapshotVersion = 0; var snap = snapShotRepo.TryGetSnapshotById(rootId, out root, out snapshotVersion); stream = eventStore.LoadEventStreamAfterVersion(rootId, snapshotVersion); Assert.True(snap); Assert.True(root != null); Assert.True(snapshotVersion == 6); Assert.True(stream.Events.Count == 0); Assert.True(aggregateReloadedFromSnapshot.Changes.Count == 0); Assert.True(aggregateReloadedFromSnapshot.Id == rootId); Assert.True(aggregateReloadedFromSnapshot.CountProducts() == 5); }
public async Task <TEntity> GetByIdAsync(TKey id) { var streamId = GenerateStreamId(id); var streamEvents = await EventStreamReader.Read(_connection, streamId, StreamPosition.Start, 200); var domainEvents = DomainEventFactory.Create(streamEvents, _eventTypeResolver); return(AggregateFactory.Create <TEntity>(domainEvents)); }
public void ShouldAllEventsRegisteredAggregate() { var queueService = new MemoryQueueService(); var appendOnly = new MemoryAppendOnlyStore(queueService); var eventStore = new EventStore(appendOnly); var factory = new AggregateFactory(eventStore); var root = factory.Create <ProductCatalogAggregate>(Guid.NewGuid()); Assert.True(1 == root.Changes.Count); Assert.Equal(typeof(AggregateCreated <Guid>), root.Changes.ElementAt(0).GetType()); }
public void ShouldCreateAggregateWithVersionCorrectly() { var eventBus = new MemoryEventBus(new MemoryResolver()); var appendOnly = new MemoryAppendOnlyStore(eventBus); var eventStore = new EventStore(appendOnly, eventBus); var rootId = Guid.NewGuid(); var factory = new AggregateFactory(eventStore); var root = factory.Create <ProductCatalogAggregate>(rootId); Assert.True(1 == root.Version); }
public void ShouldCreateAggregateWithVersionCorrectly() { var queueService = new MemoryQueueService(); var appendOnly = new MemoryAppendOnlyStore(queueService); var eventStore = new EventStore(appendOnly); var rootId = Guid.NewGuid(); var factory = new AggregateFactory(eventStore); var root = factory.Create <ProductCatalogAggregate>(rootId); Assert.True(1 == root.Version); }
public void ShouldCreateNewAggregate() { var eventBus = new MemoryEventBus(new MemoryResolver()); var appendOnly = new MemoryAppendOnlyStore(eventBus); var eventStore = new EventStore(appendOnly, eventBus); var rootId = Guid.NewGuid(); var factory = new AggregateFactory(eventStore); var root = factory.Create <ProductCatalogAggregate>(rootId); Assert.Equal(rootId, root.Id); Assert.True(1 == root.Changes.Count); Assert.Equal(typeof(AggregateCreated <Guid>), root.Changes.ElementAt(0).GetType()); }
public void Handle(CreateBusEventRequest command) { this.ValidateCreateBusEventRequest(command); BusEventAggregate aggregate = AggregateFactory.Create <BusEventAggregate>(); aggregate.CreateEventContent(command.Key, command.Content); using (IUnitOfWork uow = this.CreateUnitOfWork <BusEventAggregate>()) { Repository.IBusEventRepository repo = IoC.Container.Resolve <Repository.IBusEventRepository>(uow); repo.Add(aggregate); uow.Commit(); aggregate.PublishEvents(); } }
public void Handle(CreateOrderRequest command) { OrderAggregate order = AggregateFactory.Create <OrderAggregate>(); order.AddCustomerDetail(command.CustomerDetail); order.AddOrderLineItems(command.OrderLines); using (IUnitOfWork uow = this.CreateUnitOfWork <OrderAggregate>()) { IOrderRepository repository = IoC.Container.Resolve <IOrderRepository>(uow); repository.Add(order); uow.Commit(); order.AddEvent(new OnOrderCreated(order.Id)); } order.PublishEvents(); }
public void ShouldSaveStream() { var rootId = Guid.NewGuid(); var queueService = new MemoryQueueService(); var appendOnly = new MemoryAppendOnlyStore(queueService); var eventStore = new EventStore(appendOnly); var factory = new AggregateFactory(eventStore); var root = factory.Create <ProductCatalogAggregate>(rootId); eventStore.AppendToStream <ProductCatalogAggregate>(root.Id, root.Version, root.Changes); var stream = eventStore.LoadEventStream(rootId); Assert.Equal(1, stream.Version); Assert.Equal(typeof(AggregateCreated <Guid>), stream.Events.ElementAt(0).GetType()); }
public void ShouldSaveStream() { var rootId = Guid.NewGuid(); var eventBus = new MemoryEventBus(new MemoryResolver()); var appendOnly = new MemoryAppendOnlyStore(eventBus); var eventStore = new EventStore(appendOnly, eventBus); var factory = new AggregateFactory(eventStore); var root = factory.Create <ProductCatalogAggregate>(rootId); eventStore.AppendToStream <ProductCatalogAggregate>(root.Id, root.Version, root.Changes, root.DomainEvents.ToArray()); var stream = eventStore.LoadEventStream(rootId); Assert.Equal(1, stream.Version); Assert.Equal(typeof(AggregateCreated <Guid>), stream.Events.ElementAt(0).GetType()); }
public void ShouldAggregateLoadStream() { var rootId = Guid.NewGuid(); var eventBus = new MemoryEventBus(new MemoryResolver()); var appendOnly = new MemoryAppendOnlyStore(eventBus); var eventStore = new EventStore(appendOnly, eventBus); var factory = new AggregateFactory(eventStore); var rootToSave = factory.Create <ProductCatalogAggregate>(rootId); eventStore.AppendToStream <ProductCatalogAggregate>(rootToSave.Id, 1, rootToSave.Changes, rootToSave.DomainEvents.ToArray()); var root = factory.Load <ProductCatalogAggregate>(rootId); Assert.True(0 == root.Changes.Count); Assert.Equal(rootId, root.Id); }
public void ShouldAggregateLoadStream() { var rootId = Guid.NewGuid(); var queueService = new MemoryQueueService(); var appendOnly = new MemoryAppendOnlyStore(queueService); var eventStore = new EventStore(appendOnly); var factory = new AggregateFactory(eventStore); var rootToSave = factory.Create <ProductCatalogAggregate>(rootId); eventStore.AppendToStream <ProductCatalogAggregate>(rootToSave.Id, 1, rootToSave.Changes); var root = factory.Load <ProductCatalogAggregate>(rootId); Assert.True(0 == root.Changes.Count); Assert.Equal(rootId, root.Id); }
public void creates_Aggregate_by_Applying_events() { //---------Load & Replay Envents var events = new List <DomainEvent> { new UserRegistered(1, "Admin", "John", "Doe"), new UserActivated(1), new UserPersonalInfoUpdated("Jack", "Doe"), }; var factory = new AggregateFactory(); var user = factory.Create <User>(events); user.IsActive.Should().BeTrue(); user.FirstName.Should().Be("Jack"); user.LastName.Should().Be("Doe"); }
/// <summary> /// Calls <see cref="IAggregateFactory.Create"/> to get a, <typeparamref name="TAggregateRoot"/> and then calls <see cref="LoadAggregateHistory{TAggregateRoot}"/>. /// </summary> /// <typeparam name="TAggregateRoot">The <see cref="Type"/> of <see cref="IAggregateRoot{TAuthenticationToken}"/>.</typeparam> /// <param name="id">The id of the <typeparamref name="TAggregateRoot"/> to create.</param> /// <param name="events"> /// A collection of <see cref="IEvent{TAuthenticationToken}"/> to replay on the retrieved <see cref="IAggregateRoot{TAuthenticationToken}"/>. /// If null, the <see cref="IEventStore{TAuthenticationToken}"/> will be used to retrieve a list of <see cref="IEvent{TAuthenticationToken}"/> for you. /// </param> protected virtual TAggregateRoot LoadAggregate <TAggregateRoot>(Guid id, IList <IEvent <TAuthenticationToken> > events = null) where TAggregateRoot : IAggregateRoot <TAuthenticationToken> { bool tryDependencyResolutionFirst; if (!ConfigurationManager.TryGetSetting(string.Format("Cqrs.AggregateFactory.TryDependencyResolutionFirst.{0}", typeof(TAggregateRoot).FullName), out tryDependencyResolutionFirst)) { if (!ConfigurationManager.TryGetSetting("Cqrs.AggregateFactory.TryDependencyResolutionFirst", out tryDependencyResolutionFirst)) { tryDependencyResolutionFirst = false; } } var aggregate = AggregateFactory.Create <TAggregateRoot>(id, tryDependencyResolutionFirst); LoadAggregateHistory(aggregate, events); return(aggregate); }
public void ShouldAddProductToProductCatalog() { var rootId = Guid.NewGuid(); var queueService = new MemoryQueueService(); var appendOnly = new MemoryAppendOnlyStore(queueService); var eventStore = new EventStore(appendOnly); var factory = new AggregateFactory(eventStore); var rootToSave = factory.Create <ProductCatalogAggregate>(rootId); eventStore.AppendToStream <ProductCatalogAggregate>(rootToSave.Id, rootToSave.Version, rootToSave.Changes); var root = factory.Load <ProductCatalogAggregate>(rootId); root.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook", "Dell Inspiron 15000")); Assert.True(root.Changes.Count == 1); Assert.True(root.Changes.ElementAt(0).GetType() == typeof(ProductCreated)); }
public void ShouldIncreaseVersionCorrectly() { var eventBus = new MemoryEventBus(new MemoryResolver()); var appendOnly = new MemoryAppendOnlyStore(eventBus); var eventStore = new EventStore(appendOnly, eventBus); var rootId = Guid.NewGuid(); var factory = new AggregateFactory(eventStore); var root = factory.Create <ProductCatalogAggregate>(rootId); eventStore.AppendToStream <ProductCatalogAggregate>(root.Id, root.Version, root.Changes, root.DomainEvents.ToArray()); root = factory.Load <ProductCatalogAggregate>(rootId); root.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook", "Dell Inspiron 15000")); root.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook Asus Vivobook", "Notebook Asus Vivobook X441B-CBA6A de 14 Con AMD A6-9225/4GB Ram/500GB HD/W10")); root.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook 2 em 1 Dell", "Notebook 2 em 1 Dell Inspiron i14-5481-M11F 8ª Geração Intel Core i3 4GB 128GB SSD 14' Touch Windows 10 Office 365 McAfe")); eventStore.AppendToStream <ProductCatalogAggregate>(root.Id, root.Version, root.Changes, root.DomainEvents.ToArray()); root = factory.Load <ProductCatalogAggregate>(rootId); Assert.True(4 == root.Version); }
public CommandEvent When(CreateProductCatalog cmd) { var productCatalog = _factory.Create <ProductCatalogAggregate>(cmd.Id); try { _eventStore.AppendToStream <ProductCatalogAggregate>(cmd.Id, productCatalog.Version, productCatalog.Changes, productCatalog.DomainEvents.ToArray()); return(new CommandEvent(OperationStatus.Success)); } catch (EventStoreConcurrencyException ex) { HandleConcurrencyException(ex, productCatalog); return(new CommandEvent(OperationStatus.Success)); } catch (Exception) { throw; } }
public void ShouldIncrementVersionCorrectly() { var rootId = Guid.NewGuid(); var queueService = new MemoryQueueService(); var appendOnly = new MemoryAppendOnlyStore(queueService); var eventStore = new EventStore(appendOnly); var factory = new AggregateFactory(eventStore); var rootToSave = factory.Create <ProductCatalogAggregate>(rootId); eventStore.AppendToStream <ProductCatalogAggregate>(rootToSave.Id, rootToSave.Version, rootToSave.Changes); var stream = eventStore.LoadEventStream(rootId); var root = new ProductCatalogAggregate(stream); root.CreateProduct(new CreateProductCommand(rootId, Guid.NewGuid(), "Notebook", "Dell Inspiron 15000")); eventStore.AppendToStream <ProductCatalogAggregate>(root.Id, root.Version, root.Changes); stream = eventStore.LoadEventStream(rootId); root = new ProductCatalogAggregate(stream); Assert.Equal(2, stream.Version); Assert.Equal(1, root.CountProducts()); }
/// <summary> /// Calls <see cref="IAggregateFactory.Create"/> to get a, <typeparamref name="TAggregateRoot"/>. /// </summary> /// <typeparam name="TAggregateRoot">The <see cref="Type"/> of <see cref="IAggregateRoot{TAuthenticationToken}"/>.</typeparam> /// <param name="id">The id of the <typeparamref name="TAggregateRoot"/> to create.</param> protected override TAggregateRoot CreateAggregate <TAggregateRoot>(Guid id) { var aggregate = AggregateFactory.Create <TAggregateRoot>(); return(aggregate); }