Ejemplo n.º 1
0
        public void SetupDatabase()
        {
            VirtualFileSystem.CreateDirectory(VirtualFileSystem.ApplicationDatabasePath);
            var databaseFileProvider = new DatabaseFileProvider(ContentIndexMap.NewTool(VirtualFileSystem.ApplicationDatabaseIndexName), new ObjectDatabase(VirtualFileSystem.ApplicationDatabasePath, VirtualFileSystem.ApplicationDatabaseIndexName));

            ContentManager.GetFileProvider = () => databaseFileProvider;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Write the generated objects into the index map file.
        /// </summary>
        /// <param name="mergeWithCurrentIndexFile">Indicate if old values must be deleted or merged</param>
        public void WriteIndexFile(bool mergeWithCurrentIndexFile)
        {
            if (!mergeWithCurrentIndexFile)
            {
                VirtualFileSystem.FileDelete(IndexFileFullPath);
            }

            using (var indexFile = ContentIndexMap.NewTool(indexName))
            {
                // Filter database Location
                indexFile.AddValues(
                    Root.OutputObjects.Where(x => x.Key.Type == UrlType.ContentLink)
                    .Select(x => new KeyValuePair <string, ObjectId>(x.Key.Path, x.Value.ObjectId)));

                foreach (var x in Root.OutputObjects)
                {
                    if (x.Key.Type != UrlType.ContentLink)
                    {
                        continue;
                    }

                    if (x.Value.Tags.Contains(DoNotCompressTag))
                    {
                        DisableCompressionIds.Add(x.Value.ObjectId);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private IDatabaseFileProviderService CreateDatabaseProvider()
 {
     VirtualFileSystem.CreateDirectory(VirtualFileSystem.ApplicationDatabasePath);
     return(new DatabaseFileProviderService(new DatabaseFileProvider(ContentIndexMap.NewTool(VirtualFileSystem.ApplicationDatabaseIndexName), new ObjectDatabase(VirtualFileSystem.ApplicationDatabasePath, VirtualFileSystem.ApplicationDatabaseIndexName))));
 }