Lightweight authentication framework for WPF using MV-VM

When implementing MV-VM in the project and Karl Shifflett ’s subsequent advice on implementing the verification framework, we don’t really want to use the full structure (for example, Ocean) for the validation part only.

What verification structure do you recommend working with the MV-VM pattern?

+4
source share
2 answers

I can only speak from the experience of using the full validation framework, as I just stuck to what WPF offers.

In my project, I implemented an IDataError interface for my object / data classes, and also implemented a partial "OnValidate" method that observes Linq-To-Sql, and then as static / general members of entity classes, validations of home helpers that provide a logic diagram for implementations of the IDataError.Items and OnValidation methods.

Then this is just the case of adding ValidatesOnErrors = True, ValidatesOnExceptions = True for all the bindings described in XAML. The end result is encouraging - WPF's ability to provide visual feedback on invalid data is good, and efforts to implement validation are minimal.

I would advise following the tendency to keep the user login verification logic separate from the property setting logic. Sometimes the validity of one property depends on the state of another property. Saving the validation logic outside of property definition tools allows you to create applications in which the end user can enter two values ​​that lead to a valid state, without any individual property identifiers rejecting the values ​​as they are entered.

+1
source

You can take a look at the WPF Application Framework (WAF) , which comes with a lightweight validation card.

It reuses the validation structure of the System.ComponentModel.DataAnnotations .NET Framework and combines it with IDataErrorInfo support for WPF data binding.

0
source

All Articles