Db4o replication system: NullReferenceException?
I am trying to perform standard bi-directional replication as follows. However, I am getting a NullReferenceException. This is a separate replication project. I imported the classes involved in the original project (like Item, Category, etc.) in this replication project. What am I doing wrong? (If I am debugging using VS, I see that changedObjects has all changed objects, there seems to be some problem inside the Replicate function)
IObjectContainer local = Db4oFactory.OpenFile(@"G:\Work\School\MIS\VINMIS\Inventory\bin\Debug\vin.db4o");
IObjectContainer far = Db4oFactory.OpenFile(@"\\crs-lap\c$\vinmis\vin.db4o"); ;
IReplicationSession replication = Replication.Begin(local, far);
IObjectSet changedObjects = replication.ProviderA().ObjectsChangedSinceLastReplication();
while(changedObjects.HasNext())
replication.Replicate(changedObjects.Next()); // Exception!!!
replication.Commit();
changedObjects = replication.ProviderB().ObjectsChangedSinceLastReplication();
while (changedObjects.HasNext())
replication.Replicate(changedObjects.Next());
replication.Commit();
Hello,
Saurabi.
0
a source to share
1 answer
It looks like you forgot to set up your databases with UUIDs and version numbers. In the official documentation :
public static IConfiguration ConfigureReplication()
{
IConfiguration db4oConfig = Db4oFactory.NewConfiguration();
db4oConfig.GenerateUUIDs(ConfigScope.Globally);
db4oConfig.GenerateVersionNumbers(ConfigScope.Globally);
return db4oConfig;
}
0
a source to share