c# - DocumentStore.DatabaseCommands.PutAttachment silently fails -


following samples in ravendb attachment docs , ravendb attachments - functionality how do?, i'm trying add attachments raven instance following code:

foreach (var currentdoc in docstostore) {   byte[] buff = readbytesfromfile(currentdoc.filepath);   var attachmentid = "attachedpages/" + attachmentcounter;   var stream = new memorystream(buff);    documentstore.databasecommands.putattachment(attachmentid, null, stream, null);   currentdoc.attachments.add(attachmentid);   session.store(currentdoc);  //add new document raven } session.savechanges(); 

i've looked in debugger confirm memorystream has data expect. see reference currentdoc in management studio. however, http://localhost:8080/static/?start=0&pagesize=128 returns empty array.

is there step need take in order save attachments?

the problem documentstore.databasecommands return db commands default database.

you need do:

documentstore.databasecommands.fordatabase("mydb").putattachment 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -