I have a piece of code that gets all the entries for a given template and a couple of given conditions. I successfully get the entries and their metadata (id, name, owner, etc..), after getting those entries i need to get all the fields and its values for each and every one of them, i accomplish this by calling Entry.TryGetEntryInfo(id, session).
However this is taking too long, like 4-5 minutes for 2,000 entries.
Is there a way to get all the entries, their metadata and all their fields and values ALL AT ONCE for a given template without having to use Entry.TryGetEntryInfo or is there a better way (performance wise) to accomplish this?.
Here is my code:
Session mySess = null;
try
{
mySess = LFSessionFactory.CreateDefaultSession();
Search lfSearch = new Search(mySess);
lfSearch.Command = "{[EISD -- Business / Vendor Invoices]:[Invoice Date]>=\"11/08/2013\",[Invoice Date]<=\"11/10/2014\"}";
lfSearch.Run();
SearchListingSettings searchSettings = new SearchListingSettings();
searchSettings.SortDirection = SortDirection.Ascending;
SearchResultListing results = lfSearch.GetResultListing(searchSettings);
for (int i = 1; i < results.RowCount; i++)
{
int entryId = (int)results.GetDatum(i, SystemColumn.Id);
// this is what is taking too long
EntryInfo currentEntry = Entry.TryGetEntryInfo(entryId, mySess);
Console.WriteLine(currentEntry.Name);
}
Console.WriteLine(results.RowsCount);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
finally
{
LFSessionFactory.CloseSession(mySess);
}