Validation for DTO using DataAnnotations I need validation for all DTO objects using System.ComponentModel.DataAnnotations. 
You can see how I implemented. Idea is to have one abstract class that will be inherited  in all dto classes.
This abstract class have check if object is valid and get all validation results.

Is this good approach?

What do you think?

dto base class :

  public abstract class DtoBase : IValidatableObject
    {
        public virtual IEnumerable&lt;ValidationResult&gt; GetValidationResult()
        {
            return Validate(new ValidationContext(this));
        }

        public bool IsValid()
        {
            return Validate(new ValidationContext(this)).Count() == 0;
        }

        public virtual IEnumerable&lt;ValidationResult&gt; Validate(ValidationContext validationContext)
        {
            var results = new List&lt;ValidationResult&gt;();
            Validator.TryValidateObject(this, validationContext, results, true);

            return results;
        }
    }


dto work item :

 public class WorkItemDto : DtoBase
    {
        public WorkItemDto()
        {
        }

        public int Id { get; set; }

        [StringLength(500, MinimumLength = 200)]
        public string Description { get; set; }

        [Range(20, 5000)]
        public int ItemNumValue { get; set; }

        public ICollection&lt;ItemUsageDto&gt; Usage { get; set; }
    }


Example how to use in wpf or in mvc project (it have to work in any client):

 var item = new WorkItemDto();
 item.Description = "my descryption";
 item.ItemNumValue = 5;
 item.Id = 7;

 var isValid = item.IsValid();
 var allResults = item.GetValidationResult();
What do you think about non static validators? While making validators smarter, we will sooner or later need to wire up their dependencies (like repositories)... Validators can easily do much more while being instantiated by IoC container.

I would suggest to define this interface and class:

interface IModelValidator&lt;in T&gt;
{
    IEnumerable&lt;string&gt; Validate(T subject);
}

class ModelValidator&lt;T&gt; : IModelValidator&lt;T&gt;
{
    public ModelValidator(IEnumerable&lt;IModelValidator&lt;T&gt;&gt; validators)
    {
        Validators = validators;
    }

    public IEnumerable&lt;string&gt; Validate(T subject) =&gt;
        Validators.SelectMany(v =&gt; v.Validate(subject));

    IEnumerable&lt;IModelValidator&lt;T&gt;&gt; Validators { get; }
}


Now some demo code; models:

class Order { }
class MailOrder : Order { }


Validators:

class OrderValidator : IModelValidator&lt;Order&gt;
{
    public IEnumerable&lt;string&gt; Validate(Order subject)
    {
        yield return "Bad order.";
    }
}

class MailOrderValidator : IModelValidator&lt;MailOrder&gt;
{
    public IEnumerable&lt;string&gt; Validate(MailOrder subject)
    {
        yield return "Bad mail order.";
    }
}


Something to check validity of the order:

class Controller
{
    public Controller(ModelValidator&lt;MailOrder&gt; validator)
    {
        var order = new MailOrder();
        foreach (var message in validator.Validate(order))
            Console.WriteLine(message);
    }
}


So now it is just about proper registering them in IoC container (here Autofac):

class Program
{
    static void Main(string[] args)
    {
        var builder = new ContainerBuilder();
        builder.RegisterSource(new ContravariantRegistrationSource());
        builder.RegisterGeneric(typeof(ModelValidator&lt;&gt;))
            .AsSelf();
        builder.RegisterType&lt;OrderValidator&gt;()
            .AsImplementedInterfaces();
        builder.RegisterType&lt;MailOrderValidator&gt;()
            .AsImplementedInterfaces();
        builder.RegisterType&lt;Controller&gt;()
            .AsSelf();

        IContainer container = builder.Build();
        var controller = container.Resolve&lt;Controller&gt;();
    }
}


You could play with it to discover how perfectly contravarians works here. You just declare what to validate - compatible validators will show up. No need to change client code - just register more validators if necessary. One of them might be IModelValidator&lt;DtoBase&gt; with attribute checking.