public static async Task StoreUsers(IEnumerable <UserInsertBatch> batches) { try { await StatusCrud.StoreCoreAsync(batches.SelectMany(CreateQuery)); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("# FAIL> storing users." + Environment.NewLine + ex); } }
public static async Task StoreStatuses(IEnumerable <StatusInsertBatch> batches) { try { var m = batches.Memoize(); var statusBatch = m.Distinct(b => b.Status.Id) .SelectMany(CreateQuery); var userBatch = m.Select(b => b.UserInsertBatch) .Distinct(u => u.User.Id) .SelectMany(CreateQuery); await StatusCrud.StoreCoreAsync(statusBatch.Concat(userBatch)); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("# FAIL> storing statuses." + Environment.NewLine + ex); } }