Example #1
0
        private void OnWorkingFolderChanging_NoLock(PersistentStorageLocationChangingEventArgs eventArgs)
        {
            AssertIsForeground();

            StorageLocationChanging?.Invoke(this, eventArgs);

            _currentSolutionId        = eventArgs.SolutionId;
            _currentWorkingFolderPath = eventArgs.NewStorageLocation;
        }
Example #2
0
        internal void NotifyStorageLocationChanging(SolutionId sol, string path)
        {
            lock (storageMap) {
                if (storageMap.TryGetValue(sol, out string cached) && path == cached)
                {
                    return;
                }

                StorageLocationChanging?.Invoke(this, new PersistentStorageLocationChangingEventArgs(sol, path, true));
                storageMap.Remove(sol);
                storageMap.Add(sol, path);
            }
        }
        public void UpdateStorageLocation(SolutionId id, string storageLocation)
        {
            lock (_gate)
            {
                // We can get null when the solution has no corresponding file location
                // in the host process.  This is not abnormal and can come around for
                // many reasons.  In that case, we simply do not store a storage location
                // for this solution, indicating to all remote consumers that persistent
                // storage is not available for this solution.
                if (storageLocation == null)
                {
                    _idToStorageLocation.Remove(id);
                }
                else
                {
                    // Store the esent database in a different location for the out of proc server.
                    storageLocation          = Path.Combine(storageLocation, "Server");
                    _idToStorageLocation[id] = storageLocation;
                }
            }

            StorageLocationChanging?.Invoke(this, new PersistentStorageLocationChangingEventArgs(id, storageLocation, mustUseNewStorageLocationImmediately: false));
        }