/// <summary> /// Creates a record based on the previous record created, passes in the entire object of the record that was created /// </summary> /// <typeparam name="TParent"></typeparam> /// <typeparam name="TEntity"></typeparam> /// <param name="app"></param> /// <returns></returns> public virtual IRecordService <TID> CreatedRelatedRecord <TParent, TEntity>(IRelatedRecordCreator <TParent, TEntity, TID> app) { Guard.AgainstNull(this.CreatedRecords); var res = app.CreateRecord((TParent)CreatedRecords.Last().Value); this.CreatedRecords.Add(res.Id, res.Row); return(this); }
/// <summary> /// Create a record based on the record that was previously created, passes in the ID of the Previous record that was created /// </summary> /// <typeparam name="TEntity"></typeparam> /// <param name="app"></param> /// <returns></returns> public virtual IRecordService <TID> CreateRelatedRecord <TEntity>(IRelatedRecordCreator <TEntity, TID> app) { if (this.CreatedRecords.Any()) { this.policy.Execute(() => { var res = app.CreateRecord(CreatedRecords.Last().Key); this.CreatedRecords.Add(res.Id, res.Row); }); } return(this); }