/// <summary>make sure this Db4oDatabase is stored.</summary> /// <remarks>make sure this Db4oDatabase is stored. Return the ID.</remarks> public virtual int Bind(Transaction trans) { ObjectContainerBase stream = trans.Container(); Db4objects.Db4o.Ext.Db4oDatabase stored = (Db4objects.Db4o.Ext.Db4oDatabase)stream .Db4oTypeStored(trans, this); if (stored == null) { return(StoreAndGetId(trans)); } if (stored == this) { return(stream.GetID(trans, this)); } if (i_uuid == 0) { i_uuid = stored.i_uuid; } stream.ShowInternalClasses(true); try { int id = stream.GetID(trans, stored); stream.Bind(trans, this, id); return(id); } finally { stream.ShowInternalClasses(false); } }
public static Db4objects.Drs.Db4o.ReplicationRecord BeginReplication(Transaction transA, Transaction transB) { ObjectContainerBase peerA = transA.Container(); ObjectContainerBase peerB = transB.Container(); Db4oDatabase dbA = ((IInternalObjectContainer)peerA).Identity(); Db4oDatabase dbB = ((IInternalObjectContainer)peerB).Identity(); dbB.Bind(transA); dbA.Bind(transB); Db4oDatabase younger = null; Db4oDatabase older = null; if (dbA.IsOlderThan(dbB)) { younger = dbB; older = dbA; } else { younger = dbA; older = dbB; } Db4objects.Drs.Db4o.ReplicationRecord rrA = QueryForReplicationRecord(peerA, transA , younger, older); Db4objects.Drs.Db4o.ReplicationRecord rrB = QueryForReplicationRecord(peerB, transB , younger, older); if (rrA == null) { if (rrB == null) { return(new Db4objects.Drs.Db4o.ReplicationRecord(younger, older)); } rrB.Store(peerA); return(rrB); } if (rrB == null) { rrA.Store(peerB); return(rrA); } if (rrA != rrB) { peerB.ShowInternalClasses(true); try { int id = peerB.GetID(transB, rrB); peerB.Bind(transB, rrA, id); } finally { peerB.ShowInternalClasses(false); } } return(rrA); }