namespace FrameworkDAL.Query.EventSub { /// /// SQL for dynamic Dapr subscription discovery. /// Queries MEVENTTYPE in the system DB so every active event type /// gets a Dapr topic subscription at runtime — no hardcoded EventTypeIds. /// Required index: MEVENTTYPE (STATUS) /// public static class DaprSubscriptionQB { /// /// Step 1: get all active tenant connections from the system DB. /// public const string GET_ALL_TENANT_CONNECTIONS = @" SELECT SERVERCONFIG1.CONNECTIONNAME AS ConnectionName FROM MSERVERCONFIG SERVERCONFIG1 JOIN MSERVER SERVER1 ON SERVERCONFIG1.SERVERID = SERVER1.SERVERID WHERE SERVERCONFIG1.STATUS = 1 AND SERVERCONFIG1.CONNECTIONNAME <> 'ACTIVITI'"; /// /// Step 2: run per tenant — returns distinct EventTypeIds that have /// at least one active MACTION row so Dapr knows which topics to subscribe to. /// public const string GET_DISTINCT_EVENT_TYPE_IDS_FROM_ACTION = "SELECT DISTINCT EVENTTYPEID FROM MACTION WHERE STATUS = 1"; } }