Click here to Skip to main content
15,895,799 members
Articles / Programming Languages / Visual Basic

Business object property validation

Rate me:
Please Sign up or sign in to vote.
3.43/5 (9 votes)
16 May 2008CPOL5 min read 44.2K   238   34  
How to set and validate properties in a single line of code.
'Copyright � 2006 Edward Steward

Option Strict Off
Option Explicit On 

Imports BusinessRules.Attributes

Namespace Structures

    Public Structure structTEST

        'Use the custom attributes defined in the BusinessRules.Attributes 
        'namespace. These attributes will form part of the general/generic
        'business rules that apply to this property
        <NotNull(), NotEmpty(), MaxLength(50)> Public Name As String

    End Structure

End Namespace

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions