fluent validation unique value code example
Example: how to validate if field is unique based on id using fluentValidation
private bool UniqueName(Category category, string name)
{
ProjecteDataContext _db = new ProjecteDataContext();
var dbCategory = _db.Categories
.Where(x => x.Name.ToLower() == name.ToLower())
.SingleOrDefault();
if (dbCategory == null)
return true;
return dbCategory.ID == category.ID;
}