How can i run all DataAnnotation validations on model?
I'm building a model instance from code and i don't have no modelstate binding or anything. I just want to run all my validations against it... I am using EF CodeFirst.
public class Category
{
public int Id { get; set; }
[Required]
public string Name { get; set; }
}
cat = new Category();
if (cat.IsValid()) { /* blah */ } // i want something like this
I know it's probably a stupid question but i can't seem to find an answer anywhere..