コード例 #1
0
        public void StartListening(ListenMode listenMode)
        {
            _listenMode = listenMode;
            if (!_listenOnTables.Any())
            {
                string _schema = "*";
                if (!String.IsNullOrWhiteSpace(_connectionBuilder.GetConnection().SchemaName))
                {
                    _schema = _connectionBuilder.GetConnection().SchemaName;
                }
                string _table = "*";
                if (!String.IsNullOrWhiteSpace(_connectionBuilder.GetConnection().TableName))
                {
                    _table = _connectionBuilder.GetConnection().TableName;
                }

                _listenOnTables.Add($"{_schema}.{_table}");
            }

            var notifyName = "";

            switch (listenMode)
            {
            case ListenMode.TableEntryPrimaryKeys:
            case ListenMode.TableEntry:
                notifyName = $"XA-Notify-TableEvent_ByReference";
                break;

            default:
                throw new NotImplementedException(listenMode.ToString());
            }
            _startListening(notifyName);
        }