Looking at the code, it seems to me that TryValidateModel will check all models of the type specified by the provided object, and not just this specific object. Moreover, it returns the current value of the ModelState.IsValid property, so when there is an invalid model, all calls to TryValidateModel will return false. If you want to do something like this, I think you will need to run and check the validators for each instance of the model on that particular instance of the model.
I also think that model validators were already running by the time you manually call them. You can verify this (for an invalid model) by looking at the ModelState.IsValid value before your loop. If it is false, it means that the validators were executed using the modelβs connecting device, which, it seems to me, is happening.
You can find the source code for MVC http://aspnet.codeplex.com/ .
source share