Пример #1
0
		public static Identity GetIdentity(object item, DataDestination destination) {
			IdentityConfiguration[] keys = destination.GetIdentityKeys();
			Identity identity = new Identity(item);
			foreach (IdentityConfiguration ic in keys) {
				string key = ic.Property;
				PropertyInfo pi = item.GetType().GetProperty(key);
				if (pi != null) {
					try {
						identity[key] = pi.GetValue(item, new object[0]);
					} catch (Exception ex) {
						throw new FluorineException(__Res.GetString(__Res.Identity_Failed, key), ex);
					}
				} else {
					try {
						FieldInfo fi = item.GetType().GetField(key, BindingFlags.Public | BindingFlags.Instance);
						if (fi != null) {
							identity[key] = fi.GetValue(item);
						}
					} catch (Exception ex) {
						throw new FluorineException(__Res.GetString(__Res.Identity_Failed, key), ex);
					}
				}
			}
			return identity;
		}
Пример #2
0
		public SequenceManager(DataDestination dataDestination) {
			_dataDestination = dataDestination;
			_sequenceIdToSequenceHash = new CopyOnWriteDictionary();
#if (NET_1_1)
			_parametersToSequenceIdHash = new Hashtable(new ListHashCodeProvider(), new ListComparer());
#else
			_parametersToSequenceIdHash = new Hashtable(new ListHashCodeProvider());
#endif
			_itemIdToSequenceIdMapHash = new Hashtable();
			_clientIdToSequenceHash = new Hashtable();
			_itemIdToItemHash = new Hashtable();
		}
Пример #3
0
		private UpdateCollectionMessage CreateUpdateCollectionMessage(DataDestination dataDestination, Sequence sequence) {
			UpdateCollectionMessage updateCollectionMessage = new UpdateCollectionMessage();
			updateCollectionMessage.clientId = this.ClientId;
			updateCollectionMessage.updateMode = UpdateCollectionMessage.ServerUpdate;
			// 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 = dataDestination.Id;
			updateCollectionMessage.correlationId = this.CorrelationId;
			updateCollectionMessage.messageId = "srv:" + Guid.NewGuid().ToString("D") + ":" + _idCounter.ToString();
			System.Threading.Interlocked.Increment(ref _idCounter);

			return updateCollectionMessage;
		}
Пример #4
0
		internal void GenerateUpdateCollectionMessage(int updateType, DataDestination dataDestination, Sequence sequence, int position, Identity identity) {
			UpdateCollectionMessage updateCollectionMessage = CreateUpdateCollectionMessage(dataDestination, sequence);
			updateCollectionMessage.AddItemIdentityChange(updateType, position, identity);
			if (updateCollectionMessage.collectionId != null)
				_updateCollectionMessages[updateCollectionMessage.collectionId] = updateCollectionMessage;
			else {
				//without fill parameters
				_updateCollectionMessages[new object[0]] = updateCollectionMessage;
			}
		}