Created
October 7, 2015 07:58
-
-
Save sonicflare/37e90e72923d6f10b4ca to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using FluentValidation; | |
namespace ConsoleApplication11 | |
{ | |
public class Entity | |
{ | |
public string Type { get; set; } | |
} | |
public class EntityValidator : AbstractValidator<Entity> | |
{ | |
public EntityValidator() | |
{ | |
this.RuleFor(a => a.Type) | |
.NotEmpty() | |
.WithMessage("Type cannot be null or empty"); | |
} | |
} | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
Entity entity = null; | |
var validator = new EntityValidator(); | |
validator.Validate(entity); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment