OData / AspNetCoreOData

ASP.NET Core OData: A server library built upon ODataLib and ASP.NET Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReturnsCollectionFromEntitySet not working as expected in AspNetCore.Odata

surajrautela opened this issue · comments

Assemblies affected
AspNetCore.Odata 7.5.12

when i hit https://localhost/beta/$metadata i get the following response(Since the file is huge only copying relevant bits)

EDM (CSDL) Model

<EntityType Name="Recipient">
<Key>
<PropertyRef Name="ObjectId"/>
</Key>
<Property Name="ObjectId" Type="Edm.Guid" Nullable="false"/>
<Property Name="DisplayName" Type="Edm.String"/>
<Property Name="PrimarySmtpAddress" Type="Edm.String"/>
<Property Name="RecipientTypeDetails" Type="Edm.String"/>
<Property Name="Alias" Type="Edm.String"/>
<Property Name="Name" Type="Edm.String"/>
<Property Name="LastModifiedTime" Type="Edm.DateTimeOffset"/>
<Property Name="ArchiveStatus" Type="Edm.String"/>
<Property Name="ArchiveDatabase" Type="Edm.String"/>
<Property Name="ArchiveGuid" Type="Edm.String"/>
<Property Name="EmailAddresses" Type="Collection(Edm.String)"/>
<Property Name="RecipientType" Type="Edm.String"/>
<Property Name="ActiveSyncMailboxPolicy" Type="Edm.String"/>
<Property Name="City" Type="Edm.String"/>
<Property Name="Company" Type="Edm.String"/>
<Property Name="CountryOrRegion" Type="Edm.String"/>
<Property Name="Department" Type="Edm.String"/>
<Property Name="Version" Type="Edm.String"/>
<Property Name="FirstName" Type="Edm.String"/>
<Property Name="LastName" Type="Edm.String"/>
<Property Name="LitigationHoldEnabled" Type="Edm.Boolean"/>
<Property Name="Office" Type="Edm.String"/>
<Property Name="OwaMailboxPolicy" Type="Edm.String"/>
<Property Name="Phone" Type="Edm.String"/>
<Property Name="PostalCode" Type="Edm.String"/>
<Property Name="RetentionPolicy" Type="Edm.String"/>
<Property Name="SharingPolicy" Type="Edm.String"/>
<Property Name="StateOrProvince" Type="Edm.String"/>
<Property Name="Title" Type="Edm.String"/>
<Property Name="UMEnabled" Type="Edm.Boolean"/>
<Property Name="UMMailboxPolicy" Type="Edm.String"/>
<Property Name="ExternalEmailAddress" Type="Edm.String"/>
<Property Name="Capabilities" Type="Collection(Edm.String)"/>
<Property Name="Members" Type="Edm.String"/>
<Property Name="CustomAttribute1" Type="Edm.String"/>
<Property Name="CustomAttribute2" Type="Edm.String"/>
<Property Name="CustomAttribute3" Type="Edm.String"/>
<Property Name="CustomAttribute4" Type="Edm.String"/>
<Property Name="CustomAttribute5" Type="Edm.String"/>
<Property Name="CustomAttribute6" Type="Edm.String"/>
<Property Name="CustomAttribute7" Type="Edm.String"/>
<Property Name="CustomAttribute8" Type="Edm.String"/>
<Property Name="CustomAttribute9" Type="Edm.String"/>
<Property Name="CustomAttribute10" Type="Edm.String"/>
<Property Name="CustomAttribute11" Type="Edm.String"/>
<Property Name="CustomAttribute12" Type="Edm.String"/>
<Property Name="CustomAttribute13" Type="Edm.String"/>
<Property Name="CustomAttribute14" Type="Edm.String"/>
<Property Name="CustomAttribute15" Type="Edm.String"/>
<Property Name="DistinguishedName" Type="Edm.String"/>
</EntityType>

<EntitySet Name="Recipient" EntityType="Test.Recipient"/>

<Function Name="GetRecipientsIC" IsBound="true">
<Parameter Name="bindingParameter" Type="Collection(Test.Recipient)"/>
<ReturnType Type="Collection(Test.Recipient)"/>
</Function>

In side my function i am returning response like this

IList<Recipient> RecipientList = responseMessage.ResponseData as IList<Recipient>;
return this.StatusCode((int)statusCode, RecipientList);

I have verified that data is correct and RecipientList is valid and when an api call is made the code is able to execute return statement.

The response i am getting this:
{"@odata.context":"https://localhost/beta/$metadata#Collection(Test.Recipient)","value":[{"@odata.type":"#Test.Recipient"

which leads to http2 error

i am not able to understand why i am not getting correct response

Kindly share a repro to enable us investigate this issue