属性 上属性设置的目的

Purpose of Attributes settings on property

模型 属性 上属性设置的目的是什么?

我已经阅读了有关子制作人的信息,并希望实现此处描述的内容:http://www.softfluent.com/product/codefluent-entities/knowledge-center/how-to-add-attributes-to-codefluent-generated-properties

尝试在 属性 上设置属性会修改 XML 但不会被 BOM 生产者选中,有什么原因吗?

在下面的示例中,我希望在我的 MyProperty 属性 上方有一个装饰,但它没有发生。

感谢您的回答,

<cf:property name="MyProperty" typeName="{0}.Namespace.MyEntity" relationSchema="Schema">
      <cf:attribute name="Newtonsoft.Json.JsonIgnore" context="Property" class="">
        <cf:argument name="arg1" expression="value1" />
      </cf:attribute>
    </cf:property>

BOM 生产者使用属性。但是,您设置的 context 不符合您的需要。事实上 属性 是一个关系 属性 所以你必须使用 context="ToOneRelationKeyProperty, ToOneRelationProperty, ToManyRelationProperty, RelationProperties" (你可以只保留这些值之一)或默认值。

<cf:entity name="Customer">
  <cf:property name="Id" key="true" />
  <cf:property name="Orders" typeName="OrderCollection">
    <cf:attribute name="Newtonsoft.Json.JsonIgnore" class="" context="RelationProperties">
      <cf:argument name="arg1" expression="value1" />
    </cf:attribute>
  </cf:property>
</cf:entity>

BOM 生产者生成:

[Newtonsoft.Json.JsonIgnore(arg1=value1)]
public Model1.OrderCollection Orders