public async Task Store(Hit hit) { var entity = new HitEntity { CapturedData = hit.CapturedDataString, Data = hit.DataString, Date = hit.Date, Proxy = hit.ProxyString, Type = hit.Type, ConfigId = hit.Config.Id, ConfigName = hit.Config.Metadata.Name, ConfigCategory = hit.Config.Metadata.Category, OwnerId = hit.OwnerId }; if (hit.DataPool is WordlistDataPool) { var wordlist = (hit.DataPool as WordlistDataPool).Wordlist; entity.WordlistId = wordlist.Id; entity.WordlistName = wordlist.Name; } // Only allow saving one hit at a time (multiple threads should // not use the same DbContext at the same time). await semaphore.WaitAsync(); try { await hitRepo.Add(entity); } finally { semaphore.Release(); } }
public async Task Store(Hit hit) { var entity = new HitEntity { CapturedData = hit.CapturedDataString, Data = hit.DataString, Date = hit.Date, Proxy = hit.ProxyString, Type = hit.Type, ConfigId = hit.Config.Id, ConfigName = hit.Config.Metadata.Name, ConfigCategory = hit.Config.Metadata.Category, OwnerId = hit.OwnerId }; if (hit.DataPool is WordlistDataPool) { var wordlist = (hit.DataPool as WordlistDataPool).Wordlist; entity.WordlistId = wordlist.Id; entity.WordlistName = wordlist.Name; } await hitRepo.Add(entity); }