Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
Fetch Group Tab
Programmer's Guide > OpenAccess ORM Classic (Old API) > Development Environment > Wizards and Dialogs > Forward Mapping Wizard > Class Mapping > Fetch Group Tab

Glossary Item Box

This documentation article is a legacy resource describing the functionality of the deprecated OpenAccess Classic only. The contemporary documentation of Telerik OpenAccess ORM is available here.

The Fetch Group tab is the second tab in the Mapping Information view, when a class is selected in the treeview. It is used to define fetch groups. A fetch group is used to fetch only those fields from the database that are actually needed by the application in as few calls as possible. The purpose of this tutorial is to describe the various options (properties) that can be set in this tab.

The Fetch Group tab is shown on the snapshot below:

The options displayed in the Fetch Group tab are:

  • Class Name - the name of the target class.
  • Class Fetch Groups grid - once you select a persistent class from the tree view, its corresponding fields appear in the grid below the Class Name setting. The grid contains the names of the fields (e.g. city, street, zip) and a list of fetch groups defined on that particular class. In the above image you can see that the class contains no fetch groups. In order to add a new fetch group you should use the Add/Remove button. Pressing the Add/Remove button will open Add/Remove Fetch Group dialog, which is shown on the snapshot below.



    As you can see the dialog contains four buttons (Add, Remove, Ok, Cancel), their functions are pretty self-explanatory. For example, clicking the Add button will add a fetchgroup with a default name such as "new1". However, it is recommended that you change this name to something that contains symbolic constants and is suggestive of the fields that would be included in it, as it is shown on the image below:



    Clicking the Remove button will remove the selected fetch group. Clicking Ok will make all necessary changes, such as adding new fetchgroup/s, renaming fetchgroup/s or removing fetchgroup/s in the Class Fetch Groups grid.



    Once the new fetchgroup is added in the Class Fetch Groups grid you may check/uncheck (select/deselect) the fields which are part from that fetchgroup. For example, in the above image, the "name" and "street" fields are part of MyFetchGroup.
  • Reference Field Settings - the Reference Field Settings are enabled only if collections, map or reference fields are selected in the grid. The following settings can be set:
    • Next Fetch Group - this sets a fetchgroup at the referenced class, as the fetchgroup to be used, i.e., following this reference, the specified fetchgroup is added to the fetchplan. Which means that it is possible for you to add an entry fetchgroup to the fetchplan and then add additional fetchgroups as references. If you want to specify a next fetch group on a reference field, you should first select it (using the check box) and then add the name of the fetchgroup to be used in the textbox.
    • Path - it specifies the additional path to be followed, in case of reference fields. This is useful in the cases where you need a specific field at the referenced object and do not want to define a FetchGroup at the referenced class. If you want to specify the additional path to be followed on a reference field, you should first select it (using the check box) and then specify the path.
      You can either specify the Next FetchGroup to be used or the Path to be followed but not both.
    • Fetch Depth - the Fetch Depth helps in controlling the amount of data retrieved from the database, in the cases where an object of a particular type refers to an object of the same type. It defines the maximum depth the referenced objects are fetched from the root instances.
      For more information about Fetch Groups and Fetch Plans, check out the FetchPlans and FetchGroups topics.

When working with the Fetch Group tab, you should consider the following situations:

  • By default the fetchgroup definition is written to the source code, using the [FetchField] attribute. Similarly any changes made to the fetchgroup definitions, using the fetch group tab are also made in the App.config file or in the source code as per your preference.

  • If a class is not persistent, the fetch-group tab will not appear.

  • If the class does not have any persistent fields, nothing appears in the grid and an appropriate message is displayed.

  • If in the class some fields are persistent and some are non-persistent, then the non-persistent fields will not appear in the fetch group grid.

  • If any field is made persistent, it will appear in the grid when it is refreshed by clicking on the refresh button.