Skip to main content

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

Assembly: Korzh.EasyQuery.dll

Constructors

NameTypeDescription
EasyQueryManager()voidInitializes a new instance of the Korzh.EasyQuery.Services.EasyQueryManager class.
EasyQueryManager(EasyQueryOptions options)voidInitializes a new instance of the Korzh.EasyQuery.Services.EasyQueryManager class.
EasyQueryManager(EasyQueryOptions options, IServiceProvider services)voidInitializes a new instance of the Korzh.EasyQuery.Services.EasyQueryManager class.

Fields

NameTypeDescription
PreFetchTunersList<IEasyQueryManagerTuner>The list of tuners which are called before the query execution
ServicesIServiceProviderA reference to the System.IServiceProvider object which allows you to access the DI container

Properties

NameTypeDescription
AuxDataobjectContains additinal data that should be passed to the client with response.
CachingServiceIEqCachingServiceGet or sets a caching service
ChunkChunkSettingsHolds different pagination settings.
ClientDataDictionary<string, object>Gets a dictionary which contains all the data received from the client-side.
DefaultModelIdstringGets or sets the default name of the model. This model will loaded automatically if the name was not indicated explicitly
ExportRowLimitint
IsAuxiliaryboolIndicates whether this copy of manager is an auxiliary one (created for an auxiliary request). We don't call some tuners for auxiliary requests
MetaDataFetchMetaDefines some meta-data collected on query processing/execution (like like Total Number of Records).
ModelDataModelGets the current model. The value of this property is set on the first call of GetModel method.
ModelIsLoadedboolDetermines wether model is loaded
ModelLoaderIModelLoaderGets or sets the model loader - an implementation of Korzh.EasyQuery.Services.IModelLoader inteface.
ModelTunerAction<EasyQueryManager>Gets or sets the model tuner - a function which allows you to make some changes in the model after its loading.
OptionsEasyQueryOptionsGets the manager's options.
QueryQueryGets the current query. The value of this property is set on the first call of GetQueryAsync method.
QueryBuilderIQueryBuilderReturns QueryBuilder associated with current Query
QueryStoreIQueryStoreGets or sets the query store - an object which covers all saving/loading operations for queries.
QueryTunerAction<EasyQueryManager>Gets or sets the query tuner - a function which allows you to make some changes in the query after its loading.
ResultSetOptionsResultSetOptionsThe global settings for fetching data
SaveNewQueryToStoreboolDetermines whether the manager should save a new query into the storage right after the creation.
SettingsDictionary<string, object>Gets a dictionary which contains all the settings received from the client-side.
UserIdstringGets 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/{UserId}/ and App_Data/{UserId}/Queries
ValueListResolversList<IValueListResolver>Gets the list of "value list" resolvers.

Methods

NameTypeDescription
AddValueListResolver(IValueListResolver valueListResolver)voidAdds the value list resolver to the internal list of list resolvers which will be used during GetList request processing
ApplyBuilderOptions(IQueryBuilder builder)void
ApplyPreFetchTuners()voidApplys all pre execute tuners
BuildQuery(QueryBuilderOptions options = null)IQueryStatementBuilds a Korzh.EasyQuery.IQueryStatement object by the Korzh.EasyQuery.Services.EasyQueryManager.Query and returns the built statement.
CheckModel()voidChecks if the current Model is not null and throws an exception otherwise.
CheckQuery()voidChecks if the current Query is not null and throws an exception otherwise.
CreateModelCore(string modelId = null)DataModelCreates the new DataModel object
CreateQuery()QueryCreates and initializes a new Query object.
CreateQueryAsync(string modelId = null, `CancellationToken` ct = null)Task<Query>Creates new Query object.
CreateQueryBuilderCore()IQueryBuilderCreates an instance of Korzh.EasyQuery.IQueryBuilder
CreateQueryCore()QueryCreates a new Query object.
Dispose(bool disposing)voidReleases unmanaged and - optionally - managed resources.
Dispose()voidReleases unmanaged and - optionally - managed resources.
ExportResultSetAsync(IEqResultSet data, string format, Stream stream, CancellationToken ct = null)TaskExecutes the query and exports the result to a specified format. To run this operation we need to register an appropriate exporter first.
FetchDataAsync(CancellationToken ct = null)Task<IEqResultSet>Executes the query and returns an object which implments IEqResultSet interface.
FetchDataCoreAsync(CancellationToken ct)Task<IEqResultSet>The actual implemenation of Korzh.EasyQuery.Services.EasyQueryManager.FetchDataAsync(System.Threading.CancellationToken) function. This method is overridden in EasyQueryManager descendants like EasyQueryManagerSql or EasyQueryManagerLinq.
GenerateQueryId(string name)stringGenerates the query identifier.
GetContentTypeByExportFormat(string format)stringGets the content type by export format.
GetDataExportSettings(string format)IDataExportSettingsGets the data export settings.
GetDataExportTuners()IEnumerable<IDataExportTuner>
GetListCoreAsync(ListRequestOptions options, CancellationToken ct)Task<IEnumerable<ListItem>>The basic implemenation of GetList action handler. Can be overrided in the derived classes.
GetModelAsync(string modelId, CancellationToken ct = null)Task<DataModel>Gets the DbModel object by ID.
GetQueryAsync(string modelId, string queryId, CancellationToken ct = null)Task<Query>Gets the Query object by name.
GetQueryListAsync(string modelId, CancellationToken ct = null)Task<IEnumerable<QueryListItem>>Gets the list of available queries.
GetQueryListCoreAsync(string modelId, CancellationToken ct)Task<IEnumerable<QueryListItem>>Basic implementation of Korzh.EasyQuery.Services.EasyQueryManager.GetQueryListAsync(System.String,System.Threading.CancellationToken) method. This method just calls corresponding function of the QueryStore. Can be overriden in derived classes.
GetValueFromCache(string key)stringGets some string value from session by its key.
GetValueListAsync(string modelId, string editorId, IDictionary<string, string> options = null, `CancellationToken` ct = null)Task<IEnumerable<ListItem>>Returns custom list of values by editorId. This method is usually called by GetList action of EasyQueryController.
InitQueryAsync(CancellationToken ct = null)TaskInitializes the new query and saves it to the storage (if SaveNewQueryToStore is turned on).
InitQueryCoreAsync(CancellationToken ct)TaskInitializes the new query. Does nothing in the base class. Can be overriden in the derived classes.
JsonToListRequestOptions(string optionsJson)ListRequestOptionsConverts JsonDict object to ListRequestOptions
LoadModelAsync(string modelId, CancellationToken ct = null)TaskLoads model by its ID.
LoadModelFromCacheAsync(string modelId, CancellationToken ct)Task<bool>Loads DataModel from cache by ID (name)
LoadQueryAsync(string modelId, string queryId, CancellationToken ct = null)Task
LoadQueryFromCacheAsync(string queryId, CancellationToken ct)Task<bool>Loads Query from cache by ID
QueryUpdated()voidCalls Korzh.EasyQuery.Services.EasyQueryManager.QueryTuner
ReadClientOptions(JObject clientOptions)void
ReadOneRequestPropertyAsync(string modelId, JsonReader reader, string propName, CancellationToken ct)TaskRead one property from a request's JSON object.
ReadRequestContentFromJsonAsync(string modelId, JsonReader reader, CancellationToken ct = null)TaskReads the content of the client-side request from a JsonReader object.
ReadRequestContentFromTextReaderAsync(string modelId, TextReader reader, CancellationToken ct = null)TaskLoads all reaquest's data (like query, options, etc) from the text reader.
RemoveQueryAsync(string modelId, string queryId, CancellationToken ct = null)Task<bool>Removes the query. This method uses the functionality provided by the current query store.
SaveModelInCacheAsync(CancellationToken ct)TaskSaves model into cache
SaveQueryInCacheAsync(CancellationToken ct)TaskSaves query into cache
SaveQueryToStoreAsync(bool createIfNotExist = True, CancellationToken ct = null)Task<bool>Saves the current query to the query store.
SaveValueInCache(string key, string value)voidStores some string value in cache.
SyncQueryAsync(CancellationToken ct = null)TaskSynchronizes the query.
SyncQueryCoreAsync(CancellationToken ct)TaskSynchronizes the query. This is the default implementation which can be ovverride in derived classes.
TuneBuilder(IQueryBuilder builder)voidAllows 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

NameTypeDescription
RegisterExporter(string format, IDataExporter exporter)voidRegisters ResultSet exporter for current format.