Unsubscribe from the query controlled by this subscription handle, and call onEnded when its rows are removed from the client cache.
(Action<SubscriptionEventContext>? onEnded)
| 256 | /// and call onEnded when its rows are removed from the client cache. |
| 257 | /// </summary> |
| 258 | public void UnsubscribeThen(Action<SubscriptionEventContext>? onEnded) |
| 259 | { |
| 260 | if (state is not SubscriptionState.Active) |
| 261 | { |
| 262 | throw new Exception("Cannot unsubscribe from inactive subscription."); |
| 263 | } |
| 264 | if (this.onEnded != null) |
| 265 | { |
| 266 | throw new Exception("Unsubscribe already called."); |
| 267 | } |
| 268 | if (onEnded == null) |
| 269 | { |
| 270 | // We need to put something in there to use this as a boolean. |
| 271 | onEnded = (ctx) => { }; |
| 272 | } |
| 273 | this.onEnded = onEnded; |
| 274 | if (queryId == null) |
| 275 | { |
| 276 | Log.Warn("Unsubscribing from a query that was never submitted to the server does nothing."); |
| 277 | } |
| 278 | else |
| 279 | { |
| 280 | conn.Unsubscribe(queryId); |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | } |
no test coverage detected