vb.net - Fetching Records from multiple tenant in RavenDB -
i using embeddabledocumentstore records stored in raven.
below vb.net code access raven data
dim documentstore embeddabledocumentstore = new embeddabledocumentstore() documentstore.datadirectory = "d:\test\server1" documentstore.defaultdatabase = "testdb1" documentstore.url = "http://localhost:8585/" documentstore.initialize() dim session document.documentsession = documentstore.opensession() dim lineitems = session.query(of lineitem)()
above code retrieves records database testdb1, have testdb2 database
now have 2 question
how access records
server1.testdb1.lineitem
,server1.testdb2.lineitem
how access records
server1.testdb1.lineitem
,server2.testdb1.lineitem
a few things:
you should opening session within
using
statment.when so, can pass database name parameter
opensession
method.if regularly working multiple databases, should pass database name every time open session, instead of assigning default database.
an
embeddabledocumentstore
runs in context of process executing it, not connecting server. url used when using regulardocumentstore
, connecting ravendb instance running elsewhere - in casedatadirectory
not used.if using
documentstore
, connecting servers elsewhere, need 2 separate instances ofdocumentstore
- 1 server1 , server2.however, doesn't make sense run 2 separate
embeddabledocumentstore
instances in same process. work, can't see advantage.
Comments
Post a Comment