Skip to content

Commit 3949215

Browse files
committed
Target .NET 8
1 parent 61f4cfe commit 3949215

File tree

12 files changed

+82
-159
lines changed

12 files changed

+82
-159
lines changed

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
# Dime.Rules
1+
<div align="center"><img src="assets/logo.png?raw=true" width="350" alt="Logo"></div>
22

3-
[![Build Status](https://dev.azure.com/dimenicsbe/Utilities/_apis/build/status/Rules%20-%20MAIN%20-%20CI?branchName=master)](https://dev.azure.com/dimenicsbe/Utilities/_build/latest?definitionId=89&branchName=master) ![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/dimenicsbe/Utilities/89?label=code%20coverage)
43

5-
## Introduction
6-
7-
Simple rule engine.
4+
<div align="center"><h1>Dime.Rules</h1></div>
85

96
## Getting Started
107

assets/logo.png

355 KB
Loading

src/core/Dime.Rules.csproj

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,22 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup Label="Globals">
3-
<SccProjectName>SAK</SccProjectName>
4-
<SccProvider>SAK</SccProvider>
5-
<SccAuxPath>SAK</SccAuxPath>
6-
<SccLocalPath>SAK</SccLocalPath>
7-
<PackageProjectUrl>http://www.dimenics.com</PackageProjectUrl>
8-
<PackageReleaseNotes></PackageReleaseNotes>
9-
<PackageTags>Rules</PackageTags>
10-
</PropertyGroup>
11-
<PropertyGroup>
12-
<AssemblyTitle>Dime.Rules</AssemblyTitle>
13-
<VersionPrefix>1.0.3</VersionPrefix>
14-
<Authors>Dimenics</Authors>
15-
<TargetFrameworks>netstandard2.1;net461</TargetFrameworks>
16-
<AssemblyName>Dime.Rules</AssemblyName>
17-
<PackageId>Dime.Rules</PackageId>
18-
<PackageIconUrl>http://dimenuget.azurewebsites.net/Images/dimenuget.png</PackageIconUrl>
19-
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
20-
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
21-
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
22-
<IncludeSource>True</IncludeSource>
23-
<IncludeSymbols>True</IncludeSymbols>
24-
<Description>Simple business rules framework</Description>
25-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
26-
<Version>1.0.3</Version>
27-
<NeutralLanguage>en</NeutralLanguage>
28-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
29-
<RepositoryUrl>https://github.com/dimenics/dime-rules</RepositoryUrl>
30-
<RepositoryType>git</RepositoryType>
31-
</PropertyGroup>
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net8.0</TargetFrameworks>
5+
<Authors>Dime Software</Authors>
6+
<Company>Dime Software</Company>
7+
<Product>Validation Rules</Product>
8+
<Description>Route and travel time calculator</Description>
9+
<PackageProjectUrl>https://github.com/dimesoftware/maps</PackageProjectUrl>
10+
<PackageIconUrl>https://cdn.dime-software.com/dime-software/logo-shape.png</PackageIconUrl>
11+
<Version>1.1.0</Version>
12+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
13+
<IncludeSymbols>true</IncludeSymbols>
14+
<NeutralLanguage>en</NeutralLanguage>
15+
<PackageReadmeFile>README.md</PackageReadmeFile>
16+
<RepositoryUrl>https://github.com/dimesoftware/rules</RepositoryUrl>
17+
<RepositoryType>git</RepositoryType>
18+
</PropertyGroup>
19+
<ItemGroup>
20+
<None Include="README.md" Pack="true" PackagePath="\"/>
21+
</ItemGroup>
3222
</Project>

src/core/IValidationEngine.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
namespace Dime.Rules
22
{
3-
/// <summary>
4-
///
5-
/// </summary>
6-
/// <typeparam name="T"></typeparam>
73
public interface IValidationEngine<in T> where T : class
84
{
9-
/// <summary>
10-
///
11-
/// </summary>
12-
/// <param name="item"></param>
13-
/// <returns></returns>
145
ValidationResult Validate(T item);
156
}
167
}

src/core/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/core/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Dime.Rules
2+
3+
Simple rule engine.
4+
5+
## Installation
6+
7+
Use the package manager NuGet to install the package:
8+
9+
```cli
10+
dotnet add package Dime.Rules
11+
```
12+
13+
## Usage
14+
15+
``` csharp
16+
using Dime.Rules;
17+
18+
public bool Validate(MyClass item)
19+
{
20+
var rule1 = new ValidationRule<Customer>(x => x != null, "Item cannot be null");
21+
var rule2 = new ValidationRule<Customer>(x => x.IsActive == true, "IsActive needs to be true");
22+
23+
ValidationEngine<Customer> engine = new ValidationEngine<Customer>(rule1, rule2);
24+
ValidationResult validationResult = engine.Validate(item);
25+
return validationResult.IsValid;
26+
}
27+
```
28+
29+
## Contributing
30+
31+
![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)
32+
33+
Pull requests are welcome. Please check out the contribution and code of conduct guidelines.
34+
35+
## Local development
36+
37+
- You must have Visual Studio 2022 Community or higher.
38+
- The dotnet cli is also highly recommended.
39+
40+
## License
41+
42+
[![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://badges.mit-license.org)

src/core/ValidationEngine.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,15 @@
33

44
namespace Dime.Rules
55
{
6-
/// <summary>
7-
///
8-
/// </summary>
9-
/// <typeparam name="T"></typeparam>
106
public class ValidationEngine<T> : IValidationEngine<T> where T : class
117
{
12-
/// <summary>
13-
///
14-
/// </summary>
15-
/// <param name="rules"></param>
168
public ValidationEngine(params ValidationRule<T>[] rules)
179
{
1810
_rules = rules.ToList();
1911
}
2012

2113
private readonly IEnumerable<ValidationRule<T>> _rules;
2214

23-
/// <summary>
24-
/// Executes the rules.
25-
/// </summary>
26-
/// <param name="item">The item.</param>
27-
/// <returns></returns>
2815
public virtual ValidationResult Validate(T item)
2916
{
3017
ValidationResult validationResult = new ValidationResult { IsValid = true };

src/core/ValidationResult.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,10 @@
22

33
namespace Dime.Rules
44
{
5-
/// <summary>
6-
///
7-
/// </summary>
85
public class ValidationResult
96
{
10-
/// <summary>
11-
/// Indicates the status of the validation run
12-
/// </summary>
137
public bool IsValid { get; set; }
148

15-
/// <summary>
16-
/// Informative messages about the result of the rule evaluation
17-
/// </summary>
189
public IEnumerable<string> Messages { get; set; }
1910
}
2011
}

src/core/ValidationRule.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,8 @@
22

33
namespace Dime.Rules
44
{
5-
/// <summary>
6-
///
7-
/// </summary>
8-
/// <typeparam name="T"></typeparam>
95
public class ValidationRule<T> where T : class
106
{
11-
/// <summary>
12-
///
13-
/// </summary>
14-
/// <param name="rule"></param>
15-
/// <param name="message"></param>
167
public ValidationRule(Func<T, bool> rule, string message)
178
{
189
Rule = rule;

src/test/Dime.Rules.Tests.csproj

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,23 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFrameworks>net8.0</TargetFrameworks>
4+
<AssemblyName>Dime.Rules.Tests</AssemblyName>
5+
<PackageId>Dime.Rules.Tests</PackageId>
6+
</PropertyGroup>
27

3-
<PropertyGroup Label="Globals">
4-
<SccProjectName>SAK</SccProjectName>
5-
<SccProvider>SAK</SccProvider>
6-
<SccAuxPath>SAK</SccAuxPath>
7-
<SccLocalPath>SAK</SccLocalPath>
8-
</PropertyGroup>
8+
<ItemGroup>
9+
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
10+
<PrivateAssets>all</PrivateAssets>
11+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
12+
</PackageReference>
13+
<PackageReference Include="Microsoft.CodeCoverage" Version="17.8.0" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
15+
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
16+
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
17+
</ItemGroup>
918

10-
<PropertyGroup>
11-
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks>
12-
<AssemblyName>Dime.Rules.Tests</AssemblyName>
13-
<PackageId>Dime.Rules.Tests</PackageId>
14-
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
15-
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
16-
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
17-
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
18-
</PropertyGroup>
19-
20-
<ItemGroup>
21-
<PackageReference Include="coverlet.msbuild" Version="2.9.0">
22-
<PrivateAssets>all</PrivateAssets>
23-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
24-
</PackageReference>
25-
<PackageReference Include="Microsoft.CodeCoverage" Version="16.6.1" />
26-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
27-
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
28-
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
29-
</ItemGroup>
30-
31-
<ItemGroup>
32-
<ProjectReference Include="..\core\Dime.Rules.csproj" />
33-
</ItemGroup>
19+
<ItemGroup>
20+
<ProjectReference Include="..\core\Dime.Rules.csproj" />
21+
</ItemGroup>
3422

3523
</Project>

src/test/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

tools/Nuget.config

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)