Skip to content

Commit

Permalink
feat: Updated Web UI to support .NET Standard 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosgoias committed Jan 26, 2024
1 parent 50f5fef commit 3ba2106
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
10 changes: 9 additions & 1 deletion src/Rules.Framework.WebUI/Handlers/GetRulesHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,23 @@ private IEnumerable<RuleDto> 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
});
}

if (!string.IsNullOrWhiteSpace(rulesFilter.Name))
{
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)
Expand Down Expand Up @@ -148,4 +156,4 @@ private async Task<IEnumerable<RuleDto>> GetRulesForContentyType(string identifi
return Enumerable.Empty<RuleDto>();
}
}
}
}
20 changes: 14 additions & 6 deletions src/Rules.Framework.WebUI/Rules.Framework.WebUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<SignAssembly Condition="'$(OS)'=='Windows_NT'">true</SignAssembly>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<LangVersion>10.0</LangVersion>
<Authors></Authors>
<Version></Version>
Expand Down Expand Up @@ -34,11 +34,7 @@
<EmbeddedResource Include="node_modules/bootstrap/**/*" Exclude="**/*/index.html;**/*/*.map;**/*/*.json;**/*/*.md" />
<EmbeddedResource Include="index.html" />
<EmbeddedResource Include="node_modules/rules_list.ico" />
</ItemGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Rules.Framework\Rules.Framework.csproj" />
Expand All @@ -64,4 +60,16 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.9" />
<PackageReference Include="System.Text.Json" Version="6.0.6" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions src/Rules.Framework.WebUI/WebUIMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IHttpRequestHandler> httpRequestHandlers;
Expand Down

0 comments on commit 3ba2106

Please sign in to comment.