public ObjectReference Bind2(Transaction trans, ObjectReference oldRef, object obj ) { int id = oldRef.GetID(); trans.RemoveReference(oldRef); ObjectReference newRef = new ObjectReference(ClassMetadataForObject(obj), id); newRef.SetObjectWeak(this, obj); newRef.SetStateDirty(); trans.ReferenceSystem().AddExistingReference(newRef); return newRef; }