Exemple #1
0
        public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
        {
            if (workspaceServices.Workspace.Kind != WorkspaceKind.Host)
            {
                return(new ProjectCacheService(workspaceServices.Workspace));
            }

            var service = new ProjectCacheService(
                workspaceServices.Workspace,
                ImplicitCacheTimeoutInMS
                );

            // Also clear the cache when the solution is cleared or removed.
            workspaceServices.Workspace.WorkspaceChanged += (s, e) =>
            {
                if (
                    e.Kind == WorkspaceChangeKind.SolutionCleared ||
                    e.Kind == WorkspaceChangeKind.SolutionRemoved
                    )
                {
                    service.ClearImplicitCache();
                }
            };

            return(service);
        }
Exemple #2
0
            public void Clear()
            {
                lock (_guard)
                {
                    // clear most recent cache
                    ClearMostRecentCache_NoLock();

                    // clear implicit cache
                    _projectCacheService.ClearImplicitCache();
                }
            }
        private static IWorkspaceService GetMiscProjectCache(HostWorkspaceServices workspaceServices)
        {
            var projectCacheService = new ProjectCacheService(workspaceServices.Workspace, ImplicitCacheTimeoutInMS);

            // Also clear the cache when the solution is cleared or removed.
            workspaceServices.Workspace.WorkspaceChanged += (s, e) =>
            {
                if (e.Kind == WorkspaceChangeKind.SolutionCleared || e.Kind == WorkspaceChangeKind.SolutionRemoved)
                {
                    projectCacheService.ClearImplicitCache();
                }
            };

            return(projectCacheService);
        }