I have come across this before and wonder if anyone else has a slick way to handle my dilemma.
While playing with the Enterprise Library Validation Block, they ONLY provide static methods to receive an IValidator through methods that force a generic parameter:
protected IValidator<T> _validator =ValidationFactory.CreateValidator<T>();
A nongeneric IValidator is also provided which would be great to have in my layer superclass without me having to pass generic parameters into the superclass everytime...but they don't let you pass the Type into the validation factory so it could look like this:
protected IValidator _validator =ValidationFactory.CreateValidator(myType);
Looking at the code, it doesn't require this strongtyping (they cast it to typeof(T) in the methods)...so this appears to be a incomplete API.
How would you get around this?