private Osoba CreateNewPerson(OsobaId id) { GlobalStats.NewOsobaCount++; return(new Osoba { IdPuvodce = id.IdPuvodce, IdOsoby = id.IdOsoby, Id = id.GetId(), SpisovaZnacka = id.SpisovaZnacka }); }
public Osoba GetPerson(OsobaId id) => OsobaCache.GetOrAdd(id.GetId(), UnderlyingRepository.GetPerson(id) ?? CreateNewPerson(id));
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()); }