public void MadePersistent(INakedObjectAdapter adapter) { var oid = adapter.Oid; // Changing the OID object that is already a key in the identity map messes up the hashing so it can't // be found afterwards. To work properly, we therefore remove the identity first then change the oid, // finally re-add to the map. identityAdapterMap.Remove(oid); oidGenerator.ConvertTransientToPersistentOid(oid); adapter.ResolveState.Handle(Events.StartResolvingEvent); adapter.ResolveState.Handle(Events.EndResolvingEvent); ValidateAndAdd(adapter, oid); }
public void MadePersistent(INakedObjectAdapter adapter) { IOid oid = adapter.Oid; // Changing the OID object that is already a key in the identity map messes up the hashing so it can't // be found afterwards. To work properly, we therefore remove the identity first then change the oid, // finally re-add to the map. identityAdapterMap.Remove(oid); oidGenerator.ConvertTransientToPersistentOid(oid); adapter.ResolveState.Handle(Events.StartResolvingEvent); adapter.ResolveState.Handle(Events.EndResolvingEvent); Assert.AssertTrue("Adapter's poco should exist in poco map and return the adapter", nakedObjectAdapterMap.GetObject(adapter.Object) == adapter); Assert.AssertNull("Changed OID should not already map to a known adapter " + oid, identityAdapterMap.GetAdapter(oid)); identityAdapterMap.Add(oid, adapter); }