Exemplo n.º 1
0
        private void RemoverDaLista(IChaveEntidade key)
        {
            TDicEntidade entidade = _ListaControlada.FirstOrDefault(_i => _i.ObterChave().Equals(key));

            if (entidade != null)
            {
                _ListaControlada.Remove(entidade);
            }
        }
Exemplo n.º 2
0
        public TDicEntidade this[IChaveEntidade key]
        {
            get
            {
                return(_DicionarioInterno[key]);
            }

            set
            {
                AdicionarNaLista(value);
                _DicionarioInterno[key] = value;
            }
        }
Exemplo n.º 3
0
        private T VerificarEntidade <T>(T entidade, Dictionary <IChaveEntidade, T> mapeamento) where T : IEntidade
        {
            if (!object.Equals(entidade, default(T)) && entidade.ObterChave() != null && entidade.ObterChave().TemValor())
            {
                IChaveEntidade chave = entidade.ObterChave();
                if (!mapeamento.Any(item => item.Key.Equals(chave)))
                {
                    mapeamento[chave] = entidade;
                }

                return(mapeamento[chave]);
            }

            return(entidade);
        }
Exemplo n.º 4
0
 public bool TryGetValue(IChaveEntidade key, out TDicEntidade value)
 {
     return(_DicionarioInterno.TryGetValue(key, out value));
 }
Exemplo n.º 5
0
 public bool Remove(IChaveEntidade key)
 {
     RemoverDaLista(key);
     return(_DicionarioInterno.Remove(key));
 }
Exemplo n.º 6
0
 public bool ContainsKey(IChaveEntidade key)
 {
     return(_DicionarioInterno.ContainsKey(key));
 }
Exemplo n.º 7
0
 public void Add(IChaveEntidade key, TDicEntidade value)
 {
     _DicionarioInterno.Add(key, value);
     AdicionarNaLista(value);
 }