3.3. Working with Metadata Container
This article might be obsolete!
It is valid for ASP.NET, Java, ActiveX, VCL editions, and for previous version of Active Query Builder WinForms .NET Edition (1.x).
The appropriate article for Active Query Builder 2 .NET Editon can be found here: Working with the Metadata Container.
Metadata Container (QueryBuilder.MetadataContainer) is collection of database objects displayed in the metadata tree. Each object contains collections of Fields and Relations (foreign keys). You may easily add or remove objects of this collection to add or remove database objects from the tree. Some database objects can be hidden, i.e. they are loaded in the metadata container, but not visible in the tree. System objects are hidden by default.
Metadata container is normally filled with RefreshMetadata or LoadMetadataByMask, LoadMetadataByFilter methods. These methods fill the list of database objects and their relations, but not their fields as it may take a long time to do that in case of large databases or slow connections. Fields are usually loaded when object is added to the query building area. To load fields during the RefreshMetadata method call you may set the WorkOffline (OfflineMode) property to True.
The WorkOffline (OfflineMode) property instructs the component to work in offline mode, i.e. it denies any hidden SQL query executions (mostly to load fields of some database objects). But in case of direct calls of metadata loading methods, it instructs the component to load metadata information in complete, i.e. with fields of each loaded database object.
If you already have the list of allowed objects, you may not call the RefreshMetadata method at all, but fill the Metadata Container by youself:
For Each AllowedTableName As String In AllowedTables QueryBuilder.MetadataContainer.AddTable("", AllowedTableName, False, "") Next
Fisrt parameter of the AddTable method is a schema name, fourth is a database name, third parameter is a flag for system objects.