Back to contents pageHow to get a list of types

How to get a list of types

Summary

This article shows how to get a list of types using the Ubisense .NET API.



Prerequisites

None. You can use this article on its own.



Example material

Save this link to get a zip file of the example material


Guide

Before you start, remember to:



1) Listing your types using the .NET API

You can list the types present in your database with the Ubisense.UBase.Inheritance.Descendants method. This returns a list of symbols that inherit from the argument supplied. The following example will return the list of types defined by the user:


    List<Ubisense.UBase.Symbol> UserDefinedTypes =
    Ubisense.UBase.Inheritance.Descendants(
        new Ubisense.UBase.Symbol("UEnterprise::UserDefined"));

All user-defined types inherit from UEnterprise::UserDefined.

The following example will return the list of all types:


    List<Ubisense.UBase.Symbol> AllTypes =
    Ubisense.UBase.Inheritance.Descendants(
        new Ubisense.UBase.Symbol("UBase::Object"));

All types inherit from UBase::Object.

You can find an object's static type and dynamic type in its DynamicType and StaticType properties. The following example prints the name of the object and the name of the static and dynamic types of the object for a row in the relation Ubisense.UName.Naming.ObjectName:


    Console.WriteLine("{0}: StaticType {1}, DynamicType {2}",
    row.name_, row.object_.StaticType.Name, row.object_.DynamicType.Name);



2) Viewing your user-defined types in Site Manager

Normally, the types listed in Site Manager are those that inherit from UEnterprise::UserDefined. For example, if you use Site Manager to add the type Person without specifying any ancestors, it will be shown like this:





3) Viewing all types in Site Manager

You can view all types in Site Manager by setting a registry string value called managed_base_type in
My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Ubisense 2.1\Platform\Config to the value UBase::Object.

Ubisense recommends that you do not change your managed base type in this way without good reason. You do not normally need to manage any types that you did not define.

If you set the managed base type to be UBase::Object, Site Manager will show all types in your database, for example:





Back to top