当前位置:网站首页>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 , aboutAgeattribute , Can provideAgeGetMethod , This method is based on the current time andDateOfBirthThe value of the attribute determines a person's current age . - Define this attribute as a calculation attribute ; It USES
SqlComputedKeywords 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 :
onemanyparentchildren
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 .
边栏推荐
- Esp32 series column
- 2022-7-6 Leetcode27. Remove the element - I haven't done the problem for a long time. It's such an embarrassing day for double pointers
- QQ medicine, Tencent ticket
- AI人才培育新思路,这场直播有你关心的
- Learning breakout 2 - about effective learning methods
- Final review notes of single chip microcomputer principle
- Toraw and markraw
- ROS机器人更换新雷达需要重新配置哪些参数
- 请问指南针股票软件可靠吗?交易股票安全吗?
- Shell batch file name (excluding extension) lowercase to uppercase
猜你喜欢

室內ROS機器人導航調試記錄(膨脹半徑的選取經驗)

【堡垒机】云堡垒机和普通堡垒机的区别是什么?

Ways to improve the performance of raspberry pie

Redis只能做缓存?太out了!

Battle Atlas: 12 scenarios detailing the requirements for container safety construction

Distributed transaction solution

2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array

使用day.js让时间 (显示为几分钟前 几小时前 几天前 几个月前 )

Leetcode simple question sharing (20)

Help tenants
随机推荐
mysql导入文件出现Data truncated for column ‘xxx’ at row 1的原因
【面试高频题】难度 2.5/5,简单结合 DFS 的 Trie 模板级运用题
Social responsibility · value co creation, Zhongguancun network security and Information Industry Alliance dialogue, wechat entrepreneur Haitai Fangyuan, chairman Mr. Jiang Haizhou
Read PG in data warehouse in one article_ stat
1、深拷贝 2、call apply bind 3、for of for in 区别
Advanced Mathematics - Chapter 8 differential calculus of multivariate functions 1
648. 单词替换 : 字典树的经典运用
单片机学习笔记之点亮led 灯
数据库系统概论-第一章绪论【概念模型、层次模型和三级模式(外模式、模式、内模式)】
【日常训练】648. 单词替换
AI人才培育新思路,这场直播有你关心的
Some principles of mongodb optimization
接口自动化测试-接口间数据依赖问题解决
"New red flag Cup" desktop application creativity competition 2022
High end for 8 years, how is Yadi now?
2022-7-6 beginner redis (I) download, install and run redis under Linux
call undefined function openssl_cipher_iv_length
requires php ~7.1 -> your PHP version (7.0.18) does not satisfy that requirement
最佳实践 | 用腾讯云AI意愿核身为电话合规保驾护航
Getting started with cinnamon applet