public override bool Equals(object value) { SqlDependency.IdentityUserNamePair pair = (SqlDependency.IdentityUserNamePair)value; bool flag = false; if (pair == null) { return(false); } if (this == pair) { return(true); } if (this._identity != null) { if (this._identity.Equals(pair._identity)) { flag = true; } return(flag); } if (this._userName == pair._userName) { flag = true; } return(flag); }
private void CheckNotificationStateAndAutoEnlist() { if (this.NotificationAutoEnlist && this._activeConnection.IsYukonOrNewer) { string str = SqlNotificationContext(); if (!ADP.IsEmpty(str)) { SqlDependency dependencyEntry = SqlDependencyPerAppDomainDispatcher.SingletonInstance.LookupDependencyEntry(str); if (dependencyEntry != null) { dependencyEntry.AddCommandDependency(this); } } } if ((this.Notification != null) && (this._sqlDep != null)) { if (this._sqlDep.Options == null) { SqlDependency.IdentityUserNamePair identityUser = null; SqlInternalConnectionTds innerConnection = this._activeConnection.InnerConnection as SqlInternalConnectionTds; if (innerConnection.Identity != null) { identityUser = new SqlDependency.IdentityUserNamePair(innerConnection.Identity, null); } else { identityUser = new SqlDependency.IdentityUserNamePair(null, innerConnection.ConnectionOptions.UserID); } this.Notification.Options = SqlDependency.GetDefaultComposedOptions(this._activeConnection.DataSource, this.InternalTdsConnection.ServerProvidedFailOverPartner, identityUser, this._activeConnection.Database); } this.Notification.UserData = this._sqlDep.ComputeHashAndAddToDispatcher(this); this._sqlDep.AddToServerList(this._activeConnection.DataSource); } }