Active Query Builder support area

Methods to load, search and remove objects in the Metadata Container

Last modified:


To load all objects from the database schema to the Metadata Container (taking into account limitations specified by Metadata Filters), use the MetadataContainer.LoadAll method. The withFields parameter instructs whether to load fields for objects or not. Fields loading is the longest operation (separate query is executed for every database object), so the LoadAll(true) call might work very long on large databases. If you fill the metadata container with objects without fields, the fields will be loaded on demand when you add an object to a query.
Metadata Container is a tree-like structure, which groups its objects by namespaces in a tree-like structure (servers, databases, schemas, packages - each level can be omitted if it's not applicable to the particular database server). To load only one level of this hierarchy, or objects of the specifiс type, use the MetadataItem.Items.Load method. For example the MetadataContainer.Items.Load(Database|Schema, true) call will load all database and schema levels of the metadata container.
The other methods allow iterating items that are already loaded into the MetadataContainer.
  • The MetadataList.Find* methods find and return matching metadata items or their indices (without loading them from the database).
  • The MetadataList.GetItems and MetadataList.GetItemsRecursive methods return items from the list (and child items lists) without loading them from the database.
  • The MetadataItem.Find* methods recursively load items of child hierarchy from the database, and return matching ones.
  • The MetadataStructure.GetAllMetadataItems method loads and returns all metadata items that might be visible in the Database Schema Tree (according to the current Metadata Structure).
To remove an object from the Metadata Container, you should remove it from the list of parent metadata items:
    metadataItem.Parent.Items.Remove(metadataItem);

Is this article helpful for you?