/// <summary> /// Opens the specified document /// </summary> /// <param name="repo">Documents repository</param> /// <param name="path">Path to document to open</param> /// <param name="state">State of the document</param> /// <returns>Opened document</returns> public static IXDocument Open(this IXDocumentRepository repo, string path, DocumentState_e state = DocumentState_e.Default) { var doc = repo.PreCreate <IXUnknownDocument>(); doc.Path = path; doc.State = state; repo.Add(doc); return(doc.GetSpecific()); }
private static TDoc CreateAndCommitNewDocument <TDoc>(this IXDocumentRepository repo) where TDoc : class, IXDocument { var doc = repo.PreCreate <TDoc>(); repo.Add(doc); if (doc is IXUnknownDocument) { doc = (TDoc)(doc as IXUnknownDocument).GetSpecific(); } return(doc); }
public static IXDocument Open(this IXDocumentRepository repo, string path, bool silent = true, bool viewOnly = false, bool readOnly = false, bool rapid = false) { var doc = repo.PreCreate <IXUnknownDocument>(); doc.Path = path; doc.Silent = silent; doc.ViewOnly = viewOnly; doc.ReadOnly = readOnly; doc.Rapid = rapid; repo.Add(doc); return(doc.GetSpecific()); }