internal SqlNotification(SqlNotificationInfo info, SqlNotificationSource source, SqlNotificationType type, string key) { _info = info; _source = source; _type = type; _key = key; }
internal void Invalidate(SqlNotificationType type, SqlNotificationInfo info, SqlNotificationSource source) { List <EventContextPair> eventList = null; lock (_eventHandlerLock) { if (_dependencyFired && SqlNotificationInfo.AlreadyChanged != info && SqlNotificationSource.Client != source) { if (ExpirationTime >= DateTime.UtcNow) { Debug.Fail("Received notification twice - we should never enter this state!"); } } else { // It is the invalidators responsibility to remove this dependency from the app domain static hash. _dependencyFired = true; eventList = _eventList; _eventList = new List <EventContextPair>(); // Since we are firing the events, null so we do not fire again. } } if (eventList != null) { foreach (EventContextPair pair in eventList) { pair.Invoke(new SqlNotificationEventArgs(type, info, source)); } } }
internal void Invalidate(SqlNotificationType type, SqlNotificationInfo info, SqlNotificationSource source) { IntPtr ptr; Bid.NotificationsScopeEnter(out ptr, "<sc.SqlDependency.Invalidate|DEP> %d#", this.ObjectID); try { List <EventContextPair> list = null; lock (this._eventHandlerLock) { if ((this._dependencyFired && (SqlNotificationInfo.AlreadyChanged != info)) && (SqlNotificationSource.Client != source)) { Bid.NotificationsTrace("<sc.SqlDependency.Invalidate|DEP|ERR> ERROR - notification received twice - we should never enter this state!"); } else { this._dependencyFired = true; list = this._eventList; this._eventList = new List <EventContextPair>(); } } if (list != null) { Bid.NotificationsTrace("<sc.SqlDependency.Invalidate|DEP> Firing events.\n"); foreach (EventContextPair pair in list) { pair.Invoke(new SqlNotificationEventArgs(type, info, source)); } } } finally { Bid.ScopeLeave(ref ptr); } }
internal SqlNotification(SqlNotificationInfo info, SqlNotificationSource source, SqlNotificationType type, string key) { this._info = info; this._source = source; this._type = type; this._key = key; }
public SqlNotificationEventArgs(SqlNotificationType type, SqlNotificationInfo info, SqlNotificationSource source) { _info = info; _source = source; _type = type; }
public SqlNotificationEventArgs(SqlNotificationType type, SqlNotificationInfo info, SqlNotificationSource source) { this.type = type; this.info = info; this.source = source; }
internal void Invalidate(SqlNotificationType type, SqlNotificationInfo info, SqlNotificationSource source) { IntPtr ptr; Bid.NotificationsScopeEnter(out ptr, "<sc.SqlDependency.Invalidate|DEP> %d#", this.ObjectID); try { List<EventContextPair> list = null; lock (this._eventHandlerLock) { if ((this._dependencyFired && (SqlNotificationInfo.AlreadyChanged != info)) && (SqlNotificationSource.Client != source)) { Bid.NotificationsTrace("<sc.SqlDependency.Invalidate|DEP|ERR> ERROR - notification received twice - we should never enter this state!"); } else { this._dependencyFired = true; list = this._eventList; this._eventList = new List<EventContextPair>(); } } if (list != null) { Bid.NotificationsTrace("<sc.SqlDependency.Invalidate|DEP> Firing events.\n"); foreach (EventContextPair pair in list) { pair.Invoke(new SqlNotificationEventArgs(type, info, source)); } } } finally { Bid.ScopeLeave(ref ptr); } }
internal void Invalidate(SqlNotificationType type, SqlNotificationInfo info, SqlNotificationSource source) { IntPtr hscp; Bid.NotificationsScopeEnter(out hscp, "<sc.SqlDependency.Invalidate|DEP> %d#", ObjectID); try { List<EventContextPair> eventList = null; lock (_eventHandlerLock) { if (_dependencyFired && SqlNotificationInfo.AlreadyChanged != info && SqlNotificationSource.Client != source) { if (ExpirationTime < DateTime.UtcNow) { // There is a small window in which SqlDependencyPerAppDomainDispatcher.TimeoutTimerCallback // raises Timeout event but before removing this event from the list. If notification is received from // server in this case, we will hit this code path. // It is safe to ignore this race condition because no event is sent to user and no leak happens. Bid.NotificationsTrace("<sc.SqlDependency.Invalidate|DEP> ignore notification received after timeout!"); } else { Debug.Assert(false, "Received notification twice - we should never enter this state!"); Bid.NotificationsTrace("<sc.SqlDependency.Invalidate|DEP|ERR> ERROR - notification received twice - we should never enter this state!"); } } else { // It is the invalidators responsibility to remove this dependency from the app domain static hash. _dependencyFired = true; eventList = _eventList; _eventList = new List<EventContextPair>(); // Since we are firing the events, null so we do not fire again. } } if (eventList != null) { Bid.NotificationsTrace("<sc.SqlDependency.Invalidate|DEP> Firing events.\n"); foreach(EventContextPair pair in eventList) { pair.Invoke(new SqlNotificationEventArgs(type, info, source)); } } } finally { Bid.ScopeLeave(ref hscp); } }
public SqlNotificationEventArgs( SqlNotificationType type, SqlNotificationInfo info, SqlNotificationSource source) { this.type = type; this.info = info; this.source = source; }