views:

21

answers:

0

I had issued with using a ModelStateWrapper in MVC 1 as described here: http://www.asp.net/mvc/tutorials/validating-with-a-service-layer--cs

As much as I was able to test my application it still felt like there was a dependency/circular reference with the ModelState, the controller and the service layer. With the new DataAnnotation in MVC 2 doing most of the validation on the model (which I'm still trying to determine if this is the best way of handling validation) how would best handle other errors such as connection issues or duplicate entry errors? Is it still 'best practise' to pass in a ModelStateWrapper?

I'm interested to hear how other people handle this as this issue has bothered me for ages and I can't seem to find a 'definitive' answer, or at least an answer that makes me go "Ah, yes, that makes sense". :)

It irritates me when you see Microsoft implement a repository pattern for NerdDinner and recommend TDD and they don't touch on how to handle the passage of error and validation messages that are outside of the normal Model validation.