Class ObservableQueryHandler
- Namespace
- Cratis.Applications.Queries
- Assembly
- Cratis.Applications.dll
Represents an implementation of IObservableQueryHandler.
[Singleton]
public class ObservableQueryHandler : IObservableQueryHandler- Inheritance
- 
      
      ObservableQueryHandler
- Implements
- Inherited Members
- Extension Methods
Remarks
Initializes a new instance of the ObservableQueryHandler class.
Constructors
ObservableQueryHandler(IQueryContextManager, IOptions<JsonOptions>, ILogger<ObservableQueryHandler>)
Represents an implementation of IObservableQueryHandler.
public ObservableQueryHandler(IQueryContextManager queryContextManager, IOptions<JsonOptions> options, ILogger<ObservableQueryHandler> logger)Parameters
- queryContextManagerIQueryContextManager
- optionsIOptions<JsonOptions>
- loggerILogger<ObservableQueryHandler>
- ILogger for logging. 
Remarks
Initializes a new instance of the ObservableQueryHandler class.
Methods
HandleStreamingResult(HttpContext, QueryName, object, QueryContext)
Handles a streaming query result for WebSocket connections in minimal API endpoints.
public Task HandleStreamingResult(HttpContext httpContext, QueryName queryName, object streamingData, QueryContext queryContext)Parameters
- httpContextHttpContext
- The HttpContext for the request. 
- queryNameQueryName
- The name of the query being executed. 
- streamingDataobject
- The streaming data (Subject or AsyncEnumerable). 
- queryContextQueryContext
- The query context. 
Returns
HandleStreamingResult(ActionExecutingContext, ActionExecutedContext?, ObjectResult)
Handles a streaming query result for WebSocket connections in controller actions.
public Task HandleStreamingResult(ActionExecutingContext context, ActionExecutedContext? actionExecutedContext, ObjectResult objectResult)Parameters
- contextActionExecutingContext
- actionExecutedContextActionExecutedContext
- The ActionExecutedContext from the action execution. 
- objectResultObjectResult
- The ObjectResult containing the streaming data. 
Returns
IsStreamingResult(object?)
Determines if the given data is a streaming result that can be handled via WebSocket.
public bool IsStreamingResult(object? data)Parameters
- dataobject
- The data to check. 
Returns
- bool
- True if the data is a streaming result, false otherwise. 
ShouldHandleAsWebSocket(HttpContext)
Determines if the current request should be handled as a WebSocket connection.
public bool ShouldHandleAsWebSocket(HttpContext httpContext)Parameters
- httpContextHttpContext
- The HttpContext. 
Returns
- bool
- True if the request should be handled as WebSocket, false otherwise. 
ShouldHandleAsWebSocket(ActionExecutingContext)
Determines if the current request should be handled as a WebSocket connection.
public bool ShouldHandleAsWebSocket(ActionExecutingContext context)Parameters
- contextActionExecutingContext
Returns
- bool
- True if the request should be handled as WebSocket, false otherwise.