From 3ba210644281b3f4ca00c3efbd18ab05548f1d6c Mon Sep 17 00:00:00 2001 From: Carlos Miranda Date: Fri, 26 Jan 2024 10:58:23 +0000 Subject: [PATCH] feat: Updated Web UI to support .NET Standard 2.0 --- .../Handlers/GetRulesHandler.cs | 10 +++++++++- .../Rules.Framework.WebUI.csproj | 20 +++++++++++++------ src/Rules.Framework.WebUI/WebUIMiddleware.cs | 6 ++++++ 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/Rules.Framework.WebUI/Handlers/GetRulesHandler.cs b/src/Rules.Framework.WebUI/Handlers/GetRulesHandler.cs index 904d1942..cf7c00d7 100644 --- a/src/Rules.Framework.WebUI/Handlers/GetRulesHandler.cs +++ b/src/Rules.Framework.WebUI/Handlers/GetRulesHandler.cs @@ -81,7 +81,11 @@ private IEnumerable ApplyFilters(RulesFilterDto rulesFilter, IEnumerabl { genericRulesDto = genericRulesDto.Where(g => { +#if NETSTANDARD2_0 + return JsonSerializer.Serialize(g.Value).ToUpper().Contains(rulesFilter.Content.ToUpper()); +#else return JsonSerializer.Serialize(g.Value).Contains(rulesFilter.Content, StringComparison.OrdinalIgnoreCase); +#endif }); } @@ -89,7 +93,11 @@ private IEnumerable ApplyFilters(RulesFilterDto rulesFilter, IEnumerabl { genericRulesDto = genericRulesDto.Where(g => { +#if NETSTANDARD2_0 + return g.Name.ToUpper().Contains(rulesFilter.Name.ToUpper()); +#else return g.Name.Contains(rulesFilter.Name, StringComparison.OrdinalIgnoreCase); +#endif }); } if (rulesFilter.Status != null) @@ -148,4 +156,4 @@ private async Task> GetRulesForContentyType(string identifi return Enumerable.Empty(); } } -} +} \ No newline at end of file diff --git a/src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj b/src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj index eb97e2ea..50e7336a 100644 --- a/src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj +++ b/src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj @@ -3,7 +3,7 @@ true true - net6.0 + net6.0;netstandard2.0 10.0 @@ -34,11 +34,7 @@ - - - - - + @@ -64,4 +60,16 @@ PreserveNewest + + + + + + + + + + + + diff --git a/src/Rules.Framework.WebUI/WebUIMiddleware.cs b/src/Rules.Framework.WebUI/WebUIMiddleware.cs index c38b9544..9f04643c 100644 --- a/src/Rules.Framework.WebUI/WebUIMiddleware.cs +++ b/src/Rules.Framework.WebUI/WebUIMiddleware.cs @@ -12,6 +12,12 @@ namespace Rules.Framework.WebUI using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +#if NETSTANDARD2_0 + + using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; + +#endif + internal sealed class WebUIMiddleware { private readonly IEnumerable httpRequestHandlers;