Skip to content

Instantly share code, notes, and snippets.

@sonicflare
Created October 7, 2015 07:58
Show Gist options
  • Save sonicflare/37e90e72923d6f10b4ca to your computer and use it in GitHub Desktop.
Save sonicflare/37e90e72923d6f10b4ca to your computer and use it in GitHub Desktop.
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