private void _sqlDependency_OnChange(object sender, SqlNotificationEventArgs e) { if (_context == null) { return; } if (e.Type == SqlNotificationType.Subscribe || e.Info == SqlNotificationInfo.Error) { var args = new NotifierErrorEventArgs { Reason = e, Sql = GetCurrent().ToString() }; OnError(args); } else { var args = new EntityChangeEventArgs <TEntity> { Results = GetCurrent(), ContinueListening = true }; OnChanged(args); if (args.ContinueListening) { RegisterNotification(); } } }
protected virtual void OnError(NotifierErrorEventArgs e) { if (Error != null) { Error(this, e); } }
void _changeNotifier_Error(object sender, NotifierErrorEventArgs e) { base.OnChanged(null); }