OData / RESTier

A turn-key library for building RESTful services
http://odata.github.io/RESTier
Other
473 stars 135 forks source link

[2.0] odata.bind Support #663

Open vvdev opened 4 years ago

vvdev commented 4 years ago

@odata.bind clauses are ignored by RESTier

Assemblies affected

1.0.0-rc1.20191003.1 https://github.com/OData/RESTier/tree/1.0.0-rc1.20191003.1 Also tried with newest Microsoft.AspNet.OData 7.3.0 https://github.com/OData/WebApi/releases/tag/7.3.0

Reproduce steps

Save multiple entities using Batch SaveChangesOptions.BatchWithSingleChangeset One of collection properties of newly created entity instance should get references to on or more existing entities (many to many EF link) - look for @odata.bind in provided payload

Expected result

Many-to-many table should get new value to link newly created entity and already existing entity

Actual result

Table stays empty

Additional details

Payload: `POST http://SERVER/odata/v4/$batch HTTP/1.1 OData-Version: 4.0 OData-MaxVersion: 4.0 Content-Type: multipart/mixed; boundary=batch_8bd8b4e9-fd81-4102-aad6-79dd3c1a85cf Accept: multipart/mixed Accept-Charset: UTF-8 User-Agent: Microsoft.OData.Client/7.6.2 Host: SERVER Content-Length: 4732 Expect: 100-continue

--batch_8bd8b4e9-fd81-4102-aad6-79dd3c1a85cf Content-Type: multipart/mixed; boundary=changeset_5f353196-c528-4bf4-b30f-f41ab5722c9b

--changeset_5f353196-c528-4bf4-b30f-f41ab5722c9b Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: 2

POST http://SERVER/odata/v4/CalculationSetups HTTP/1.1 OData-Version: 4.0 OData-MaxVersion: 4.0 Content-Type: application/json;odata.metadata=minimal Accept: application/json;odata.metadata=minimal Accept-Charset: UTF-8 User-Agent: Microsoft.OData.Client/7.6.2

{"@odata.type":"#Domain.Calculation.CalculationSetupConfiguration","Comment":null,"ProjectId":292,"Id":-2147483647,"Uid":"c369eaf3-1590-48b4-8d57-cde6f5296717"} --changeset_5f353196-c528-4bf4-b30f-f41ab5722c9b Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: 3

POST http://SERVER/odata/v4/CalculationBlocks HTTP/1.1 OData-Version: 4.0 OData-MaxVersion: 4.0 Content-Type: application/json;odata.metadata=minimal Accept: application/json;odata.metadata=minimal Accept-Charset: UTF-8 User-Agent: Microsoft.OData.Client/7.6.2

{"@odata.type":"#Domain.Calculation.Blocks.CalculationBlock","Id":-2147483646,"IsResultWriter":true,"Name":"Facultative 1","SetupId":-2147483647,"Uid":"38c53828-103e-489e-af6a-b29432f53242"} --changeset_5f353196-c528-4bf4-b30f-f41ab5722c9b Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: 7

POST http://SERVER/odata/v4/CalculationBlocks HTTP/1.1 OData-Version: 4.0 OData-MaxVersion: 4.0 Content-Type: application/json;odata.metadata=minimal Accept: application/json;odata.metadata=minimal Accept-Charset: UTF-8 User-Agent: Microsoft.OData.Client/7.6.2

{"@odata.type":"#Domain.Calculation.Blocks.DataAggregatorBlock","Id":-2147483642,"IsResultWriter":true,"Name":"Sum 1","SetupId":-2147483647,"Uid":"ad46b835-ce77-4014-a19b-721a91f641ce","AggregationCriteria@odata.bind":["http://SERVER/odata/v4/DataAttributeRoles(1)"]} --changeset_5f353196-c528-4bf4-b30f-f41ab5722c9b-- --batch_8bd8b4e9-fd81-4102-aad6-79dd3c1a85cf-- `

vincedan commented 4 years ago

please read #610