Exemplo n.º 1
0
        /* ===================================================================================== LOAD */

        /// <summary>
        /// Loads the initial data from the given <see cref="IRepositoryDataFile"/> instance.
        /// </summary>
        public static InitialData Load(IRepositoryDataFile dataFile)
        {
            InitialData initialData;

            using (var ptr = new StringReader(dataFile.PropertyTypes))
                using (var ntr = new StringReader(dataFile.NodeTypes))
                    using (var nr = new StringReader(dataFile.Nodes))
                        using (var vr = new StringReader(dataFile.Versions))
                            using (var dr = new StringReader(dataFile.DynamicData))
                                initialData = InitialData.Load(ptr, ntr, nr, vr, dr);

            initialData.ContentTypeDefinitions = dataFile.ContentTypeDefinitions;
            initialData.Blobs       = dataFile.Blobs;
            initialData.Permissions = dataFile.Permissions;

            return(initialData);
        }
Exemplo n.º 2
0
        /* ===================================================================================== LOAD */

        /// <summary>
        /// Loads the initial data from the given <see cref="IRepositoryDataFile"/> instance and the
        /// optional index documents.
        /// </summary>
        /// <param name="dataFile">Relational data.</param>
        /// <param name="initialIndexDocuments">Index documents or null.</param>
        /// <returns></returns>
        public static InitialData Load(IRepositoryDataFile dataFile, string[] initialIndexDocuments)
        {
            InitialData initialData;

            using (var ptr = new StringReader(dataFile.PropertyTypes))
                using (var ntr = new StringReader(dataFile.NodeTypes))
                    using (var nr = new StringReader(dataFile.Nodes))
                        using (var vr = new StringReader(dataFile.Versions))
                            using (var dr = new StringReader(dataFile.DynamicData))
                                initialData = InitialData.Load(ptr, ntr, nr, vr, dr);

            initialData.ContentTypeDefinitions = dataFile.ContentTypeDefinitions;
            initialData.Blobs       = dataFile.Blobs;
            initialData.Permissions = dataFile.Permissions;

            if (initialIndexDocuments != null)
            {
                initialData.IndexDocuments = initialIndexDocuments.Select(IndexDocument.Deserialize).ToArray();
            }

            return(initialData);
        }