-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.0] Support Nested Entities #646
Comments
Hey @iwate, great to meet you. Based on how the specification works, you can't have a POST or a PUT that has child entities in navigation properties. Entities are supposed to be created separately and then LINKed together (though I just usually set the ForeignKeyId manually in my payload without attaching the entity, and it works fine). Because the current behavior is according to spec, we cannot accept a PR that changes this code. However, if you wanted to look into Delta payload support, we would probably take a PR for that. Thanks! |
Actually, if he's referring to a "deep insert" it was added to the OData spec in version 4.0, see section 11.4.2.1 and 11.4.2.2. Version 4.1 also included a "deep update" (section 11.4.3.1) which would be interesting to see implemented. I couldn't find any documentation though on how it's handled in Microsoft.AspNet.Odata or if either is supported, so it still might not be a thing that could be easily implemented. |
Ah, I was not aware that 4.0 had a "deep insert" spec.... that wasn't allowed in 3.0. I'll bring it up with Mike when we meet for the OData Show next week, but I don't know that we'd be able to support it without unwanted side effects. 4.01's deep updates are now supported in Microsoft.AspNet.OData, but we won't be supporting them in Restier before 1.0 RTMs (which is hopefully in a couple weeks), as it will likely take quite a bit of effort. I know that the "changeset" design in Restier was supposed to handle that, but it's really hard for me to get my head around, and has little documentation. We really need to just ship 1.0 so we can scrap the codebase and rebuild the pipeline with modern tools. If the interception pipeline were cleaner, then it would be easier to rip apart simple payloads, deep payloads, and delta payloads, and shove the entities through the pipeline. Does that make sense? |
Makes sense to me. Thanks! |
Hi, @robertmclaws , @Tiberriver256 Thank you response:)
I'm sorry, I did not read specification enough. I'll read it more! But, currently, OData v3 can create entity with navigation property (Maybe, this behavior is different from the specification and this is custom by MS)
The spec is a bit different from my opinion. (odata.bind seems like operation for many to many relationship. My expected behavior is for one to one.) |
@iwate I've implemented it by accepting all types of EdmStructuredObject and delegating "postprocessing" materialized objects to convention methods OnDeepInsertXYZ, OnDeepUpdateXYZ etc. I'm not up to date with Restier, but it should still work. |
RESTier/src/Microsoft.Restier.AspNet/Extensions/Extensions.cs
Lines 94 to 99 in 301b64c
I want to create a few entities (1to1 relation) in a request. So I need to use it.
Or I want to use navigation post in a batch request.
Either's fine, However both ways are not supported.
May you check it if I create PR?
Or, Do you already have any plan and you cannot accept the feature?
The text was updated successfully, but these errors were encountered: