-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
82 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup Label="Globals"> | ||
<SccProjectName>SAK</SccProjectName> | ||
<SccProvider>SAK</SccProvider> | ||
<SccAuxPath>SAK</SccAuxPath> | ||
<SccLocalPath>SAK</SccLocalPath> | ||
<PackageProjectUrl>http://www.dimenics.com</PackageProjectUrl> | ||
<PackageReleaseNotes></PackageReleaseNotes> | ||
<PackageTags>Rules</PackageTags> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<AssemblyTitle>Dime.Rules</AssemblyTitle> | ||
<VersionPrefix>1.0.3</VersionPrefix> | ||
<Authors>Dimenics</Authors> | ||
<TargetFrameworks>netstandard2.1;net461</TargetFrameworks> | ||
<AssemblyName>Dime.Rules</AssemblyName> | ||
<PackageId>Dime.Rules</PackageId> | ||
<PackageIconUrl>http://dimenuget.azurewebsites.net/Images/dimenuget.png</PackageIconUrl> | ||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> | ||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> | ||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> | ||
<IncludeSource>True</IncludeSource> | ||
<IncludeSymbols>True</IncludeSymbols> | ||
<Description>Simple business rules framework</Description> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<Version>1.0.3</Version> | ||
<NeutralLanguage>en</NeutralLanguage> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<RepositoryUrl>https://github.com/dimenics/dime-rules</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net8.0</TargetFrameworks> | ||
<Authors>Dime Software</Authors> | ||
<Company>Dime Software</Company> | ||
<Product>Validation Rules</Product> | ||
<Description>Route and travel time calculator</Description> | ||
<PackageProjectUrl>https://github.com/dimesoftware/maps</PackageProjectUrl> | ||
<PackageIconUrl>https://cdn.dime-software.com/dime-software/logo-shape.png</PackageIconUrl> | ||
<Version>1.1.0</Version> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<IncludeSymbols>true</IncludeSymbols> | ||
<NeutralLanguage>en</NeutralLanguage> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<RepositoryUrl>https://github.com/dimesoftware/rules</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<None Include="README.md" Pack="true" PackagePath="\"/> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
namespace Dime.Rules | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
public interface IValidationEngine<in T> where T : class | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="item"></param> | ||
/// <returns></returns> | ||
ValidationResult Validate(T item); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Dime.Rules | ||
|
||
Simple rule engine. | ||
|
||
## Installation | ||
|
||
Use the package manager NuGet to install the package: | ||
|
||
```cli | ||
dotnet add package Dime.Rules | ||
``` | ||
|
||
## Usage | ||
|
||
``` csharp | ||
using Dime.Rules; | ||
|
||
public bool Validate(MyClass item) | ||
{ | ||
var rule1 = new ValidationRule<Customer>(x => x != null, "Item cannot be null"); | ||
var rule2 = new ValidationRule<Customer>(x => x.IsActive == true, "IsActive needs to be true"); | ||
|
||
ValidationEngine<Customer> engine = new ValidationEngine<Customer>(rule1, rule2); | ||
ValidationResult validationResult = engine.Validate(item); | ||
return validationResult.IsValid; | ||
} | ||
``` | ||
|
||
## Contributing | ||
|
||
 | ||
|
||
Pull requests are welcome. Please check out the contribution and code of conduct guidelines. | ||
|
||
## Local development | ||
|
||
- You must have Visual Studio 2022 Community or higher. | ||
- The dotnet cli is also highly recommended. | ||
|
||
## License | ||
|
||
[](http://badges.mit-license.org) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFrameworks>net8.0</TargetFrameworks> | ||
<AssemblyName>Dime.Rules.Tests</AssemblyName> | ||
<PackageId>Dime.Rules.Tests</PackageId> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Label="Globals"> | ||
<SccProjectName>SAK</SccProjectName> | ||
<SccProvider>SAK</SccProvider> | ||
<SccAuxPath>SAK</SccAuxPath> | ||
<SccLocalPath>SAK</SccLocalPath> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="coverlet.msbuild" Version="6.0.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.CodeCoverage" Version="17.8.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks> | ||
<AssemblyName>Dime.Rules.Tests</AssemblyName> | ||
<PackageId>Dime.Rules.Tests</PackageId> | ||
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion> | ||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> | ||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> | ||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="coverlet.msbuild" Version="2.9.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.CodeCoverage" Version="16.6.1" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\core\Dime.Rules.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\core\Dime.Rules.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.