Skip to content

EasyQueryApiHandler class

This class contains the handlers for all kind of HTTP requests to EasyQuery API (like GetModel, GetQuery, etc).

public class Korzh.EasyQuery.AspNetCore.EasyQueryApiHandler

Package: Korzh.EasyQuery.AspNetCore (targets: net5.0, netcoreapp3.1, netstandard2.0)

Assembly: Korzh.EasyQuery.AspNetCore.dll

NameTypeDescription
EasyQueryApiHandler(EasyQueryManager manager, HttpContext httpContext)voidInitializes a new instance of the Korzh.EasyQuery.AspNetCore.EasyQueryApiHandler class.
NameTypeDescription
HttpContextHttpContextThe current HttpContext
ManagerEasyQueryManagerAn instance of EasyQueryManager that incapsulates all business logic of EasyQuery API
NameTypeDescription
GetFileExtentionByContentType(string contentType)stringGets the file extention by the content type.
GetJSVersion()VersionGets the version of EasyQuery.JS library that has sent the request.
GetQueryFileExt(string fileFormat)stringGets the extension of the query file for specified file format (json or xml).
GetValidFileName(string fileName)stringGets the valid file name based on the string value passed in the parameter.
HandleErrorResponseAsync(int statusCode, string message)TaskHandles exceptions that might occur inside any other EasyQuery API request handler. If the writing to the response content has not started it returns a response with 400 code and the error message.
HandleExceptionAsync(Exception ex)TaskHandles exceptions that might occur inside any other EasyQuery API request handler. If the writing to the response content has not started it returns a response with 400 code and the error message.
HandleExportResultAsync(string modelId, string formatType)TaskHandles the ExportResult requests.
HandleFetchDataAsync(string modelId)TaskHandles the “FetchData” request. This handler receives a query JSON in the request’s body, builds a query (SQL or LINQ), executes it and return the result set (again in JSON format).
HandleGetModelAsync(string modelId)TaskHandles the “GetModel” request as an asynchronous operation.
HandleGetQueryAsync(string modelId, string queryId)TaskHandles the “GetQuery” request and writes the response
HandleGetQueryFileAsync(string modelId, string fileFormat)TaskHandles GetQueryFile request.
HandleGetQueryListAsync(string modelId)TaskHandles the “GetQueryList” request and returns the list of saved queries for a particular model.
HandleGetValueListAsync(string modelId, string editorId)TaskHandles the “GetValueList” request. Returs the list of values for a particular value editor.
HandleNewQueryAsync(string modelId)TaskHandles the “NewQuery” request and returns a JSON representation of a new new empty query for a particular data model.
HandleRemoveQueryAsync(string modelId, string queryId)TaskHandles the “RemoveQuery” request and remove the query with the specified ID from the storage.
HandleSaveQueryAsync(string modelId, string queryId)TaskHandles the “SaveQuery” request for specified model and query. The JSON representation of the query should be passed in the request’s body.
HandleSyncQueryAsync(string modelId, string queryId)TaskHandles the “SyncQuery” request. This action gets a JSON representation of the query in request’s body and passes it SyncQuery method of EasyQueryManager. The manager can save the query and/or build it and return SQL statement (depending on options)
HandleUploadQueryFileAsync(string modelId)TaskHandles UploadQueryFile request.
LoadQueryFromFormFileAsync(IFormFile file)TaskLoads query from a form file.
WriteExecuteQueryResponseAsync(JsonWriter jsonWriter, IEqResultSet resultSet)TaskWrites the response for ExecuteQuery request to JsonWriter. Can be overrided in derived classes to add extra data to the response.
WriteExportedDataAsync(Stream responseStream, string formatType)TaskWrites exported data to the response.
WriteGetModelResponseAsync(JsonWriter jsonWriter, DataModel model)TaskWrites the model’s content to the JsonWriter. Can be overriden in the derived classes to write some extra data to the response for GetModel request .
WriteGetQueryResponseAsync(JsonWriter jsonWriter, Query query)TaskBeing overriden in the derived classes this method allows to write some extra data to the response for GetQuery request .
WriteQueryStreamAsync(HttpResponseStreamWriter responseWriter, string fileFormat)TaskWrite query into the response stream.
WriteSyncQueryResponseAsync(JsonWriter jsonWriter, bool isAuthorized, bool querySaved)TaskWrites the response for SyncQuery request to JsonWriter. Can be overrided in derived classes to add extra data to the respons