public CallbackObjectInfoCollections(IObjectInfoCollection added_, IObjectInfoCollection
			 updated_, IObjectInfoCollection deleted_)
		{
			added = added_;
			updated = updated_;
			deleted = deleted_;
		}
 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);
         }
     }
 }
Example #3
0
            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());
                    }
                }
            }
			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());
					}
				}
			}
Example #5
0
 public CallbackObjectInfoCollections(IObjectInfoCollection added_, IObjectInfoCollection
                                      updated_, IObjectInfoCollection deleted_)
 {
     added   = added_;
     updated = updated_;
     deleted = deleted_;
 }
Example #6
0
 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);
 }
Example #7
0
        public virtual CallbackObjectInfoCollections Decode(ByteArrayInputStream @is)
        {
            IObjectInfoCollection added = DecodeObjectInfoCollection(@is, new MCommittedInfo.InternalIDEncoder
                                                                         (this));
            IObjectInfoCollection deleted = DecodeObjectInfoCollection(@is, new MCommittedInfo.FrozenObjectInfoEncoder
                                                                           (this));
            IObjectInfoCollection updated = DecodeObjectInfoCollection(@is, new MCommittedInfo.InternalIDEncoder
                                                                           (this));

            return(new CallbackObjectInfoCollections(added, updated, deleted));
        }
Example #8
0
        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);
        }
Example #9
0
            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);
                }
            }