Working with data models in EasyQuery

This article will guide you through all issues about working with data models in EasyQuery library. How to load it from the DbContext or from your DB connection, or now to create a new one using Data Model Editor.

Working with several data models

All EasyQuery demos works with one data model (and one database which corresponds to that model). Here we are going to describe how to add a selector that switches between two data models on your view/page and then how to setup a custom "model loader" to handle GetModel requests propertly. To make it possible to switch between these two models we need some selector element on our page. The only problem here - is to switch the database connection accordingly the the switches between the models. Now when the user selects an item in our model selector element on the client-side - our server-side code automatically loads the selected model and connects to a proper database (when necessary)..

Query saving and loading

EasyQuery has built-in means for query saving and loading. Here we are going to describe the most common approaches for solving this task

Custom client-side dialogs for saving/loading operations

Users who use some other dialogs libary usually want to replace those default dialogs with their own. We are going to replace those default dialogs with nice HTML dialogs made with JQuery UI dialogs library. The approach we will use is quite simple: our AdvancedSearchView JavaScript class has several methods which can be "overriden" to replace the default behavior with your own implemenation of those dialogs. In case of using JQuery dialogs we need to define some placeholders (read div elements) on our page where our new dialogs will be rendered. Here is an example: NB: Please note that this step is specific for JQuery dialogs.

EasyQuery.JS widgets localization

Localization / internationalization tasks for EasyQuery widgets. How to add new locale, how to set current locale, how to switch widgets language on-the-fly.

Adhoc reporting page in your web application

This article describes how to implement the adhoc reporting functionality (similar to the one from our live demos) in your own project.

Attaching extra data to a query on the client-side

Sometimes it's necessary to attach some extra data to each query (based on some user's input on the client-side) and then use that extra data on query execution. For example, user might want to specify a date (or a period of time) as an additional filter to the any query. To add some extra data you can use beforeExecuteQuery event handler which can be defined on view initialization: Now if you check in Developer Tools (on Network tab), each .../execute request now includes ad additional data object in the request payload. Now to process this additional request data you can create your own implementation of EasyQueryManager and override its ExecuteQueryCore method. Here is an example: Here we just reconfigure our current query and add in it an additional condition group with a bunch of conditions like SomeColumns contains 'filter text' Finally, you need to register your manager class on EasyQuery middleware initialization:.

Exporting query results

Detailed instruction on how to perform additional functionality while dealing with EasyQuery results.

HAVING and GROUP BY clauses in generated query

This article shows how to add new clauses into the query and how to manage it

Paging in query results

Paging can make your work with query more convenient. And here is detailed instruction on how to use it.

Lookup fields and columns

How to deal with lookup fields in EasyQuery

Managing data formats in client-side widgets (grid, charts) and exported data

This article shows how to implement some particular tasks with your query

Adding a new operator to your data model

Here you can find all information about how to add a new operator to your data model either using Data Model Editor (DME) or with a code

Create virtual (calculated) attribute in you model

Virtual attributes: what are they for and how to add one

Previous versions' tutorials (obsolete)

This section contains the tutorials that we written for older versions of EasyQuery and most probably are obsolete now.