Пример #1
0
        public IRecordService <TID> ExecuteAction(IExecutableAction <TID> implementation, bool executeAgainstAggregate = false)
        {
            this.policy.Execute(() =>
            {
                if (executeAgainstAggregate)
                {
                    implementation.Execute(AggregateId);
                }
                else
                {
                    if (!CreatedRecords.Any())
                    {
                        throw new ArgumentException("You must create records before executing an action against them");
                    }
                    implementation.Execute(CreatedRecords.Last().Key);
                }
            });

            return(this);
        }
 /// <summary>
 /// Execute Action against the id of the last created record
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="implementation"></param>
 /// <returns></returns>
 public IRecordService <TID> ExecuteAction <T>(IExecutableAction <T, TID> implementation)
 {
     implementation.Execute(CreatedRecords.Last().Key);
     return(this);
 }