private void KeyNoLongerDependsOn(DependentDataKey key, DependentDataKey dependency) { var dependents = _Dependents.GetOrAdd(dependency, () => new HashSet <DependentDataKey>()); assume(dependents != null); dependents.Remove(key); }
internal void EndReadScopeFor(DependentDataKey key) { var dependenciesForKey = _ReadScopes.Pop(); assume(dependenciesForKey != null); var existingDependenciesForKey = _Dependencies.GetOrAdd(key, () => new HashSet <DependentDataKey>()); assume(existingDependenciesForKey != null); foreach (var newDependency in dependenciesForKey) { if (!existingDependenciesForKey.Contains(newDependency)) { existingDependenciesForKey.Add(newDependency); KeyNowDependsOn(key, newDependency); } } foreach (var oldDependency in existingDependenciesForKey.ToList()) { if (!dependenciesForKey.Contains(oldDependency)) { existingDependenciesForKey.Remove(oldDependency); KeyNoLongerDependsOn(key, oldDependency); } } }
public void RegisterWrite(DependentDataKey key) { var dependents = _Dependents.GetValueOrDefault(key); if (dependents == null) { return; } foreach (var dependent in dependents) { _DependentData.Invalidate(dependent); } }
internal void Invalidate(DependentDataKey key) => GetMember(key).Invalidate();
private DependentDataMember GetMember(DependentDataKey key) => _MembersByKey.GetOrAdd(key, () => new DependentDataMember(key, _DependencyTracker)).NotNull();
public bool Equals(DependentDataKey other) => Type == other.Type && string.Equals(Name, other.Name);
public void RegisterRead(DependentDataKey key) { _ReadScopes.PeekOrDefault()?.Add(key); }
public DependentDataMember(DependentDataKey key, [NotNull] DependentDataDependencyTracker dependencyTracker) { _Key = key; _DependencyTracker = dependencyTracker ?? throw new ArgumentNullException(nameof(dependencyTracker)); }