Click or drag to resize
OSIsoft, LLC

AFDatabase Class

The AFDatabase represents a single database (data archive) in a PI AF Server.

Inheritance Hierarchy

Namespace:  OSIsoft.AF
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 2.10.8.440
Syntax
[SerializableAttribute]
public sealed class AFDatabase : AFObject, 
	IAFSecurable, IAFChangedEvent, IComparable<AFDatabase>

The AFDatabase type exposes the following members.

Properties
  NameDescription
Public propertyAnalyses Obsolete.
Gets the collection of analyses maintained by the AFDatabase.
Public propertyAnalysisCategories
Gets the collection of analysis categories maintained by the AFDatabase.
Public propertyAnalysisTemplates
Gets the collection of top-level pre-configured analysis rule template maintained by the AFDatabase.
Public propertyAttributeCategories
Gets the collection of attribute categories maintained by the AFDatabase.
Public propertyDefaultPIServerName
This property is the name of the default PIServer for this AFDatabase.
Public propertyDescription
Read/write property that provides a more detailed description of the object.
Public propertyElementCategories
Gets the collection of element categories maintained by the AFDatabase.
Public propertyElements
Gets the collection of top-level elements maintained by the AFDatabase.
Public propertyElementTemplates
Gets the collection of element templates maintained by the AFDatabase.
Public propertyEnumerationSets
Gets the collection of enumerations maintained by the AFDatabase.
Public propertyExtendedProperties
A dictionary of extended properties that can be used to store application specific information.
Public propertyHasItemsCheckedOut
Determines if any items are currently checked out in the AFDatabase.
Public propertyHasItemsCheckedOutToMe
Determines if any items are currently checked out to the current user in the AFDatabase.
Public propertyID
Read-only property that provides a unique identifier for the object to be used for quick access that is not dependent upon the index.
(Inherited from AFObject.)
Public propertyIdentity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public propertyIsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public propertyIsDirty
Indicates whether there are objects in the AFDatabase that have been modified since the last save in to persistent storage.
Public propertyModifyDate
This read-only property returns the time when any object within the database was last modified.
Public propertyName
This read/write property is the name that identifies the AFDatabase on the local machine.
Public propertyNotificationRuleCategories
Gets the collection of analysis categories maintained by the AFDatabase.
Public propertyNotifications Obsolete.
Gets the collection of top-level notifications maintained by the AFDatabase.
Public propertyPISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public propertyQueryDate
This read-only property returns the date used to retrieve the version of an object.
Public propertyReferenceTypeCategories
Gets the collection of reference type categories maintained by the AFDatabase.
Public propertyReferenceTypes
Gets the collection of reference types maintained by the AFDatabase that can be used when defining relationships between elements.
Public propertySecurity
This read-only property returns the AFSecurity information for the object.
Public propertyTableCategories
Gets the collection of element categories maintained by the AFDatabase.
Public propertyTableConnections
This property provides access to the table connection collection, which you can use to access external tables of user-defined information.
Public propertyTables
This property provides access to the table database, which you can use to define and/or access tables of user-defined information.
Public propertyUniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)
Top
Methods
  NameDescription
Public methodAddTransfer(String)
Creates a new AFTransfer without specifying a template.
Public methodAddTransfer(String, AFElementTemplate)
Creates a new transfer based upon the specified template.
Public methodCode exampleApplyChanges
This method applies (saves) all the changes to objects modified by the current user in the database and makes those changes available to other applications executing under the same user account.
Public methodCode exampleApplyChanges(AFCheckedOutMode)
This method applies (saves) the changes to objects in the database according to the specified AFCheckedOutMode and makes those changes available to other applications executing under the same user account.
Public methodApplyQueryDate
Applies the specified query date to the current object and returns an object in the new context.
Public methodCode exampleCheckIn
This method checks in (commits) all the changes to all objects modified by the current user in the database by saving all information to persistent storage.
Public methodCode exampleCheckIn(AFCheckedOutMode)
This method checks in (commits) all the changes to the objects in the database according to the specified AFCheckedOutMode.
Public methodCompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public methodCompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public methodEquals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.)
Public methodEquals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public methodCode exampleFindChangedItems(Boolean, AFTime, AFTime) Obsolete.
Find all the items that have changed in the AFDatabase.
Public methodCode exampleFindChangedItems(Boolean, Int32, Object, Object)
Find all the items that have changed in the AFDatabase.
Public methodCode exampleFindChangedItems(AFIdentity, Boolean, AFTime, AFTime) Obsolete.
Find all the items that have changed in the AFDatabase of the specified type.
Public methodCode exampleFindChangedItems(AFIdentity, Boolean, Int32, Object, Object)
Find all the items that have changed in the AFDatabase of the specified type.
Public methodFindCheckedOutItems(Boolean)
This method finds all the items that are currently checked out in the AFDatabase.
Public methodFindCheckedOutItems(AFCheckedOutMode)
This method finds the items that are currently checked out in the AFDatabase according to the specified AFCheckedOutMode.
Public methodGetHashCode
Gets the hash code for this instance of the object which is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from AFObject.)
Public methodGetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public methodGetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public methodGetPath(AFEncodeType, AFObject)
Returns the path to the object relative from another object, using the name and/or id as specified by encodeType.
(Inherited from AFObject.)
Public methodGetSecurity
Gets the AFSecurity information of the specified security item associated with the object.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodPersist
This method returns the persistence string for the object.
(Inherited from AFObject.)
Public methodCode exampleRefresh
Refreshes the client with any changes that have been made to the database since loaded without discarding unapplied changes.
Public methodCode exampleRefresh(Boolean)
Refreshes the client with any changes that have been made to the database since loaded with an option to discard unapplied changes.
Public methodRemoveTransfer
Removes an existing AFTransfer from the database.
Public methodToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Public methodUndoCheckOut
Rolls back all the changes to the database since the last call to the CheckOut method of each object. Any changes since the check out will be lost.
Top
Events
  NameDescription
Public eventCode exampleChanged
Event is raised when the object or one of its sub-objects is changed.
Top
Remarks

The database stores its information in a PI AF Server. AFDatabase objects are retrieved from the AFDatabases collection and provide access to the basic entities represented on each database, such as element templates, elements, tables, etc.

Typically, a program requires a network connection to the server where the database is located. Connections are established by calling one of the PISystemConnect methods. The PISystem.Disconnect method is used to break the connection to the database.

Many of the services available through the AFDatabase are accessed through its properties, which return other objects. For example, the Elements property provides a collection of elements for accessing the defined elements on a database.

Examples
// This example demonstrates how to use several properties of the AFDatabase object.

// Get the Database
PISystems myPISystems = new PISystems();
PISystem myPISystem = myPISystems.DefaultPISystem;
AFDatabase myDB = myPISystem.Databases.DefaultDatabase;

// Display information about the Default DB
Console.WriteLine("Name of Default DB = {0}", myDB.Name);
Console.WriteLine("Description of Default DB = {0}", myDB.Description);
Console.WriteLine("UniqueID of DefaultDB = {0}", myDB.UniqueID);

// Set the DB to the First DB
myDB = myPISystem.Databases[0];

// Display the Name, Description, and UniqueID of the first db
Console.WriteLine("Name of First DB = {0}", myDB.Name);
Console.WriteLine("Description of First DB = {0}", myDB.Description);
Console.WriteLine("UniqueID of First DB = {0}", myDB.UniqueID);

// Add a new Database
AFDatabase newDB = myPISystem.Databases.Add("NewDatabase");
newDB.Description = "This is a new Database";

// Display the Database Count
Console.WriteLine("Database Count = {0}", myPISystem.Databases.Count);
Version Information

AFSDK

Supported in: 2.10.5, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6, 2.5, 2.4
See Also
Enabling Operational Intelligence