当前位置:网站首页>Attribute keywords aliases, calculated, cardinality, ClientName
Attribute keywords aliases, calculated, cardinality, ClientName
2022-07-07 13:52:00 【User 7741497】
Chapter 93 Attribute keyword - Aliases
Specify a different name for this property , In order to use through object access .
usage
To specify a different name for the attribute , Please use the following syntax :
Property name As classname [ Aliases=othernames ];
among othernames
Is a comma separated list of valid attribute names , Enclosed in braces .
Detailed explanation
If you specify an alias keyword , The compiler will create one or more given aliases , These aliases point to the same basic data that the original attribute points to . for example , Redefinition Sample.Person
Of Name
attribute , As shown below :
Property Name As %String(POPSPEC = "Name()") [ Aliases = {Alternate}, Required ];
then , The code can be used Name
Attribute or equivalent Alternate
attribute , As shown in the following terminal session :
SAMPLES>set p=##class(Sample.Person).%OpenId(1)
SAMPLES>w p.Name
Fripp,Charles Z.
SAMPLES>w p.Alternate
Fripp,Charles Z.
SAMPLES>set p.Alternate="Anderson,Neville J."
SAMPLES>w p.Name
Anderson,Neville J.
Any attribute method associated with the original attribute is also defined for each alias attribute , So in this case ,AlternateIsValid()
It's callable , And back with NameIsValid()
The same result . Besides , If the attribute method is overridden ( for example , Write custom NameGet()
Method ), Then the override will be automatically applied to one or more alias properties .
Be careful : This keyword is for attribute SQL Projection has no effect .
Default
By default , This keyword is NULL, And the attribute has no alias .
Example
Property PropA As %String [ Aliases={OtherName,OtherName2} ];
Chapter 94 Attribute keyword - Calculated
Specifies that when instantiating an object containing this property , There is no memory allocated for it .
usage
To specify that no in memory storage is allocated for this attribute , Please use the following syntax :
Property name As classname [ Calculated ];
otherwise , Please omit the keyword or put the word before the keyword .
Detailed explanation
This keyword specifies that when instantiating an object containing this attribute , No memory storage is allocated for this attribute .
When defining attributes that do not require any memory storage , Please use this keyword . There are two ways to specify the value of this property :
- Defining properties
get
( There may beset
) Method . for example , aboutAge
attribute , Can provideAgeGet
Method , This method is based on the current time andDateOfBirth
The value of the attribute determines a person's current age . - Define this attribute as a calculation attribute ; It USES
SqlComputed
Keywords and related keywords .
Subclasses inherit calculated keywords , It cannot be rewritten .
Default
Calculated
The default value of the keyword is False
.
Property Age as %Integer [ Calculated ];
Chapter 95 Attribute keyword - Cardinality
Specify the cardinality of this relationship property cardinality
. Relationship properties Required
. Not used for other properties .
usage
To specify the cardinality of the Relationship Attribute , Please use the following syntax :
Relationship relname As classname [ Cardinality = cardinality; inverse = inverse ];
among cardinality
Is one of the following :
one
many
parent
children
Detailed explanation
This keyword specifies the Relationship Attribute cardinality
.
Relationship attributes need cardinality
keyword . It is ignored by non relational attributes .
Default
No default . When defining relationships , Must specify Cardinality
keyword .
Example
Relationship Chapters As Chapter [ Cardinality = many; inverse = Book ];
Chapter 96 Attribute keyword - ClientName
Specify the alias used by the client projection of this property .
usage
To override the default name of this property when projecting a class to the client language , Please use the following syntax :
Property name As classname [ ClientName = clientname ];
among clientname
Is the name used in the client language .
Detailed explanation
When attributes are projected to the client language , This keyword allows you to define alternative names for attributes . If the attribute name contains characters that are not allowed in the client language , This is especially useful .
Default
If you omit this keyword , The attribute name will be used as the client name .
边栏推荐
- toRaw和markRaw
- How far can it go to adopt a cow by selling the concept to the market?
- xshell连接服务器把密钥登陆改为密码登陆
- 648. Word replacement: the classic application of dictionary tree
- 10 pictures open the door of CPU cache consistency
- [QNX hypervisor 2.2 user manual]6.3.4 virtual register (guest_shm.h)
- Error lnk2019: unresolved external symbol
- 华为镜像地址
- TPG x AIDU | AI leading talent recruitment plan in progress!
- Enregistrement de la navigation et de la mise en service du robot ROS intérieur (expérience de sélection du rayon de dilatation)
猜你喜欢
2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array
Build a secure and trusted computing platform based on Kunpeng's native security
Did login metamask
交付效率提升52倍,运营效率提升10倍,看《金融云原生技术实践案例汇编》(附下载)
2022-7-6 sigurg is used to receive external data. I don't know why it can't be printed out
How far can it go to adopt a cow by selling the concept to the market?
Esp32 ① compilation environment
2022-7-6 使用SIGURG来接受外带数据,不知道为什么打印不出来
如何让join跑得更快?
2022-7-7 Leetcode 844.比较含退格的字符串
随机推荐
118. 杨辉三角
mysql导入文件出现Data truncated for column ‘xxx’ at row 1的原因
"Song of ice and fire" in the eleventh issue of "open source Roundtable" -- how to balance the natural contradiction between open source and security?
内存溢出和内存泄漏的区别
2022-7-6 beginner redis (I) download, install and run redis under Linux
Sliding rail stepping motor commissioning (national ocean vehicle competition) (STM32 master control)
带你掌握三层架构(建议收藏)
2022-7-7 Leetcode 844.比较含退格的字符串
Flink | 多流转换
2022-7-6 Leetcode 977. Square of ordered array
MySQL error 28 and solution
Evolution of customer service hotline of dewu
ROS机器人更换新雷达需要重新配置哪些参数
[1] Basic knowledge of ros2 - summary version of operation commands
.net core 关于redis的pipeline以及事务
TPG x AIDU | AI leading talent recruitment plan in progress!
JS slow motion animation principle teaching (super detail)
Centso7 OpenSSL error Verify return code: 20 (unable to get local issuer certificate)
Custom thread pool rejection policy
供应链供需预估-[时间序列]