/// <summary> /// Makes the snapshots. /// </summary> /// <param name="aggregateTypes">The aggregate types.</param> public void MakeSnapshots(IEnumerable <Type> aggregateTypes) { foreach (var item in _snaphotQuery.GetAggregatesToSnapshot(aggregateTypes)) { var aggregate = _repository.GetByID(item.Item1, item.AggregateID, AggregateRootQueryOptions.UseNullAggregates); if (aggregate != null) { _repository.MakeSnapshot(aggregate); } } }
/// <summary> /// Gets the by ID. /// </summary> /// <param name="repository">The repository.</param> /// <param name="aggregateType">Type of the aggregate.</param> /// <param name="aggregateID">The aggregate ID.</param> /// <param name="queryOptions">The query options.</param> /// <returns></returns> public static AggregateRoot GetByID(this IAggregateRootRepository repository, Type aggregateType, object aggregateID, AggregateRootQueryOptions queryOptions) { return(repository.GetByID <AggregateRoot>(aggregateID, queryOptions)); }
/// <summary> /// Gets the by ID. /// </summary> /// <param name="repository">The repository.</param> /// <param name="aggregateType">Type of the aggregate.</param> /// <param name="aggregateID">The aggregate ID.</param> /// <returns></returns> public static object GetByID(this IAggregateRootRepository repository, Type aggregateType, object aggregateID) { return(repository.GetByID <AggregateRoot>(aggregateID, 0)); }
/// <summary> /// Gets the by ID. /// </summary> /// <typeparam name="TAggregateRoot">The type of the aggregate root.</typeparam> /// <param name="repository">The repository.</param> /// <param name="aggregateID">The aggregate ID.</param> /// <returns></returns> public static TAggregateRoot GetByID <TAggregateRoot>(this IAggregateRootRepository repository, object aggregateID) where TAggregateRoot : AggregateRoot { return(repository.GetByID <TAggregateRoot>(aggregateID, 0)); }