Esempio n. 1
0
        /// <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());
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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());
        }