protected override ComposablePartCatalogCache ReadCacheCore(object cacheToken) { string rootStubSuffix = cacheToken as string; if (rootStubSuffix == null) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Strings.InvalidCacheToken, cacheToken), "cacheToken"); } Type stubType = ComposablePartCatalogAssemblyCacheReader.GetCacheType(this._cacheAssembly, string.Format(CultureInfo.InvariantCulture, "{0}{1}", CacheStructureConstants.CachingStubTypeNamePrefix, rootStubSuffix)); return(new ComposablePartCatalogAssemblyCache(stubType, this)); }
public ComposablePartCatalogAssemblyCacheReader(Assembly cacheAssembly) { Requires.NotNull(cacheAssembly, "cacheAssembly"); this._cacheAssembly = cacheAssembly; // read the entry point Type entryPointType = ComposablePartCatalogAssemblyCacheReader.GetCacheType(this._cacheAssembly, CacheStructureConstants.EntryPointTypeName); MethodInfo getRootStubMethod = ComposablePartCatalogAssemblyCacheReader.GetCacheTypeMethod(entryPointType, CacheStructureConstants.EntryPointGetRootStubMethodName, BindingFlags.Static | BindingFlags.Public); Func <string> getRootStub = (Func <string>)Delegate.CreateDelegate(typeof(Func <string>), getRootStubMethod); this._rootStubSuffix = getRootStub.Invoke(); }