如何在 ConFluent 中定义自反关联

How to define a reflexive assocation in CodeFluent

在 code fluent 中定义自反关联的正确方法是什么。 给定这个例子,设计正确显示,但这一代人会遇到随附的错误消息:

Error CF0036: Type for property 'OldEntityA' of entity 'Namespace.EntityA' must be a project entity if 'relationPropertyName' attribute is specified.

<cf:entity name="EntityA" namespace="Namespace" categoryPath="/Category">
<cf:property name="Id" key="true" collectionKey="false" />
<cf:property name="Url" collectionKey="false" />
<cf:property name="OldEntityA" typeName="Namespace.EntityA" relationPropertyName="Unspecified" collectionKey="false" />

提前致谢,

您必须删除 relationPropertyName 属性或将其值设置为有效的 属性 名称:

<cf:entity name="Category">
  <cf:property name="Id" key="true" />
  <cf:property name="Name" />
  <cf:property name="Parent" typeName="{0}.Category" relationPropertyName="Children" />
  <cf:property name="Children" typeName="{0}.CategoryCollection" relationPropertyName="Parent" />
</cf:entity>