【发布时间】:2010-07-02 12:56:14
【问题描述】:
谁能告诉我如何使用实体框架(代码优先/仅代码)为 Ado.Net 数据服务自定义 OData 提要?
没有 EDMX 文件(因为它只是代码)。
我已经尝试添加属性:
[EntityPropertyMapping( "Id" , SyndicationItemProperty.Title , SyndicationTextContentKind.Plaintext , true )]
到我的 POCO 实体类,但提要标题标签中没有显示任何内容?
更新:
如果我使用的是 EDMX 文件,我可以通过应用如下属性来自定义提要:
<EntityType Name="Customer">
<Property Name="myAddress" Type="MyModelNamespace.Address"
me:EpmSourcePath="Street"
m2:FC_Atom="true"
m2:FC_TargetPath="EpmSyndicationTitle"
m2:FC_ContentKind="EpmPlaintext"
m2:FC_KeepContent="true"/>
</EntityType>
但我没有使用 EDMX 文件 - 我使用的是纯代码。我的问题是关于在仅使用代码(无 XML 文件)时实现相同的目标。
谢谢!
【问题讨论】:
标签: c# wcf-data-services odata