+57
-165
lines changedFilter options
+57
-165
lines changed Original file line number Diff line number Diff line change
@@ -134,7 +134,7 @@ static void AssertAllowed<T>(PrimaryKey[] requested, TypeAllowedBasic typeAllowe
134
134
{
135
135
using (DisableQueryFilter())
136
136
{
137
-
var found = requested.GroupsOf(1000).SelectMany(gr => Database.Query<T>().Where(a => gr.Contains(a.Id)).Select(a => new
137
+
var found = requested.Chunks(1000).SelectMany(gr => Database.Query<T>().Where(a => gr.Contains(a.Id)).Select(a => new
138
138
{
139
139
a.Id,
140
140
Allowed = a.IsAllowedFor(typeAllowed, ExecutionMode.InUserInterface),
Original file line number Diff line number Diff line change
@@ -159,7 +159,7 @@ public static void AddDynamicRename(string replacementKey, string oldName, strin
159
159
private static string AutoReplacementEnums(Replacements.AutoReplacementContext ctx)
160
160
{
161
161
StringDistance sd = new StringDistance();
162
-
return ctx.NewValues!.WithMin(nv => sd.LevenshteinDistance(nv, ctx.OldValue))!;
162
+
return ctx.NewValues!.MinBy(nv => sd.LevenshteinDistance(nv, ctx.OldValue))!;
163
163
}
164
164
165
165
public static string? DynamicAutoReplacementsSimple(Replacements.AutoReplacementContext ctx, List<DynamicRenameEntity> lastRenames, string replacementKey)
Original file line number Diff line number Diff line change
@@ -274,7 +274,7 @@ public string GetFileCode()
274
274
public string GetEntityCode()
275
275
{
276
276
StringBuilder sb = new StringBuilder();
277
-
foreach (var gr in GetEntityAttributes().GroupsOf(a => a.Length, 100))
277
+
foreach (var gr in GetEntityAttributes().Chunk(a => a.Length, 100))
278
278
{
279
279
sb.AppendLine("[" + gr.ToString(", ") + "]");
280
280
}
@@ -494,7 +494,7 @@ private string GetValidatorAttribute(DynamicValidator v)
494
494
495
495
protected virtual void WriteAttributeTag(StringBuilder sb, IEnumerable<string> attributes)
496
496
{
497
-
foreach (var gr in attributes.GroupsOf(a => a.Length, 100))
497
+
foreach (var gr in attributes.Chunk(a => a.Length, 100))
498
498
{
499
499
sb.AppendLine("[" + gr.ToString(", ") + "]");
500
500
}
Original file line number Diff line number Diff line change
@@ -195,7 +195,7 @@ public static IEnumerable<T> WhereCurrentIsolationInMemory<T>(this IEnumerable<T
195
195
196
196
public static Lite<IsolationEntity>? GetOnlyIsolation<T>(IEnumerable<Lite<Entity>> selectedEntities) where T : Entity
197
197
{
198
-
return selectedEntities.Cast<Lite<T>>().GroupsOf(100).Select(gr =>
198
+
return selectedEntities.Cast<Lite<T>>().Chunk(100).Select(gr =>
199
199
Database.Query<T>().Where(e => gr.Contains(e.ToLite())).Select(e => e.Isolation()).Only()
200
200
).NotNull().Only();
201
201
}
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ public void SavePredictions(PredictorTrainingContext ctx)
62
62
63
63
var pc = PredictorPredictLogic.CreatePredictContext(ctx.Predictor);
64
64
int grIndex = 0;
65
-
foreach (var gr in dictionary.GroupsOf(PredictionBatchSize))
65
+
foreach (var gr in dictionary.Chunk(PredictionBatchSize))
66
66
{
67
67
using (HeavyProfiler.LogNoStackTrace("Group"))
68
68
{
@@ -110,7 +110,7 @@ public void SavePredictions(PredictorTrainingContext ctx)
110
110
111
111
if (SaveAllResults)
112
112
{
113
-
var groups = toInsert.GroupsOf(PredictionBatchSize).ToList();
113
+
var groups = toInsert.Chunk(PredictionBatchSize).ToList();
114
114
foreach (var iter in groups.Iterate())
115
115
{
116
116
ctx.ReportProgress($"Inserting {typeof(PredictSimpleResultEntity).NicePluralName()}", iter.Position / (decimal)groups.Count);
Original file line number Diff line number Diff line change
@@ -126,7 +126,7 @@ public void Execute(ExecutingProcess executingProcess)
126
126
using (AuthLogic.Disable())
127
127
{
128
128
129
-
foreach (var group in emails.GroupsOf(EmailLogic.Configuration.ChunkSizeSendingEmails))
129
+
foreach (var group in emails.Chunk(EmailLogic.Configuration.ChunkSizeSendingEmails))
130
130
{
131
131
var retrieved = group.RetrieveFromListOfLite();
132
132
foreach (var m in retrieved)
Original file line number Diff line number Diff line change
@@ -402,7 +402,7 @@ public static Pop3ReceptionEntity ReceiveEmailsFullComparation(this Pop3Configur
402
402
{
403
403
var messageInfos = client.GetMessageInfos();
404
404
405
-
var already = messageInfos.Select(a => a.Uid).GroupsOf(50).SelectMany(l =>
405
+
var already = messageInfos.Select(a => a.Uid).Chunk(50).SelectMany(l =>
406
406
(from em in Database.Query<EmailMessageEntity>()
407
407
let ri = em.Mixin<EmailReceptionMixin>().ReceptionInfo
408
408
where ri != null && l.Contains(ri.UniqueId)
Original file line number Diff line number Diff line change
@@ -132,7 +132,7 @@ public static PackageEntity CreateLines(this PackageEntity package, IEnumerable<
132
132
133
133
int inserts =
134
134
lites.GroupBy(a => a.EntityType).Sum(gr =>
135
-
gr.GroupsOf(100).Sum(gr2 =>
135
+
gr.Chunk(100).Sum(gr2 =>
136
136
giInsertPackageLines.GetInvoker(gr.Key)(package, gr2)));
137
137
138
138
return package;
@@ -144,7 +144,7 @@ public static PackageEntity CreateLines(this PackageEntity package, IEnumerable<
144
144
145
145
int inserts =
146
146
entities.GroupBy(a => a.GetType()).Sum(gr =>
147
-
gr.GroupsOf(100).Sum(gr2 =>
147
+
gr.Chunk(100).Sum(gr2 =>
148
148
giInsertPackageLines.GetInvoker(gr.Key)(package, gr2.Select(a => a.ToLite()))));
149
149
150
150
return package;
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ public AzureTranslator(Func<string?> azureKey, Func<string?>? region = null, Fun
58
58
if(this.AzureKey() == null)
59
59
return null;
60
60
61
-
var result = list.GroupsOf(10).SelectMany(listPart => Task.Run(async () =>
61
+
var result = list.Chunk(10).SelectMany(listPart => Task.Run(async () =>
62
62
{
63
63
return await this.TranslateBatchAsync(listPart, from, to);
64
64
}).Result!).ToList();
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ public static TypeInstancesChanges GetTypeInstanceChangesTranslated(ITranslator[
16
16
17
17
totalInstances = instances.Count;
18
18
if (instances.Sum(a => a.TotalOriginalLength()) > MaxTotalSyncCharacters)
19
-
instances = instances.GroupsOf(a => a.TotalOriginalLength(), MaxTotalSyncCharacters).First().ToList();
19
+
instances = instances.Chunk(a => a.TotalOriginalLength(), MaxTotalSyncCharacters).First().ToList();
20
20
21
21
return TranslateInstances(translators, type, targetCulture, instances);
22
22
}
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4