I'm building an .NET library and was wondering if there's any validation framework for that. My intention is just validate data-fields, you know, something like ASP.NET MVC validation attributes. There is any?
Post-comments edit:
Actually I am not using any framework like WPF or MVC. Just "plain object" library for data handling. I need to check, for instance, if some object was properly "filled" (mandatory fields, dates and etc).
Enterprise Library - Sorry, added better link.
The validation attributes that MVC uses are part of System.ComponentModel.DataAnnotations, and can be used in ASP.NET MVC, Silverlight, and WPF. With fairly minimal work, they can be incorporated into data models for at least some ORMs, assuming that the data model is not replaced when updated. (or, with some additional pain, metadata classes can be attached to data models, but as separate partial classes for the data model).
ASP.NET web forms has its own set of validation controls. They run both client and server side, as part of the UI, but don't extend to data model validation.
WinForms has some interesting error indicators that can be use programmatically to manage error detection and require validation, but the validation itself is basically up to the developer.
FWIW, I strongly support the data annotations framework, and wish it could be available retroactively to other .NET environments. (Currently stuck in web forms, and missing those annotations.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With