views:

212

answers:

1

The Model object refuses to update on production server but has no issues on development machine. For the purposes of testing, I retrieve the model object and then immediately check its validation and update states, for example:

        Timesheet timesheet = _timesheetRepository.GetTimesheet(timesheetId);
        Helpers.ErrorHandler check = new Helpers.ErrorHandler();
        check.write("can I validate immediately? :- ", TryValidateModel(timesheet).ToString());
        check.write("can I save immediately? :- ", TryUpdateModel(timesheet).ToString());

TryValidateModel - returns true TryUpdateModel - returns false

Any recommendations?

+1  A: 

Validation and binding are different. Invalid data can often be bound (this is a feature; it makes re-displaying a page in the case of an error much easier), and "valid" (per your validation rules, if any) data sometimes can't be bound, due to typing conflicts.

Craig Stuntz
Yes I appreciate the concepts of validation and binding, its a cornerstone of WPF but more-so the question is how to go about debugging and isolating the problem?
Klaptrap
Personally I debug binding by [building MVC with source](http://blog.stevensanderson.com/2009/02/03/using-the-aspnet-mvc-source-code-to-debug-your-app/) and tracing through it.
Craig Stuntz
Nice. This is what I need as I have debugged down to the metadata with no exceptions showing - thanks a million!
Klaptrap