Navigation Property - problem with the metadata

Topics: ASP.NET Web API
May 25, 2013 at 5:11 AM
hi
in out project we are using
ODataModelBuilder builder = new ODataModelBuilder();

            builder.Namespace = "Stabilis.Situator.OpServerTypes";

            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);
i have tested it against BreezeJS and also wcf data client on both i am not getting the IncidentComments - i am getting empty collection, but with sniffer i can see that this data is transferred, so i can guess that it is related to the metadata

<EntityType Name="Incident">
<Key>
<PropertyRef Name="IncidentID"/>
</Key>
<Property Name="IncidentID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Name" Type="Edm.String"/>
<Property Name="IncidentType" Type="Edm.Int32" Nullable="false"/>
<Property Name="Description" Type="Edm.String"/>
<NavigationProperty Name="IncidentComments" Relationship="Stabilis.Situator.OpServerTypes.Stabilis_Situator_OpServerTypes_Incident_IncidentComments_Stabilis_Situator_OpServerTypes_IncidentComment_IncidentCommentsPartner" ToRole="IncidentComments" FromRole="IncidentCommentsPartner"/>
</EntityType>
<EntityType Name="IncidentComment">
<Key>
<PropertyRef Name="CommentID"/>
</Key>
<Property Name="CommentID" Type="Edm.Int32" Nullable="false"/>
<Property Name="IncidentID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Content" Type="Edm.String"/>
</EntityType>

<Association Name="Stabilis_Situator_OpServerTypes_Incident_IncidentComments_Stabilis_Situator_OpServerTypes_IncidentComment_IncidentCommentsPartner">
<End Type="Stabilis.Situator.OpServerTypes.IncidentComment" Role="IncidentComments" Multiplicity="*"/>
<End Type="Stabilis.Situator.OpServerTypes.Incident" Role="IncidentCommentsPartner" Multiplicity="0..1"/>
</Association>
<EntityContainer Name="Container" m:IsDefaultEntityContainer="true">
<EntitySet Name="Incidents" EntityType="Stabilis.Situator.OpServerTypes.Incident"/>
<EntitySet Name="IncidentComments" EntityType="Stabilis.Situator.OpServerTypes.IncidentComment"/>
<EntitySet Name="ExtendedProperties" EntityType="Stabilis.Situator.OpServerTypes.IncidentExtendedProperty"/>
<EntitySet Name="Deployments" EntityType="Stabilis.Situator.OpServerTypes.Deployment"/>
<EntitySet Name="DTasks" EntityType="Stabilis.Situator.OpServerTypes.DTask"/>
<EntitySet Name="DTaskComments" EntityType="Stabilis.Situator.OpServerTypes.DTaskComment"/>
<EntitySet Name="DTaskEvents" EntityType="Stabilis.Situator.OpServerTypes.DTaskEvent"/>
<EntitySet Name="Assets" EntityType="Stabilis.Situator.OpServerTypes.Asset"/>
<AssociationSet Name="Stabilis_Situator_OpServerTypes_Incident_IncidentComments_Stabilis_Situator_OpServerTypes_IncidentComment_IncidentCommentsPartnerSet" Association="Stabilis.Situator.OpServerTypes.Stabilis_Situator_OpServerTypes_Incident_IncidentComments_Stabilis_Situator_OpServerTypes_IncidentComment_IncidentCommentsPartner">
<End Role="IncidentCommentsPartner" EntitySet="Incidents"/>
<End Role="IncidentComments" EntitySet="IncidentComments"/>
</AssociationSet>
</EntityContainer>