예제 #1
0
        private UpdateCollectionMessage CreateUpdateCollectionMessage(DataMessage dataMessage, Sequence sequence, Identity identity, int position, int updateMode)
        {
            UpdateCollectionMessage updateCollectionMessage = new UpdateCollectionMessage();

            // The unique identifier for the collection that was updated. For a collection filled with the
            // DataService.fill() method this contains an Array of the parameters specified.
            updateCollectionMessage.collectionId  = sequence.Parameters;
            updateCollectionMessage.destination   = dataMessage.destination;
            updateCollectionMessage.replace       = false;
            updateCollectionMessage.updateMode    = updateMode;
            updateCollectionMessage.messageId     = "srv:" + Guid.NewGuid().ToString("D") + ":0";
            updateCollectionMessage.correlationId = dataMessage.correlationId;

            UpdateCollectionRange updateCollectionRange = new UpdateCollectionRange();

            // An Array of identity objects that represent which items were either deleted or inserted in the
            // associated collection starting at the position indicated by the position property
            updateCollectionRange.identities = new object[1];
            //(updateCollectionRange.identities as IList).Add( identity );
            (updateCollectionRange.identities as object[])[0] = identity;
            updateCollectionRange.updateType = UpdateCollectionRange.InsertIntoCollection;
            updateCollectionRange.position   = position;

            //ArrayList body = new ArrayList();
            //body.Add(updateCollectionRange);
            object[] body = new object[1]; body[0] = updateCollectionRange;
            updateCollectionMessage.body = body;
            return(updateCollectionMessage);
        }
예제 #2
0
        void ApplyUpdateCollectionMessage(Sequence sequence, UpdateCollectionMessage updateCollectionMessage)
        {
            IList updateCollectionRanges = updateCollectionMessage.body as IList;

            for (int k = 0; k < updateCollectionRanges.Count; k++)
            {
                UpdateCollectionRange updateCollectionRange = updateCollectionRanges[k] as UpdateCollectionRange;
                int insertCount = 0;
                for (int l = 0; l < updateCollectionRange.identities.Length; l++)
                {
                    Identity identity = updateCollectionRange.identities[l] as Identity;
                    if (identity == null)
                    {
                        identity = new Identity(updateCollectionRange.identities[l] as IDictionary);
                    }
                    if (updateCollectionRange.updateType == UpdateCollectionRange.InsertIntoCollection)
                    {
                        this.AddIdentityToSequence(sequence, updateCollectionRange.position + insertCount, identity, null);
                        insertCount++;
                    }
                    if (updateCollectionRange.updateType == UpdateCollectionRange.DeleteFromCollection)
                    {
                        this.RemoveIdentityFromSequence(sequence, identity, updateCollectionRange.position, null);
                    }
                }
            }
        }
예제 #3
0
        private void ApplyUpdateCollectionMessage(Sequence sequence, UpdateCollectionMessage updateCollectionMessage)
        {
            IList body = updateCollectionMessage.body as IList;

            for (int i = 0; i < body.Count; i++)
            {
                UpdateCollectionRange range = body[i] as UpdateCollectionRange;
                int num2 = 0;
                for (int j = 0; j < range.identities.Length; j++)
                {
                    Identity identity = range.identities[j] as Identity;
                    if (identity == null)
                    {
                        identity = new Identity(range.identities[j] as IDictionary);
                    }
                    if (range.updateType == 0)
                    {
                        this.AddIdentityToSequence(sequence, range.position + num2, identity, null);
                        num2++;
                    }
                    if (range.updateType == 1)
                    {
                        this.RemoveIdentityFromSequence(sequence, identity, range.position, null);
                    }
                }
            }
        }
예제 #4
0
        private UpdateCollectionMessage CreateUpdateCollectionMessage(DataMessage dataMessage, Sequence sequence, Identity identity, int position, int updateMode)
        {
            UpdateCollectionMessage message = new UpdateCollectionMessage {
                collectionId  = sequence.Parameters,
                destination   = dataMessage.destination,
                replace       = false,
                updateMode    = updateMode,
                messageId     = "srv:" + Guid.NewGuid().ToString("D") + ":0",
                correlationId = dataMessage.correlationId
            };
            UpdateCollectionRange range = new UpdateCollectionRange {
                identities = new object[] { identity },
                updateType = 0,
                position   = position
            };

            object[] objArray = new object[] { range };
            message.body = objArray;
            return(message);
        }
예제 #5
0
		private UpdateCollectionMessage CreateUpdateCollectionMessage(DataMessage dataMessage, Sequence sequence, Identity identity, int position, int updateMode)
		{
			UpdateCollectionMessage updateCollectionMessage = new UpdateCollectionMessage();
			// The unique identifier for the collection that was updated. For a collection filled with the 
			// DataService.fill() method this contains an Array of the parameters specified.
			updateCollectionMessage.collectionId = sequence.Parameters;
			updateCollectionMessage.destination = dataMessage.destination;
			updateCollectionMessage.replace = false;
			updateCollectionMessage.updateMode = updateMode;
			updateCollectionMessage.messageId = "srv:" + Guid.NewGuid().ToString("D") + ":0";
			updateCollectionMessage.correlationId = dataMessage.correlationId;

			UpdateCollectionRange updateCollectionRange = new UpdateCollectionRange();
			// An Array of identity objects that represent which items were either deleted or inserted in the 
			// associated collection starting at the position indicated by the position property
			updateCollectionRange.identities = new object[1];
			//(updateCollectionRange.identities as IList).Add( identity );
			(updateCollectionRange.identities as object[])[0] = identity;
			updateCollectionRange.updateType = UpdateCollectionRange.InsertIntoCollection;
			updateCollectionRange.position = position;
					
			//ArrayList body = new ArrayList();
			//body.Add(updateCollectionRange);
			object[] body = new object[1]; body[0] = updateCollectionRange;
			updateCollectionMessage.body = body;
			return updateCollectionMessage;
		}