AVEVA.Net 4 Database Interface数据库接口

AVEVA.Net 4 Database Interface提供了数据模型定义类,包括DbElementType、DbAttribute等,用于数据库访问、查询和修改。DbElementType用于定义元素类型,而DbAttribute则涉及属性元数据。该接口还支持过滤、迭代、Dabacon表访问和事件处理等功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

4 Database Interface数据库接口

The classes fall into the following groups:

这个类分成以下几组:

Data model definition classes
Basic database access, query and modification.
Filters and iterators
Dabacon table access
DB, MDB, Project access
Events and pseudo attribute plugins

数据模型定义类
基本数据库存取,查询和修改
过滤和循环
Dabacon表存取
数据库,数据库组,项目存取
事件和隐含属性

4.1 Data Model Definition Classes

The classes are:

DbElementType
DbAttribute
DbElementTypeInstance
DbAttributeInstance

这个类是:
数据库元素类型
数据库属性
数据库元素类型实例
数据库属性实例

4.1.1 DbElementType 数据库元素类型

Overview

There is a single class for all element types.

一个类包含所有元素类型。

The purpose of the class is to:

Instances of the class identify the element type. i.e. methods on other classes take a DbElementType as an argument rather than a string to denote an Element type. The DbElementType has ‘value’ semantics for comparison purposes. i.e. comparing of two DbElementTypes will always return true if they refer to the same type, even if they are different objects.
Access the metadata associated with element types.
External to PDMS/Marine, the hash value can be used to uniquely identify an Element type. The hash value is a 32 bit integer.

这个类的用途是:
这个类的实例确定元素类型,比如在其他类的方法中调用一个DbElementType作为参数而不是一个字符串来表示一个元素类型。这个DbElementType可以用于比较,例如如果两个不同的对象如果有相同的类型,在比较的时候将返回True。

Constructors 构造方法

In C# a DbElementType object may be obtained in one of three ways:

在 C# 中DbElementType对象有三种获取方式:

Use the globally defined instances in DbElementTypeInstance. This is the recommended and easiest way to obtain a DbElementType.

使用DbElementTypeInstance实例,这是推荐的和最简单的获取DbElementType的方法。

示例:

 if (elem.GetElementType() == DbElementTypeInstance.EQUIPMENT)

The static ‘GetElementType’ method may be used to return a DbElementType given the Element Type name. This is only needed for UDETs. The colon must be included as part of the name.

GetElementType静态方法可以用于给定一个元素类型名字后返回一个DbElementType,这个仅仅用于用户自定义元素类型(UDETs),名字前面必须带上冒号。

There is also a static ‘GetElementType’ method that may to be used to return a DbElementType given the hash value. This is only needed where a hash value has been stored outside of PDMS/Marine.

还有一个GetElementType静态方法可以通过给定一个哈希值后返回一个DbElementType,这仅用于哈希值保存在 PDMS/Marine之外的情况。

Various methods on other classes, such as DbElement will return a list of DbElementTypes.

在其他类的这种方法中,像DbElement将返回一个DbElementTypes列表。

Methods

The methods allow the Element type metadata to be accessed. E.g.

  • Name
  • Description
  • BaseType (for UDETs)
  • List of attributes
  • List of UDAs
  • Allowed members
  • Allowed owners
  • Types that may appear above this element type
  • Types that may appear below this element type
  • Element types that may be referenced from a given attribute on this element type
  • Database types in which it occurs

方法允许获取元素类型的元数据:

  • 名称
  • 基本类型
  • 属性列表
  • 自定义属性列表
  • 允许的成员
  • 允许的上级
  • 在这个类型之上可以出现的类型
  • 在这个类型之下可以出现的类型
  • 这个类型指定属性可以参考的元素类型
  • 可以应用的数据库类型

示例:

DbElementType[] types = elem.GetElementType().MemberTypes();

Related ENUMS 相关的枚举

DbNounManual- Manual category
DbType - DB type

Related Pseudo Attributes 相关的隐含属性

Pseudo attributes that provide similar information on a particular element instance (i.e. on a DbElement) are:

隐含属性能提供前面方法获取的类似的信息:

Attribute NameC# Data TypeDescription
HLISDbElementType[]List of all possible types in owning hierarchy
LISTDbElementType[]List of all possible member types
LLISDbElementType[]List of all possible types in member hierarchy
OLISDbElementType[]List of all possible owner types
REPTXTStringReporter text used for element type
ATTLISTDbAttribute[]List of all visible attributes for element
PSATTSDbAttribute[]List of pseudo attributes
UDALISDbAttribute[]List of UDAs

4.1.2 DbAttribute

Overview

This is very similar to DbElementType. There is a single class for all attributes.

类似于DbElementType,一个类包含了所有属性。

The purpose of the class is to:

  • Access the metadata (i.e. data about data) associated with attributes. E.g. type, name, length
  • Identify attributes. i.e. methods on other classes should always take a DbAttribute rather than a string as an argument to denote the attribute. Any comparison of attribute identity should be done by comparing DbAttribute objects.

The class should not be confused with the attribute value. The actual Attribute value for a particular Element can only be accessed via the DbElement class. Comparing two DbAttributes just compares whether they identify the same attribute, the comparison does not look at attribute values in any way.

External to PDMS/Marine, the hash value can be used to uniquely identify an Attribute. The hash value is a 32 bit integer.

Constructors

In C# a DbAttribute object may be obtained in the following ways:

  1. Use globally defined instances. Each attribute has a globally declared instance in the DbAttributeInstance class. This is the standard way of specifying an attribute.
  2. Look up the DbAttribute given the attribute name. This is only needed for UDAs, since all other attributes can be obtained from the global instances. The colon must be included as part of the name.
  3. Look up the DbAttribute given the attribute hash value. Generally this is only needed if reading the hash value from an external system.
  4. Various methods on other classes, such as DbElement, will return a list of DbAttributesTypes.

示例

string name = elem.GetString(DbAttributeInstance.NAMN);
bool lock = elem.GetBool(DbAttributeInstance.LOCK);
Position pos = elem.GetPosition(DbAttributeInstance.POS);

Methods

The methods allow the following metadata to be accessed:

  • Attribute Type
  • Units
  • Name
  • Description
  • Category
  • Size
  • Allowed Values
  • Allowed ranges
  • Is a UDA
  • Is a pseudo attribute
  • Whether the attribute may take a qualifier

方法允许获取属性的元数据:

  • 属性类型
  • 单位
  • 名称
  • 描述
  • 值的长度,如字符串的长度
  • 允许的值
  • 允许的范围
  • 是否是用户自定义属性
  • 是否是隐含属性
  • 是否需要指定限定条件

Example:

Find the type of attribute XLEN. We use the global instance of XLEN on the DbAttributeInstance class.

using ATT=Aveva.Pdms.Database.DbAttributeInstance; 

DbAttributeType xlenTyp= ATT.XLEN.Type; 

Related ENUMS 相关的枚举

DbAttributeUnit - Type of units, e.g. distance or bore or none.

属性单位,枚举值是单位的类型,例如距离单位和直径单位或者未设置。

DbAttributeType - Type of attribute. One of

属性类型,下列值之一

INTEGER = 1,
DOUBLE = 2,
BOOL = 3,
STRING = 4,
ELEMENT = 5,
DIRECTION = 7,
POSITION = 8,
ORIENTATION = 9

DbAttributeQualifier - used to determine what sort of qualifier an attribute has

属性限定条件,用于确定一个属性有哪些限定条件。

4.1.3 DbElementTypeInstance

This class contains instances of DbElementType for every element type in PDMS/Marine. These instances may be used wherever a DbElementType is expected. E.g. if a method MyMethod() takes an DbElementType, then you could write:

e.g.

MyMethod(Aveva.Pdms.Database.DbElementTypeInstance.EQUIPMENT);

It is often convenient to add a using statement for these instances. E.g.

using NOUN=Aveva.Pdms.Database.DbElementTypeInstance;
MyMethod(NOUN.EQUIPMENT);

4.1.4 DbAttributeInstance

This class contains instances of DbAttribute for every element type in PDMS/Marine. These instances may be used wherever a DbAttribute is expected. E.g. if a method MyMethod() takes a DbAttribute, you could write:

e.g.

MyMethod(Aveva.Pdms.Database.DbAttributeInstance.XLEN);

It is often convenient to add a using statement for these instances. E.g

using ATT=Aveva.Pdms.Database.DbAttributeInstance;
MyMethod(ATT.XLEN);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值