0

Model プロパティの属性設定の目的は何ですか?

サブプロデューサーについて読み、ここで説明されていることを達成したいと思います: http://www.softfluent.com/product/codefluent-entities/knowledge-center/how-to-add-attributes-to-codefluent-generated-プロパティ

プロパティに属性を設定しようとすると、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>
4

1 に答える 1

1

属性は、BOM プロデューサーによって使用されます。ただしcontext、ニーズに合わない を設定します。実際、プロパティは関係プロパティであるため、使用する必要がありますcontext="ToOneRelationKeyProperty, ToOneRelationProperty, ToManyRelationProperty, RelationProperties"(これらの値の 1 つだけを保持できます) または既定値を使用します。

<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
于 2016-04-26T17:40:41.477 に答える