From 90e31416139529095675d64d3670d63152d5e1f5 Mon Sep 17 00:00:00 2001 From: Akash Kava <39438041+ackava@users.noreply.github.com> Date: Fri, 6 Jan 2023 15:41:30 +0530 Subject: [PATCH] Added root level date range --- .../BaseEntityController.cs | 4 ++++ .../EntityAcccessQueryableExtensions.cs | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/NeuroSpeech.EntityAccessControl/BaseEntityController.cs b/NeuroSpeech.EntityAccessControl/BaseEntityController.cs index 8e85e78..0a040d4 100644 --- a/NeuroSpeech.EntityAccessControl/BaseEntityController.cs +++ b/NeuroSpeech.EntityAccessControl/BaseEntityController.cs @@ -484,6 +484,10 @@ public async Task PostMethod( case "thenByDescending": lm.Method = "ThenByDescending"; break; + case "dateRange": + lm.Method = "DateRange"; + lm.Expression = "@0, @1, @2"; + break; case "joinDateRange": lm.Method = "JoinDateRange"; lm.Expression = "@0, @1, @2"; diff --git a/NeuroSpeech.EntityAccessControl/EntityAcccessQueryableExtensions.cs b/NeuroSpeech.EntityAccessControl/EntityAcccessQueryableExtensions.cs index a5e1833..33c4db6 100644 --- a/NeuroSpeech.EntityAccessControl/EntityAcccessQueryableExtensions.cs +++ b/NeuroSpeech.EntityAccessControl/EntityAcccessQueryableExtensions.cs @@ -85,6 +85,17 @@ public static IQueryable> JoinDateRange(this IQueryable return join; } + public static IQueryable DateRange(this IQueryable @this, DateTime start, DateTime end, string step) + where T : class + { + if (@this.Provider is not EntityAccessQueryProvider q1) + { + throw new NotSupportedException(); + } + var db = q1.db; + return db.DateRangeView(start, end, step); + } + public static IIncludableQueryable IncludeSecure(this IQueryable queryable, string path) where T : class