Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Updated Web UI to support .NET Standard 2.0 #161

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading