C@NYON⭐ONL!NE
C@NYON⭐ONL!NE
CC#
Created by C@NYON⭐ONL!NE on 2/10/2025 in #help
✅ LINQ help: IQueryable<Entity> -> Dictionary<string, Entity[]>
Great ty! I had to change my query a little bit because I think my DB connector (Snowflake) is shoddy:
var logs = await _nktContext.LogData
.Where(log => log.Timestamp != null &&
log.Timestamp.Value >= dateStart &&
log.Timestamp.Value <= dateEnd &&
!string.IsNullOrEmpty(log.SerialNumber) &&
log.LddCurrent != null)
.ToListAsync();

var filtered = logs
.GroupBy(log => new
{
log.SerialNumber,
Hour = new DateTime( // slightly faster than ToString
log.Timestamp!.Value.Year,
log.Timestamp!.Value.Month,
log.Timestamp!.Value.Day,
log.Timestamp!.Value.Hour,
1,
1
),
})
.GroupBy(
group => group.Key.SerialNumber!,
group => group.MaxBy(log => log.LddCurrent)!
)
.ToDictionary(
group => group.Key,
group => group.OrderBy(log => log!.Timestamp).ToArray()
);
var logs = await _nktContext.LogData
.Where(log => log.Timestamp != null &&
log.Timestamp.Value >= dateStart &&
log.Timestamp.Value <= dateEnd &&
!string.IsNullOrEmpty(log.SerialNumber) &&
log.LddCurrent != null)
.ToListAsync();

var filtered = logs
.GroupBy(log => new
{
log.SerialNumber,
Hour = new DateTime( // slightly faster than ToString
log.Timestamp!.Value.Year,
log.Timestamp!.Value.Month,
log.Timestamp!.Value.Day,
log.Timestamp!.Value.Hour,
1,
1
),
})
.GroupBy(
group => group.Key.SerialNumber!,
group => group.MaxBy(log => log.LddCurrent)!
)
.ToDictionary(
group => group.Key,
group => group.OrderBy(log => log!.Timestamp).ToArray()
);
That's another issue though 🥴
3 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
that is tempting particularly because VS is warning me about CA1816: Call GC.SuppressFinalize correctly which is approaching ends of the language i don't fully comprehend
25 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
okay with sehra's line of code i see what you mean. i use functions available in IAmazonS3 but not TransferUtility in some of my implementation, particularly for listing buckets and keys in them, so i'll have to go with the Dispose route i think
25 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
No description
25 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
Whatever
25 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
IDK why my message is blocked 😭
25 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
let me try messaging in parts
25 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
Hmmm
25 replies