public object CacheCatalog(ComposablePartCatalogCacheWriter writer)
        {
            ThrowIfDisposed();

            Requires.NotNull(writer, "writer");

            List <object> subordinateCacheTokens = new List <object>();

            foreach (ComposablePartCatalog catalog in this.Catalogs)
            {
                ICachedComposablePartCatalog cachedCatalog = catalog as ICachedComposablePartCatalog;
                if (cachedCatalog == null)
                {
                    throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, Strings.CatalogIsNotCacheable, catalog.GetType()));
                }
                object subordinateCacheToken = cachedCatalog.CacheCatalog(writer);
                subordinateCacheTokens.Add(subordinateCacheToken);
            }

            IDictionary <string, object> metadata = new Dictionary <string, object>();

            metadata.WriteEnumerable(AttributedCacheServices.CacheKeys.SubordinateTokens, subordinateCacheTokens);

            object cacheToken = writer.WriteCache(
                this.GetType(),
                null,
                metadata,
                null);

            writer.WriteRootCacheToken(cacheToken);
            return(cacheToken);
        }
        public static void CacheCatalog(ICachedComposablePartCatalog catalog, AssemblyName assemblyName, string cacheStorageDirectory)
        {
            Requires.NotNull(catalog, "catalog");
            Requires.NotNull(assemblyName, "assemblyName");
            Requires.NotNull(cacheStorageDirectory, "cacheStorageDirectory");

            ComposablePartCatalogAssemblyCacheWriter writer = new ComposablePartCatalogAssemblyCacheWriter(assemblyName, cacheStorageDirectory);
            catalog.CacheCatalog(writer);
            writer.Dispose();
        }
        public static void CacheCatalog(ICachedComposablePartCatalog catalog, AssemblyName assemblyName, string cacheStorageDirectory)
        {
            Requires.NotNull(catalog, "catalog");
            Requires.NotNull(assemblyName, "assemblyName");
            Requires.NotNull(cacheStorageDirectory, "cacheStorageDirectory");

            ComposablePartCatalogAssemblyCacheWriter writer = new ComposablePartCatalogAssemblyCacheWriter(assemblyName, cacheStorageDirectory);

            catalog.CacheCatalog(writer);
            writer.Dispose();
        }
        public static void CacheCatalog(ICachedComposablePartCatalog catalog, string assemblyPath)
        {
            Requires.NotNull(catalog, "catalog");
            Requires.NotNull(assemblyPath, "assemblyPath");

            assemblyPath = Path.GetFullPath(assemblyPath);

            AssemblyName assemblyName = new AssemblyName();
            assemblyName.Name = Path.GetFileNameWithoutExtension(assemblyPath);
            assemblyName.CodeBase = assemblyPath;

            CacheCatalog(catalog, assemblyName, Path.GetDirectoryName(assemblyPath));
        }
        public static void CacheCatalog(ICachedComposablePartCatalog catalog, string assemblyPath)
        {
            Requires.NotNull(catalog, "catalog");
            Requires.NotNull(assemblyPath, "assemblyPath");

            assemblyPath = Path.GetFullPath(assemblyPath);

            AssemblyName assemblyName = new AssemblyName();

            assemblyName.Name     = Path.GetFileNameWithoutExtension(assemblyPath);
            assemblyName.CodeBase = assemblyPath;

            CacheCatalog(catalog, assemblyName, Path.GetDirectoryName(assemblyPath));
        }
 public static bool IsCacheUpToDate(ICachedComposablePartCatalog catalog)
 {
     Requires.NotNull(catalog, "catalog");
     return(catalog.IsCacheUpToDate);
 }
 public static bool IsCacheUpToDate(ICachedComposablePartCatalog catalog)
 {
     Requires.NotNull(catalog, "catalog");
     return catalog.IsCacheUpToDate;
 }