What are the object requirements (limitations) for storing an object in RavenDB

I am studying RavenDB for use on the system (mainly as a persistent cache key) and you need to know what are the limitations of the actual data that can be saved.

The documentation says "The only requirement is the property of the identifier string of the root of the entity", however, all the samples and tutorials that I see are stored simply string, int, decimal, bool.

Can this object be saved?

public class StorableObject {
   public string Id {get;set;}
   public object ValueObject {get;set;}
}

Using this (sudo) code?

// I just copy and pasted this from a random blog post -- an example to show a complex object with a lot of hierarchy, methods, properties, etc.
string boundary = Guid.NewGuid().ToString();
HttpWebRequest request = HttpWebRequest.Create("http://twitpic.com/api/uploadAndPost")
    as HttpWebRequest;
request.Method = "POST";
request.ContentType = string.Format("multipart/form-data; boundary={0}", boundary);
request.PreAuthenticate = true;

var objectToStore = new StorableObject { ValueObject = request }; 
session.Store(objectToStore);
session.SaveChanges();

And return it like this:

var storedObject = session.Load<StorableObject>("objects/123456789");
var request = (HttpWebRequest) storedObject.ValueObject;

Thanks for your feedback, please excuse my far-fetched example, it was the easiest way to describe what I'm trying to do without delving into a bunch of domain knowledge / models.

Kyle

+3
source share
2

Raven JSON Json.NET. , , .

+2

RavenDB /.

- , , . "" , .

, - , API : http://ravendb.net/docs/2.5/client-api/attachments

0

Source: https://habr.com/ru/post/1783463/


All Articles