Skip to content

Commit

Permalink
chore: support for netstandard2.0 (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
luispfgarces authored Jan 22, 2024
1 parent 7078011 commit 50f5fef
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ private void BuildFetchAndSwitchOverMultiplicity(
foreach (var multiplicity in operatorMetadata.SupportedMultiplicities)
{
#if NETSTANDARD2_0
string multiplicityTransformed = Regex.Replace(multiplicity, "\\b\\p{Ll}", match => match.Value.ToUpperInvariant(), RegexOptions.None, TimeSpan.FromSeconds(1)).Replace("-", string.Empty);
#else
string multiplicityTransformed = Regex.Replace(multiplicity, "\\b\\p{Ll}", match => match.Value.ToUpperInvariant(), RegexOptions.None, TimeSpan.FromSeconds(1)).Replace("-", string.Empty, StringComparison.Ordinal);
#endif
var scopeName = new StringBuilder(builder.ScopeName)
.Append(valueConditionNode.ConditionType)
.Append(multiplicityTransformed)
Expand Down
4 changes: 4 additions & 0 deletions src/Rules.Framework/Evaluation/OperatorMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ public bool HasSupportForOneMultiplicityAtLeft
{
if (this.leftSupportForOneMultiplicity is null)
{
#if NETSTANDARD2_0
this.leftSupportForOneMultiplicity = this.SupportedMultiplicities?.Any(m => m.Contains("one-to")) ?? false;
#else
this.leftSupportForOneMultiplicity = this.SupportedMultiplicities?.Any(m => m.Contains("one-to", StringComparison.Ordinal)) ?? false;
#endif
}

return this.leftSupportForOneMultiplicity.GetValueOrDefault();
Expand Down
12 changes: 10 additions & 2 deletions src/Rules.Framework/Rules.Framework.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<LangVersion>10.0</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Authors></Authors>
Expand Down Expand Up @@ -33,6 +33,15 @@
<PackagePath></PackagePath>
</None>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.32" />
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
</ItemGroup>


<ItemGroup>
Expand All @@ -45,6 +54,5 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
</ItemGroup>
</Project>

0 comments on commit 50f5fef

Please sign in to comment.