Example #1
0
        /// <summary>
        ///     Applies a command to an aggregate.
        /// </summary>
        /// <typeparam name="TAggregate">The type of the aggregate.</typeparam>
        /// <param name="aggregate">The aggregate.</param>
        /// <param name="command">The command.</param>
        /// <returns>The same aggregate with the command applied and any applicable updates performed.</returns>
        public static async Task <TAggregate> ApplyAsync <TAggregate>(
            this TAggregate aggregate,
            ICommand <TAggregate> command)
            where TAggregate : class
        {
            await command.ApplyToAsync(aggregate);

            return(aggregate);
        }