diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Controllers/AdminController.cs index b107070c3b4..4c1cfe9d7dd 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Controllers/AdminController.cs @@ -55,6 +55,8 @@ public Task Query(string query) [HttpPost] public async Task Query(AdminQueryViewModel model) { + model.FactoryName = _store.Configuration.ConnectionFactory.GetType().FullName; + if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageSqlQueries)) { return Forbid(); @@ -80,8 +82,6 @@ public async Task Query(AdminQueryViewModel model) var tokenizedQuery = await _liquidTemplateManager.RenderStringAsync(model.DecodedQuery, NullEncoder.Default, parameters.Select(x => new KeyValuePair(x.Key, FluidValue.Create(x.Value, _templateOptions)))); - model.FactoryName = _store.Configuration.ConnectionFactory.GetType().FullName; - if (SqlParser.TryParse(tokenizedQuery, _store.Configuration.Schema, dialect, _store.Configuration.TablePrefix, parameters, out var rawQuery, out var messages)) { model.RawSql = rawQuery;