Пример #1
0
        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();
                }
            }
        }
Пример #2
0
 protected virtual void OnChanged(EntityChangeEventArgs <TEntity> e)
 {
     if (Changed != null)
     {
         Changed(this, e);
     }
 }
Пример #3
0
 void _changeNotifier_Changed(object sender, EntityChangeEventArgs <TEntity> e)
 {
     base.OnChanged(e.Results);
 }