我正在编写基于 WebApi asp.net 的 OData 服务,我正在构建自己的 EDM
ODataModelBuilder builder = new ODataModelBuilder();
builder.Namespace = "Models";
EntitySetConfiguration<Incident> incident = builder.EntitySet<Incident>("Incidents");
incident.EntityType.HasKey(c => c.IncidentID);
incident.EntityType.Property(c => c.Name);
incident.EntityType.Property(c => c.IncidentType);
incident.EntityType.Property(c => c.Description);
incident.HasIdLink(eic =>
{
return eic.GenerateSelfLink(false);
}, false);
var hasManyComments = incident.EntityType.HasMany(c => c.IncidentComments);
incident.HasNavigationPropertyLink(hasManyComments, (z, y) =>
{
return z.GenerateNavigationPropertyLink(y, false);
}, false);
EntitySetConfiguration<IncidentComment> incidentComment = builder.EntitySet<IncidentComment>("IncidentComments");
incidentComment.EntityType.HasKey(c => c.CommentID);
incidentComment.EntityType.Property(c => c.IncidentID);
incidentComment.EntityType.Property(c => c.Content);
incidentComment.HasIdLink(eic =>
{
return eic.GenerateSelfLink(false);
}, false);
我正在作为客户端测试 BreezeJS 和 wcf 数据客户端。当我试图在网络中获取事件时,我看到事件属性和评论都通过了,但是在 wcf 客户端中我得到空的评论集合以及微风测试,我怀疑元数据不正确,什么我失踪了吗