简体   繁体   中英

Handling DB errors in MVVM SL4

Quick example: An error occurred when attempting to save a record to a db. Or perhaps a timeout occurred on a job.

In MVVM, that's going to occur in my Model or DB Access layer. What's the method for handling that error (elegantly)?

Thanks,

Scott

Kinda of a big question.

Also it is very dependent on your user requirements.

For example:

Do you need just to show the user that something went wrong?

Simply put a property with a message, and a property to indicate a faulted state and have your View change itself accordingly.

Do you need to limit access until you can fix something?

Your VM can easily disable commands until you have re-initiated your connection or some other measure.

Perhaps if you have a scenario in mind, I can be more specific :)

HTH

Ariel

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM