public ResourceHistoryTypeKey(ResourceHistoryType rpType) { Type = rpType; switch (rpType) { case ResourceHistoryType.Detail: RecordConstructor = r => new ResourceRecord(r); break; case ResourceHistoryType.Daily: RecordConstructor = r => new DailyResourceRecord(r); Clause = "GROUP BY julianday(time, 'unixepoch', 'localtime', 'start of day', 'utc')"; break; case ResourceHistoryType.Weekly: RecordConstructor = r => new WeeklyResourceRecord(r); Clause = "GROUP BY julianday(time, 'unixepoch', 'localtime', 'weekday 0', '-6 days', 'start of day', 'utc')"; break; case ResourceHistoryType.Monthly: RecordConstructor = r => new MonthlyResourceRecord(r); Clause = "GROUP BY julianday(time, 'unixepoch', 'localtime', 'start of month', 'utc')"; break; } }