Skip to content

Commit 50f5fef

Browse files
authored
chore: support for netstandard2.0 (#159)
1 parent 7078011 commit 50f5fef

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/Rules.Framework/Evaluation/Compiled/RuleConditionsExpressionBuilder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ private void BuildFetchAndSwitchOverMultiplicity(
167167

168168
foreach (var multiplicity in operatorMetadata.SupportedMultiplicities)
169169
{
170+
#if NETSTANDARD2_0
171+
string multiplicityTransformed = Regex.Replace(multiplicity, "\\b\\p{Ll}", match => match.Value.ToUpperInvariant(), RegexOptions.None, TimeSpan.FromSeconds(1)).Replace("-", string.Empty);
172+
#else
170173
string multiplicityTransformed = Regex.Replace(multiplicity, "\\b\\p{Ll}", match => match.Value.ToUpperInvariant(), RegexOptions.None, TimeSpan.FromSeconds(1)).Replace("-", string.Empty, StringComparison.Ordinal);
174+
#endif
171175
var scopeName = new StringBuilder(builder.ScopeName)
172176
.Append(valueConditionNode.ConditionType)
173177
.Append(multiplicityTransformed)

src/Rules.Framework/Evaluation/OperatorMetadata.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ public bool HasSupportForOneMultiplicityAtLeft
1515
{
1616
if (this.leftSupportForOneMultiplicity is null)
1717
{
18+
#if NETSTANDARD2_0
19+
this.leftSupportForOneMultiplicity = this.SupportedMultiplicities?.Any(m => m.Contains("one-to")) ?? false;
20+
#else
1821
this.leftSupportForOneMultiplicity = this.SupportedMultiplicities?.Any(m => m.Contains("one-to", StringComparison.Ordinal)) ?? false;
22+
#endif
1923
}
2024

2125
return this.leftSupportForOneMultiplicity.GetValueOrDefault();

src/Rules.Framework/Rules.Framework.csproj

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.1</TargetFramework>
4+
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
55
<LangVersion>10.0</LangVersion>
66
<GenerateDocumentationFile>true</GenerateDocumentationFile>
77
<Authors></Authors>
@@ -33,6 +33,15 @@
3333
<PackagePath></PackagePath>
3434
</None>
3535
</ItemGroup>
36+
37+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
38+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
39+
</ItemGroup>
40+
41+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
42+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.32" />
43+
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
44+
</ItemGroup>
3645

3746

3847
<ItemGroup>
@@ -45,6 +54,5 @@
4554
<PrivateAssets>all</PrivateAssets>
4655
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4756
</PackageReference>
48-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
4957
</ItemGroup>
5058
</Project>

0 commit comments

Comments
 (0)