Hi,
On SCPI Data Data Services I created an Employee OData Service with EmployeeSummary to get all employee id and name, and Employee, to get a specific employee details (odatas1.png).
I have created also association in order to use the feature of NavigationProperty.
This is my EDMX schema:
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> <edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="2.0"> <Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="S1"> <EntityType Name="EmployeeSummary"> <Key> <PropertyRef Name="key"/> </Key> <Property Name="id" Type="Edm.String" Nullable="false"/> <Property Name="key" Type="Edm.String" Nullable="false"/> <Property Name="employee_name" Type="Edm.String" Nullable="true" MaxLength="40" Unicode="true" FixedLength="false"/> <NavigationProperty FromRole="EmployeeSummaryRole" Name="EmpRef" Relationship="S1.FK_EmployeeSummary_Employee" ToRole="EmployeeRole"/> </EntityType> <EntityType Name="Employee"> <Key> <PropertyRef Name="id"/> </Key> <Property Name="id" Type="Edm.String" Nullable="false"/> <Property Name="employee_name" Type="Edm.String" Nullable="true" MaxLength="40" Unicode="true" FixedLength="false"/> <Property Name="employee_salary" Type="Edm.String" Nullable="true" MaxLength="40" Unicode="true" FixedLength="false"/> <Property Name="employee_age" Type="Edm.String" Nullable="true" MaxLength="40" Unicode="true" FixedLength="false"/> </EntityType> <Association Name="FK_EmployeeSummary_Employee"> <End Multiplicity="1" Role="EmployeeRole" Type="S1.Employee"/> <End Multiplicity="1" Role="EmployeeSummaryRole" Type="S1.EmployeeSummary"/> <ReferentialConstraint> <Principal Role="EmployeeSummary"> <PropertyRef Name="key"/> </Principal> <Dependent Role="Employee"> <PropertyRef Name="id"/> </Dependent> </ReferentialConstraint> </Association> <EntityContainer Name="EC1" m:IsDefaultEntityContainer="true"> <EntitySet Name="Employees" EntityType="S1.EmployeeSummary"/> <EntitySet Name="Employee" EntityType="S1.Employee"/> <AssociationSet Association="S1.FK_EmployeeSummary_Employee" Name="CN_TO_C_AssocSet"> <End EntitySet="Employee" Role="EmployeeRole"/> <End EntitySet="Employees" Role="EmployeeSummaryRole"/> </AssociationSet> </EntityContainer> </Schema> </edmx:DataServices> </edmx:Edmx>
When I call /Employees (odatas2.png flow) I get /Employees('1')/EmpRef reference
<link href="Employees('1')/EmpRef" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/EmpRef" title="EmpRef" type="application/atom+xml;type=entry" /> <content type="application/xml"> <m:properties> <d:id>1</d:id> <d:key>1</d:key> <d:employee_name>Sevan Haddeler</d:employee_name> </m:properties> </content>
then I proceed with the employee details invoking the reference link (eg: /Employees('1')/EmpRef).
Unfortunately I get a not found because the key (id) is not passed to the second flow (odatas3.png flow):
"LoggerScript output":
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <Employee> <Employee> <id/> </Employee> </Employee>
Where am I wrong?
Thank you in advance.