/// <summary> /// Creates a branch new revision based on the revision passed in with the specified status if one is supplied. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="readWriter"></param> /// <param name="revision">The Revision in which to create a new one from</param> /// <param name="status">Default is Draft</param> /// <returns> /// Returns the newly created revision object /// </returns> public static Revision <T> AddNew <T>(this ICoreRevisionRepository <TypedEntity> readWriter, Revision <T> revision, RevisionStatusType status = null) where T : TypedEntity { if (status == null) { status = FixedStatusTypes.Draft; } var newRev = revision.CopyToNewRevision(status); readWriter.AddOrUpdate(newRev); return(newRev); }
/// <summary> /// Adds/Updates many revisions at one time /// </summary> /// <typeparam name="T"></typeparam> /// <param name="readWriter"></param> /// <param name="revisions"></param> public static void AddOrUpdate <T>(this ICoreRevisionRepository <TypedEntity> readWriter, IEnumerable <Revision <T> > revisions) where T : TypedEntity { Mandate.ParameterNotNull(revisions, "revisions"); revisions.ForEach(readWriter.AddOrUpdate); }