许可优化
许可优化
产品
产品
解决方案
解决方案
服务支持
服务支持
关于
关于
软件库
当前位置:服务支持 >  软件文章 >  AVEVA .Net开发教程4:Database Interface数据库接口

AVEVA .Net开发教程4:Database Interface数据库接口

阅读数 2
点赞 0
article_banner

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);



免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删


相关文章
QR Code
微信扫一扫,欢迎咨询~
customer

online

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 board-phone 155-2731-8020
close1
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

姓名不为空

姓名不为空
手机不正确

手机不正确

手机不正确
公司不为空

公司不为空

公司不为空