Esempio n. 1
0
        internal static TableListener GetTiggerListener(ITable table, NotificationSharedBy sharedBy)
        {
            switch (sharedBy)
            {
            case NotificationSharedBy.Schema:
            {
                var key      = $"{BuildSchemaKey(table.GetConnectionString())}";
                var listener = _listeners.GetOrAdd(key, s => new DMLTriggerListener(table.GetSchema()));
                return(new TableListener(listener, table));
            }

            case NotificationSharedBy.Table:
            {
                var listener = _listeners.GetOrAdd($"{BuildTableKey(table.GetConnectionString())}", s => new DMLTriggerListener(table.GetSchema()));
                return(new TableListener(listener, table));
            }

            case NotificationSharedBy.None:
            {
                return(new TableListener(new DMLTriggerListener(table.GetSchema()), table));
            }

            default:
            {
                throw new NotImplementedException();
            }
            }
        }
Esempio n. 2
0
 public TableListener Notifications(NotificationSharedBy sharedBy = NotificationSharedBy.Schema) => _onNotification ?? (_onNotification = DMLTriggerManager.GetTiggerListener(this, sharedBy));
Esempio n. 3
0
 public new TypedTableListener <T> Notifications(NotificationSharedBy sharedBy = NotificationSharedBy.Schema) => _onNotification ?? (_onNotification = DMLTriggerManager.GetTypedTiggerListener <T>(this, sharedBy));