db4o Replication System: NullReferenceException?

Posted by virtualmic on Stack Overflow See other posts from Stack Overflow or by virtualmic
Published on 2009-05-06T11:23:03Z Indexed on 2010/03/27 18:03 UTC
Read the original article Hit count: 512

Filed under:
|

Hi,

I am trying to do standard bi-directional replication as follows. However, I get a NullReferenceException. This is a separate replication project. I did import the classes involved in the original project (such as Item, Category etc.) in this replication project. What am I doing wrong? (If I debug using VS, I can see that changedObjects does have all the changed objects; there seems to be some problem inside 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();

Regards,

Saurabh.

© Stack Overflow or respective owner

Related posts about db4o

Related posts about c#