private void EnsureSingleOccurence(Transaction trans, IObjectInfoCollection col) { IEnumerator i = col.GetEnumerator(); while (i.MoveNext()) { IObjectInfo objectInfo = (IObjectInfo)i.Current; if (this.ReflectClass() != this._enclosing.ReflectorFor(trans, objectInfo.GetObject ())) { continue; } object obj = this.ObjectFor(trans, objectInfo); object fieldValue = this.FieldMetadata().GetOn(trans, obj); if (fieldValue == null) { continue; } IBTreeRange range = this.FieldMetadata().Search(trans, fieldValue); if (range.Size() > 1) { throw new UniqueFieldValueConstraintViolationException(this.ClassMetadata().GetName (), this.FieldMetadata().GetName()); } } }
public void OnEvent(object sender, Db4objects.Db4o.Events.CommitEventArgs args) { lock (this._enclosing._updatesMonitor) { Transaction trans = ((IInternalObjectContainer)client).Transaction; IObjectInfoCollection updated = ((CommitEventArgs)args).Updated; IEnumerator infos = updated.GetEnumerator(); while (infos.MoveNext()) { IObjectInfo info = (IObjectInfo)infos.Current; object obj = trans.ObjectForIdFromCache((int)info.GetInternalID()); if (obj == null) { continue; } // DEPTH may need to be 2 for member collections // to be updated also. client.Refresh(obj, 1); } if (this._enclosing.IsNetworkingCS()) { Sharpen.Runtime.NotifyAll(this._enclosing._updatesMonitor); } } }
private void EncodeObjectInfoCollection(ByteArrayOutputStream os, IObjectInfoCollection collection, IObjectInfoEncoder encoder) { var iter = collection.GetEnumerator(); while (iter.MoveNext()) { var obj = (IObjectInfo) iter.Current; encoder.Encode(os, obj); } PrimitiveCodec.WriteLong(os, -1); }
private void EncodeObjectInfoCollection(ByteArrayOutputStream os, IObjectInfoCollection collection, MCommittedInfo.IObjectInfoEncoder encoder) { IEnumerator iter = collection.GetEnumerator(); while (iter.MoveNext()) { IObjectInfo obj = (IObjectInfo)iter.Current; encoder.Encode(os, obj); } PrimitiveCodec.WriteLong(os, -1); }
public void OnEvent(object sender, Db4objects.Db4o.Events.CommitEventArgs args) { if (oc.IsClosed()) { return; } IObjectInfoCollection updated = ((CommitEventArgs)args).Updated; IEnumerator infos = updated.GetEnumerator(); while (infos.MoveNext()) { IObjectInfo info = (IObjectInfo)infos.Current; object obj = info.GetObject(); oc.Refresh(obj, 2); } }