.cto文件中使用的'o'和箭头符号之间有区别吗? [英] Different between 'o' and arrow symbol used in .cto file?

查看:123
本文介绍了.cto文件中使用的'o'和箭头符号之间有区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对模型文件中使用的'o'和'->'有点困惑,例如:

I am bit confused between 'o' and '-->' used in Model file, For example :

asset Field identified by assetId {
    o String assetId
    o Customer owner
    --> Customer custId
}

participant Customer identified by customerId {
    o String customerId
} 

"o客户所有者"和->客户custId"之间有什么区别?

what is difference between "o Customer owner" and "--> Customer custId"?

推荐答案

o表示这是类的o wned属性.又名田野".这意味着,当删除该类的实例时,其所有属性也将删除.

The o indicates that this is an owned property of a class. Aka a "field". That means that when the instance of the class is removed, so are all its properties.

-->表示这是与另一个可寻址资源的关系.又称为指针或主/外键实体关系.

The --> indicates that this is a relationship to another addressable resource. Aka a pointer or primary/foreign key entity relationship.

在您的示例中,资产Field具有称为所有者的属性或类型Customer.删除Field的实例时,它们存储在owner属性中的Customer实例也将被删除.

In your example, your asset Field has a property or type Customer called owner. When instances of Field are deleted the instances of Customer that they are storing in the owner property are also deleted.

Field资产还与存储在名为custId的属性中的Customer实例有关系.删除Field的实例将删除关系所指向的Customer的实例.

The Field asset also has a relationship to a Customer instance stored in a property called custId. Deleting an instance of Field will not delete the instance of Customer that is being pointed to by the relationship.

编辑器关系本质上是类型指针.它们是所指向资源的标准类型名称,以及所指向实例的标识.

Composer relationships are essentially typed-pointers. They are a fully-qualified type name of the resource that is being pointed to, as well as the identified of the instance that is being pointed to.

在Composer中,关系不级联删除,并且不存在对关系的引用完整性检查.由应用程序来检查关系结束时的资源是否存在,并做出适当的响应.

In Composer relationships do not cascade-delete, and there is no referential integrity checking for relationships. It is up to the application to check whether the resource that is at the end of a relationship exists or not, and to respond appropriately.

请注意,将来我们可能会阻止对资产和参与者使用o.这确实没有多大意义,而且对于希望在各自的注册表中找到它们的人们来说是一种困惑.对于资产和参与者,人们应该使用-->.

Note that in the future we may prevent using o with assets and participants. It really doesn't make much sense and is confusing for people that expect to find them in their respective registries. For assets and participants people should use -->.

这篇关于.cto文件中使用的'o'和箭头符号之间有区别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆