public CachedProfileData(IAppSettings appSettings, IDisposable disposableLock) { Ensure.NotNull(appSettings, nameof(appSettings)); _appSettings = appSettings; _disposableLock = disposableLock; _cached = appSettings.Profiles; }
public void Dispose() { if (HasChanges) { if (_disposableLock == null) { throw new InvalidOperationException("CachedProfileData mut be locked to support data changes"); } Save(); } _appSettings = null; _disposableLock?.Dispose(); _disposableLock = null; _cached = null; }