Example #1
0
        protected void SetConnectionState(bool connected)
        {
            if (this.Connected != connected)
            {
                LogUtility.Info("数据源 {0} 状态发生变化,原连接状态= {1},新连接状态={2}。", this.DataSource.Name, this.Connected, connected);

                //
                var args = new DbSourceStateChangedEventArgs(this.DataSource.Name, connected);
                GlobalMessageBus.PublishDbSourceStateChanged(args);
            }

            //
            this.Connected = connected;
        }
Example #2
0
 /// <summary>
 /// 发布数据源状态变化消息。
 /// </summary>
 public static IMessageResponse PublishDbSourceStateChanged(DbSourceStateChangedEventArgs args, object sender = null)
 {
     return(DefaultMessageBus.Publish(DbSourceStateChangedTopic, args, sender, true));
 }