http put includes Id property in document on server while using the .net client to save the document to the server does not include the Id property

6 views
Skip to first unread message

balazs

unread,
Jul 9, 2014, 11:02:39 AM7/9/14
to rav...@googlegroups.com
Take the following class:
class Account
{
   public string Id { get; set;}
   public string Description { get; set;
}

If I try to save an account object with Id of "123" and Description of "abc" using the .net client, it will be persisted as:
{
  "Description": "abc"
}

If I put the following document to http://localhost:8080/databases/test/docs/accounts/123 it will be persisted as:
{
   "Id": "123",
  "Description": "abc"
}

Why does this happen, and how do I persist a document using the http api that will follow the same format as that which is used by the .net client?

Balazs Czifra

unread,
Jul 9, 2014, 11:30:02 AM7/9/14
to rav...@googlegroups.com
Aha- I see that in Raven.Client.Document.EntityToJson.ConvertEntityToJson(...) you remove the id property from the RavenJObject.  I suppose then I just have to serialize my document accordingly before I put it to the server.


--
You received this message because you are subscribed to a topic in the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ravendb/2LGb5wMDin8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oren Eini (Ayende Rahien)

unread,
Jul 9, 2014, 11:34:43 AM7/9/14
to ravendb
Yes, that is it.



Oren Eini

CEO


Mobile: + 972-52-548-6969

Office:  + 972-4-622-7811

Fax:      + 972-153-4622-7811





--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages