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(); } } }
public TableListener Notifications(NotificationSharedBy sharedBy = NotificationSharedBy.Schema) => _onNotification ?? (_onNotification = DMLTriggerManager.GetTiggerListener(this, sharedBy));
public new TypedTableListener <T> Notifications(NotificationSharedBy sharedBy = NotificationSharedBy.Schema) => _onNotification ?? (_onNotification = DMLTriggerManager.GetTypedTiggerListener <T>(this, sharedBy));