EasyQueryManager class

Provides basic functionality for managing different EasyQuery operations and to process the AJAX requests from EasyQuery JavaScript widgets. This class is abstract and it implements only the most common features. The descendants of this class provides more concrete implementation of the model loading and query generation

public abstract class Korzh.EasyQuery.Services.EasyQueryManager
    : IDisposable

Package: Korzh.EasyQuery (targets: netstandard2.0)

Assembly: Korzh.EasyQuery.dll

Constructors

Name Type Description
EasyQueryManager() void Initializes a new instance of the Korzh.EasyQuery.Services.EasyQueryManager class.
EasyQueryManager(EasyQueryOptions options) void Initializes a new instance of the Korzh.EasyQuery.Services.EasyQueryManager class.
EasyQueryManager(EasyQueryOptions options, IServiceProvider services) void Initializes a new instance of the Korzh.EasyQuery.Services.EasyQueryManager class.

Fields

Name Type Description
PreFetchTuners List<IEasyQueryManagerTuner> The list of tuners which are called before the query execution
Services IServiceProvider A reference to the System.IServiceProvider object which allows you to access the DI container

Properties

Name Type Description
CachingService IEqCachingService Get or sets a caching service
Chunk ChunkSettings Holds different pagination settings.
ClientData Dictionary<string, object> Gets a dictionary which contains all the data received from the client-side.
DefaultModelId string Gets or sets the default name of the model. This model will loaded automatically if the name was not indicated explicitly
Meta DataFetchMeta Defines some meta-data collected on query processing/execution (like like Total Number of Records).
Model DataModel Gets the current model. The value of this property is set on the first call of GetModel method.
ModelIsLoaded bool Determines wether model is loaded
ModelLoader IModelLoader Gets or sets the model loader - an implementation of Korzh.EasyQuery.Services.IModelLoader inteface.
ModelTuner Action<EasyQueryManager> Gets or sets the model tuner - a function which allows you to make some changes in the model after its loading.
Options EasyQueryOptions Gets the manager's options.
Query Query Gets the current query. The value of this property is set on the first call of GetQueryAsync method.
QueryBuilder IQueryBuilder Returns QueryBuilder associated with current Query
QueryStore IQueryStore Gets or sets the query store - an object which covers all saving/loading operations for queries.
QueryTuner Action<EasyQueryManager> Gets or sets the query tuner - a function which allows you to make some changes in the query after its loading.
ResultSetOptions ResultSetOptions The global settings for fetching data
SaveNewQueryToStore bool Determines whether the manager should save a new query into the storage right after the creation.
Settings Dictionary<string, object> Gets a dictionary which contains all the settings received from the client-side.
Totals TotalsOptions
UserId string Gets or sets the user ID. This value is used to build the path to the folder where model and query files are stored. By default it's App_Data// and App_Data//Queries
ValueListResolvers List<IValueListResolver> Gets the list of "value list" resolvers.

Methods

Name Type Description
AddValueListResolver(IValueListResolver valueListResolver) void Adds the value list resolver to the internal list of list resolvers which will be used during GetList request processing
ApplyPreFetchTuners() void Applys all pre execute tuners
BuildQuery(QueryBuilderOptions options = null) IQueryStatement Builds a Korzh.EasyQuery.IQueryStatement object by the Korzh.EasyQuery.Services.EasyQueryManager.Query and returns the built statement.
CheckModel() void Checks if the current Model is not null and throws an exception otherwise.
CheckQuery() void Checks if the current Query is not null and throws an exception otherwise.
CreateModelCore(string modelId = null) DataModel Creates the new DataModel object
CreateQuery() Query Creates and initializes a new Query object.
CreateQueryAsync(string modelId = null) Task<Query> Creates new Query object.
CreateQueryBuilderCore() IQueryBuilder Creates an instance of Korzh.EasyQuery.IQueryBuilder
CreateQueryCore() Query Creates a new Query object.
Dispose(bool disposing) void Releases unmanaged and - optionally - managed resources.
Dispose() void Releases unmanaged and - optionally - managed resources.
ExportResultSetAsync(IEqResultSet data, string format, Stream stream) Task Executes the query and exports the result to a specified format. To run this operation we need to register an appropriate exporter first.
FetchDataAsync() Task<IEqResultSet> Executes the query and returns an object which implments IEqResultSet interface.
FetchDataCoreAsync() Task<IEqResultSet> The actual implemenation of Korzh.EasyQuery.Services.EasyQueryManager.FetchDataAsync function. This method is overridden in EasyQueryManager descendants like EasyQueryManagerSql or EasyQueryManagerLinq.
GenerateQueryId(string name) string Generates the query identifier.
GetContentTypeByExportFormat(string format) string Gets the content type by export format.
GetDataExportSettings(string format) IDataExportSettings Gets the data export settings.
GetListCoreAsync(ListRequestOptions options) Task<IEnumerable<ListItem>> The basic implemenation of GetList action handler. Can be overrided in the derived classes.
GetModelAsync(string modelId) Task<DataModel> Gets the DbModel object by ID.
GetQueryAsync(string modelId, string queryId) Task<Query> Gets the Query object by name.
GetQueryListAsync(string modelId) Task<IEnumerable<QueryListItem>> Gets the list of available queries.
GetQueryListCoreAsync(string modelId) Task<IEnumerable<QueryListItem>> Basic implementation of Korzh.EasyQuery.Services.EasyQueryManager.GetQueryListAsync(System.String) method. This method just calls corresponding function of the QueryStore. Can be overriden in derived classes.
GetValueFromCache(string key) string Gets some string value from session by its key.
GetValueListAsync(string modelId, string editorId, IDictionary<string, string> options = null) Task<IEnumerable<ListItem>> Returns custom list of values by editorId. This method is usually called by GetList action of EasyQueryController.
InitQueryAsync() Task Initializes the new query and saves it to the storage (if SaveNewQueryToStore is turned on).
InitQueryCoreAsync() Task Initializes the new query. Does nothing in the base class. Can be overriden in the derived classes.
JsonToListRequestOptions(string optionsJson) ListRequestOptions Converts JsonDict object to ListRequestOptions
LoadModelAsync(string modelId) Task Loads model by its ID.
LoadModelFromCacheAsync(string modelId) Task<bool> Loads DataModel from cache by ID (name)
LoadQueryAsync(string modelId, string queryId) Task
LoadQueryFromCacheAsync(string queryId) Task<bool> Loads Query from cache by ID
QueryUpdated() void Calls Korzh.EasyQuery.Services.EasyQueryManager.QueryTuner
ReadClientOptions(JObject clientOptions) void
ReadOneRequestPropertyAsync(string modelId, JsonReader reader, string propName) Task Read one property from a request's JSON object.
ReadRequestContentFromJsonAsync(string modelId, JsonReader reader) Task Reads the content of the client-side request from a JsonReader object.
ReadRequestContentFromTextReaderAsync(string modelId, TextReader reader) Task Loads all reaquest's data (like query, options, etc) from the text reader.
RemoveQueryAsync(string modelId, string queryId) Task<bool> Removes the query. This method uses the functionality provided by the current query store.
SaveModelInCacheAsync() Task Saves model into cache
SaveQueryInCacheAsync() Task Saves query into cache
SaveQueryToStoreAsync(bool createIfNotExist = True) Task<bool> Saves the current query to the query store.
SaveValueInCache(string key, string value) void Stores some string value in cache.
SyncQueryAsync() Task Synchronizes the query.
SyncQueryCoreAsync() Task Synchronizes the query. This is the default implementation which can be ovverride in derived classes.
TuneBuilder(IQueryBuilder builder) void Allows to tune the formats of the query builder. The default implementation calls all builder tuners defined in _builderTuners list. You can override this function in your sub-class to implement some custom behavior.

Static Methods

Name Type Description
RegisterExporter(string format, IDataExporter exporter) void Registers ResultSet exporter for current format.