Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mersocarlin/ddd-validation
DDD Library for validate your entities according Vaughn Vernon using C# / ASP.NET
https://github.com/mersocarlin/ddd-validation
aspnet c-sharp ddd-validation
Last synced: 10 days ago
JSON representation
DDD Library for validate your entities according Vaughn Vernon using C# / ASP.NET
- Host: GitHub
- URL: https://github.com/mersocarlin/ddd-validation
- Owner: mersocarlin
- License: mit
- Created: 2015-03-07T15:31:22.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-03T23:32:37.000Z (about 9 years ago)
- Last Synced: 2024-08-31T12:37:29.509Z (4 months ago)
- Topics: aspnet, c-sharp, ddd-validation
- Language: C#
- Homepage:
- Size: 152 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/mersocarlin/ddd-validation.svg?branch=master)](https://travis-ci.org/mersocarlin/ddd-validation)
# ddd-validation
DDD Library for validate your entities according Vaughn Vernon using C# / ASP.NET.
## Install via nuget package
```bash
Install-Package DDDValidation
```## Setup your class
```c#
using DDDValidation.Validation;namespace ExampleOfUse
{
public class DDDValidationClass
{
public DDDValidationClass()
{}
public string EqualsProperty { get; set; }
public string LengthProperty { get; set; }
public string NullProperty { get; set; }
public string EmailProperty { get; set; }public void Validate()
{
AssertionConcern.AssertArgumentEquals(this.EqualsProperty, "ddd-validation", "The property value for EqualsProperty must be equals to 'ddd-validation'");
AssertionConcern.AssertArgumentLength(this.LengthProperty, 30, "The property value for LengthProperty has a maxlength of 30");
AssertionConcern.AssertArgumentNotNull(this.NullProperty, "The value for NullProperty must be a not null value");
EmailAssertionConcern.AssertEmailFormat(this.EmailProperty, "The property value for EmailProperty must be a valid email address");
}
}
}
```## Example of usage
```c#
public void SaveInfo(DDDValidationClass validationClass)
{
try
{
validationClass.Validate();
//continue implementation
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
throw ex;
}
}
```