[3.5] Getting replication settings in C#

19 views
Skip to first unread message

Chris Fellows

unread,
Jun 21, 2017, 11:51:59 AM6/21/17
to RavenDB - 2nd generation document database
In C# then do I read the replication settings? I want to read the URL and database name for the target Raven database so that I can connect to it. Replication is working OK.

I can get the replication destinations (See below) but how do I convert it (replicationDestinations.DataAsJson) to an array?

var replicationDestinations = store.DatabaseCommands.Get("Raven/Replication/Destinations");

Oren Eini (Ayende Rahien)

unread,
Jun 21, 2017, 1:37:58 PM6/21/17
to ravendb

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Tal Weiss

unread,
Jun 22, 2017, 4:25:53 AM6/22/17
to RavenDB - 2nd generation document database
Can you try :
var destinations = session.Load<Raven.Abstractions.Replication.ReplicationDestination>("Raven/Replication/Destinations/<your database name>");

On Thu, Jun 22, 2017 at 10:44 AM, Chris Fellows <chrisfe...@gmail.com> wrote:
If I load the document with this class (See below) then it returns a ReplicationDestination with default values and not the values that I can see in the replication settings web page.

This code returns a ReplicationDestination with default settings:
var destinations = session.Load<Raven.Abstractions.Replication.ReplicationDestination>("Raven/Replication/Destinations");

NOTE: I'm also confused as to why loading "Raven/Replication/Destinations" returns a single instance and not an array. It isn't returning the first item because the values are all defaults. It's my understanding that a Raven db can be replicated to multiple destinations.

This code returns null, obviously because this isn't a valid document:
var destination = session.Load<Raven.Abstractions.Replication.ReplicationDestination>("Raven/Replication/Destination");

This code gets an array of JSON strings for each destination but I have no idea how to convert each one to a ReplicationDestination:
var replicationDestinations = store.DatabaseCommands.Get("Raven/Replication/Destinations");
var destinationsJSON = replicationDestinations.DataAsJson["Destinations"];                    

So how to I get an array of ReplicationDestination instances?

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Tal Weiss l Core Team Developer Mobile:+972-54-802-4849

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811l Skype: talweiss1982

RavenDB paving the way to "Data Made Simplehttp://ravendb.net/ 

Oren Eini (Ayende Rahien)

unread,
Jun 22, 2017, 5:50:02 AM6/22/17
to ravendb

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


On Thu, Jun 22, 2017 at 10:44 AM, Chris Fellows <chrisfe...@gmail.com> wrote:
If I load the document with this class (See below) then it returns a ReplicationDestination with default values and not the values that I can see in the replication settings web page.

This code returns a ReplicationDestination with default settings:
var destinations = session.Load<Raven.Abstractions.Replication.ReplicationDestination>("Raven/Replication/Destinations");

NOTE: I'm also confused as to why loading "Raven/Replication/Destinations" returns a single instance and not an array. It isn't returning the first item because the values are all defaults. It's my understanding that a Raven db can be replicated to multiple destinations.

This code returns null, obviously because this isn't a valid document:
var destination = session.Load<Raven.Abstractions.Replication.ReplicationDestination>("Raven/Replication/Destination");

This code gets an array of JSON strings for each destination but I have no idea how to convert each one to a ReplicationDestination:
var replicationDestinations = store.DatabaseCommands.Get("Raven/Replication/Destinations");
var destinationsJSON = replicationDestinations.DataAsJson["Destinations"];                    

So how to I get an array of ReplicationDestination instances?

--
Reply all
Reply to author
Forward
0 new messages