public void RemoveObject <TInterface>(TInterface instance, ObjectPath?path = null) where TInterface : notnull { var fullPath = buildFullPath(path); IProxy?removedProxy = null; syncRoot.Wait(); try { if (managedObjects.TryGetValue(fullPath, out var proxies)) { var proxy = proxies.SingleOrDefault(x => ReferenceEquals(x.Target, instance)); proxies.Remove(proxy); if (proxies.Count == 0) { managedObjects.Remove(fullPath); } removedProxy = proxy; } } finally { syncRoot.Release(); } removedProxy?.Dispose(); }
public void Dispose() { using (Logging.Facade.InfoTraceMethodCall("Dispose")) { _implementor.Dispose(); } }
internal static void Dispose(IProxy proxy) { if (proxy != null) { proxy.Dispose(); proxy = null; } }
public void Dispose() { foreach (var proxies in managedObjects) { foreach (var proxy in proxies.Value) { proxy.Dispose(); } } thisProxy.Dispose(); syncRoot.Dispose(); }
protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { _proxy.Dispose(); _repository.Dispose(); } disposedValue = true; } }
/// <summary> /// Dispose this Context. /// </summary> public void Dispose() { GenericEventHandler <IReadOnlyZetboxContext> temp = Disposing; if (temp != null) { temp(this, new GenericEventArgs <IReadOnlyZetboxContext>() { Data = this }); } lock (_lock) { if (!disposed) { proxy.Dispose(); DisposedAt = new StackTrace(true); } disposed = true; } // TODO: use correct Dispose implementation pattern GC.SuppressFinalize(this); }