Esempio n. 1
0
 private Osoba CreateNewPerson(OsobaId id)
 {
     GlobalStats.NewOsobaCount++;
     return(new Osoba {
         IdPuvodce = id.IdPuvodce, IdOsoby = id.IdOsoby, Id = id.GetId(), SpisovaZnacka = id.SpisovaZnacka
     });
 }
Esempio n. 2
0
 public Osoba GetPerson(OsobaId id) => OsobaCache.GetOrAdd(id.GetId(), UnderlyingRepository.GetPerson(id) ?? CreateNewPerson(id));
Esempio n. 3
0
        public Osoba GetPerson(OsobaId id)
        {
            var res = Elastic.GetESClient(Database.Osoba)
                      .Search <Osoba>(s => s
                                      .Size(1)   //zrus, pokud ma vratit vice zaznamu
                                      .Query(q => q.Term(t => t.Field(f => f.Id).Value(id.GetId())))
                                      );

            if (res.IsValid)
            {
                Stats.PersonGet++;
                return(res.Hits.FirstOrDefault()?.Source);
            }
            throw new ElasticsearchClientException(res.ServerError?.ToString());
        }