My console application will cycle through each user to get their websites so that he can take new screenshots from them. However, in order not to repeat the screenshot of the same website twice, I have to check if the screenshot of the website has already been taken and then scroll through other users websites.
My current solution:
Database:
User
|
|
|
|
Websites
|
|
|
|
|
|
Console Application:
static void RenewWebsiteThumbNails()
{
Console.WriteLine("Starting renewal process...");
using (_repository)
{
var websitesUpdated = new List<string>();
foreach (var user in _repository.GetAll())
{
foreach (var website in user.Websites.Where(website => !websitesUpdated.Contains(website.URL)))
{
_repository.TakeScreenDumpAndSave(website.URL);
websitesUpdated.Add(website.URL);
Console.WriteLine(new string('-', 50));
Console.WriteLine("{0} has successfully been renewed", website.URL);
}
}
}
}
However, it seems wrong to declare a list for such a scenario, just to check if a specific URL has been added ... any suggestions for an alternative way?
source
share