4数据库接口theclassesfallintothefollowinggroups 3360
这个班分为以下几个组。
数据模型定义类
基本数据库访问,query and modification。
过滤器和迭代器
da bacon表访问
DB,MDB,Project access
eventsandpseudoattributeplugins
数据模型定义类
基本数据库访问、查询和修改
过滤和循环
数据备份表访问
数据库、数据库组、项目访问
事件和隐式属性
4.1 datamodeldefinitionclassestheclassesare :
DbElementType
DbAttribute
DbElementTypeInstance
DbAttributeInstance
该类包括:
数据库元素类型
数据库属性
数据库元素类型的实例
数据库属性实例
4.1.1 DbElementType数据库元素类型Overview
thereisasingleclassforallelementtypes。
类包含所有元素类型。
The purpose of the class is to:
instancesoftheclassidentifytheelementtype.I.e.methodsonotherclassestakeadbelementtypeasanargumentratherthanastringtodenodenope has‘value’semanticsforcomparisonpurposes.I.e.comparingoftwodbelementtypeswillalwaysreture r to the same type,even if then
accessthemetadataassociatedwithelementtypes。
External to PDMS/Marine,thehashvaluecanbeusedtouniquelyidentifyanelementtype.thehashvalueisa 32 bit integer。
该类的用途如下:
这个类的实例确定元素类型。 例如,在其他类的方法中,将DbElementType作为参数而不是字符串来调用以表示元素类型。 此DbElementType可用于比较。 例如,如果两个不同的对象具有相同的类型,则在比较时返回True。
Constructors 构造方法
Inc # adbelementtypeobjectmaybeobtainedinoneofthreeways :
在C#中获取DbElementType对象有三种方法。
usethegloballydefinedinstancesindbelementtypeinstance.thisistherecommendedandeasiestwaytoobtainadbelementtype。
使用DbElementTypeInstance实例是推荐的最简单的DbElementType检索方法。
示例:
elem.getelementtype (==dbelementtypeinstance.equipment ) )。 thestatic‘getelementtype’methodmaybeusedtoreturnadbelementtypegiventheelementtypename.thisisonlyneededforudets.thecololorets
GetElementType静态方法可用于指定特定元素类型的名称,然后返回DbElementType。 它仅用于用户定义的元素类型(UDETs ),名称前必须加冒号。
thereisalsoastatic‘getelementtype’methodthatmaytobeusedtoreturnadbelementtypegiventhehashvalue.thisisonlyneed
ed 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.
NameDescriptionBaseType (for UDETs)List of attributesList of UDAsAllowed membersAllowed ownersTypes that may appear above this element typeTypes that may appear below this element typeElement types that may be referenced from a given attribute on this element typeDatabase 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 TypeDescriptionHLISDbElementType[]List of all possible types in owning hierarchyLISTDbElementType[]List of all possible member typesLLISDbElementType[]List of all possible types in member hierarchyOLISDbElementType[]List of all possible owner typesREPTXTStringReporter text used for element typeATTLISTDbAttribute[]List of all visible attributes for elementPSATTSDbAttribute[]List of pseudo attributesUDALISDbAttribute[]List of UDAs4.1.2 DbAttributeOverview
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, lengthIdentify 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:
Use globally defined instances. Each attribute has a globally declared instance in the DbAttributeInstance class. This is the standard way of specifying an attribute.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.Look up the DbAttribute given the attribute hash value. Generally this is only needed if reading the hash value from an external system.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 TypeUnitsNameDescriptionCategorySizeAllowed ValuesAllowed rangesIs a UDAIs a pseudo attributeWhether 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 DbElementTypeInstanceThis 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 DbAttributeInstanceThis 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);