public virtual void Delete() { DebugLogger.LogInfo(ADSession._debugCategory, string.Concat("Delete: ref count = ", this._referenceCount)); if (0 >= this.Release()) { lock (ADSession._sessionCache) { if (0 < this.ReferenceCount) { return; } else { ADSession._sessionCache.DeleteEntry(this._info); } } DebugLogger.LogInfo(ADSession._debugCategory, "Delete: ref count is 0, destroying object"); IADSession aDSession = this._storeAccess as IADSession; if (aDSession != null) { lock (this._handleLock) { if (this._handle != null) { aDSession.Delete(this._handle); this._handle = null; this._deleted = true; } } } } }
internal bool MatchConnectionOptions(ADSessionInfo info) { if (info.ServerNameOnly != null) { IADSession aDSession = this._storeAccess as IADSession; string option = (string)aDSession.GetOption(this._handle, 48); if (info.ServerNameOnly.Equals(option, StringComparison.OrdinalIgnoreCase) && info.EffectivePortNumber == this.SessionInfo.EffectivePortNumber) { return(ADSessionInfo.MatchConnectionState(this._info, info, true)); } } return(ADSessionInfo.MatchConnectionState(this._info, info, false)); }
private bool Create() { lock (this._handleLock) { if (this._handle == null && !this._deleted) { IADSession aDSession = this._storeAccess as IADSession; this._handle = aDSession.Create(this._info); } } if (this._handle != null) { return(true); } else { return(false); } }