I have a POST request for an Odita controller whose unit is attached with Navigation Properties, and I would like to all these After solving the posts, they will come back. Instead, the only attribute for the unit that holds the column in the DB table indicates that unit.
I am calling this method:
// POST: public / ASCNC work in Odata / Link & lt; IHttpActionResult & gt; Post (link link) {link.ImageId = HelperModule.GetThumb (link.WebsiteUrl, 400, 300); Link.CreatedOn = DateTime.Now; Db.Links.Add (link); Wait db.SaveChangesAsync (); / * We now have the link saved in the link that we need to add to the enclosed views / foreach (link link in the link .broad link) {bl.LinkId = link.LinkId; Bl.IsActive = True; Db.BoardLinks.Add (BL); } Wait db.SaveChangesAsync (); Return made (link); }
Here is the unit:
Public category links {public date time? Created {Received; Set; } Public string description {get; Set; } Public String ImageId {get; Set; } [Key] Public Link Link ID {Received; Set; } The name of the public string {get; Set; } Public string website url {get; Set; } /// & lt; Summary & gt; /// Last modified time for this object. /// & lt; / Summary & gt; [Timestamp] Public Byte [] Timestamp {Receive; Set; } Public identification & lt; LinkGrade Level & gt; Linkgrad Levels {Get; Set; } Public icon & lt; LinkCategory & gt; Link categories {get; Set; } [NotMapped] public list & lt; BoardLink & gt; Board Links {Get; Set; }}
Here is the table for the unit:
When I set a breakpoint on the return of the post method, I can see that the linkgrad level, link category, and board links are set in. These three above mentioned items are the navigation properties Are there. I have configured them in the EDM model as you can see below:
/// & lt; Summary & gt; /// odata creates models for end points. /// & lt; / Summary & gt; /// & lt; Returns & gt; IEdmModel for Odeta & Lt; / Returns & gt; Private Static IEdmModel GeneratedAdam Model () {var Builder = New ODataConventionModelBuilder (); Builder.EntitySet & LT; Board & gt; ("Boards"); Builder.EntitySet & LT; BoardLink & gt; ("Boardlinks"); Builder.EntitySet & LT; Category & gt; ("Categories"); Builder.EntitySet & LT; GradeLevel & gt; ("Gradelevels"); Builder.EntitySet & LT; Link & gt; ( "Link"); Builder.EntitySet & LT; LinkCategory & gt; ("Linkcategories"); Builder.EntitySet & LT; LinkGradeLevel & gt; ("Linkgradelevels"); Return Builder GetEdmModel (); }
When the link is returned from the client side, it does not have any navigation property from it and only created in it, description, image id, link id, name, website URL and timestamp Why is it like this? Do I have to do something special so that she can return everything to POST request?
Edit: I have to tell that I have made a return method a link and it did not work and whatever I mentioned is back. I have also tried to return the following at the end of my existing POST method:
return (link);
It was not working too, this I returned the same thing as I listed above.
If you request data from the ODATA provider, then you may include the referenced resource inline $ extension
can include it can be implicit or explicit (see).
According to the post data, the server "... is sending the last state of the resource back to the customer." And "the entry being made may have links to other entries in the service."
I think that Microsoft reads that the information being returned is only the object, again to regain the full object, you will have to recover the data again with GET.
No comments:
Post a Comment