Exemplo n.º 1
0
 /// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="typeName"></param>
 /// <param name="changeType"></param>
 /// <param name="record"></param>
 /// <param name="recordKey"></param>
 public TypeRecordChangedEventArgs(Colosoft.Reflection.TypeName typeName, TypeRecordChangeType changeType, IRecord record, RecordKey recordKey)
 {
     _typeName   = typeName;
     _changeType = changeType;
     _record     = record;
     _recordKey  = recordKey;
 }
Exemplo n.º 2
0
            /// <summary>
            /// Recupera o notificador associado com a chave do registor.
            /// </summary>
            /// <param name="recordKey"></param>
            /// <returns></returns>
            public IRecordObserverNotifier GetNotifier(RecordKey recordKey)
            {
                RecordKeyEntry entry = null;

                lock (_keys)
                    _keys.TryGetValue(recordKey.Key, out entry);
                return(new ChangeRecordObserverNotifier(entry, this));
            }
Exemplo n.º 3
0
 /// <summary>
 /// Adiciona a chave de um registro.
 /// </summary>
 /// <param name="recordKey"></param>
 /// <param name="recordObserver">Observer do registro.</param>
 /// <returns></returns>
 public void AddRecordKey(RecordKey recordKey, IRecordObserver recordObserver)
 {
     lock (_recordObserverEntries)
     {
         if (_recordObserverEntries.ContainsKey(recordObserver.Uid))
         {
             return;
         }
         RecordKeyEntry entry = null;
         var            key   = recordKey.Key;
         lock (_keys)
             if (!_keys.TryGetValue(key, out entry))
             {
                 entry          = new RecordKeyEntry(key);
                 entry.Removed += RecordKeyEntryRemoved;
                 _keys.Add(key, entry);
             }
         var observerEntry = entry.AddObserver(recordObserver);
         _recordObserverEntries.Add(recordObserver.Uid, observerEntry);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Método acionado quando um registro for removido.
 /// </summary>
 /// <param name="recordKey"></param>
 public abstract void OnRecordDeleted(RecordKey recordKey);
Exemplo n.º 5
0
 /// <summary>
 /// Avalia se a chave do registro é compatível.
 /// </summary>
 /// <param name="recordKey"></param>
 /// <returns></returns>
 public abstract bool Evaluate(RecordKey recordKey);
Exemplo n.º 6
0
 /// <summary>
 /// Recupera o notificador de alterações no registro.
 /// </summary>
 /// <param name="typeName"></param>
 /// <param name="recordKey"></param>
 /// <returns></returns>
 public IRecordObserverNotifier GetRecordChangedNotifier(Colosoft.Reflection.TypeName typeName, RecordKey recordKey)
 {
     if (IsEnabled)
     {
         var typeNameEntry = GetTypeNameEntry(typeName);
         return(typeNameEntry.GetNotifier(recordKey));
     }
     return(null);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Método acionado quando um registro for apagado.
 /// </summary>
 /// <param name="typeName"></param>
 /// <param name="recordKey"></param>
 protected virtual void OnTypeRecordDeleted(Colosoft.Reflection.TypeName typeName, RecordKey recordKey)
 {
     if (TypeRecordChanged != null)
     {
         TypeRecordChanged(this, new TypeRecordChangedEventArgs(typeName, TypeRecordChangeType.Delete, null, recordKey));
     }
 }