Click here to Skip to main content
15,896,557 members
Articles / Web Development / HTML

Transformalizing NorthWind

Rate me:
Please Sign up or sign in to vote.
4.95/5 (29 votes)
24 Jul 2014GPL37 min read 57.8K   341   53  
Combining de-normalization, transformation, replication, and awesome-ness.
//===============================================================================
// Microsoft patterns & practices Enterprise Library
// Validation Application Block
//===============================================================================
// Copyright © Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================

using System;

namespace Transformalize.Libs.EnterpriseLibrary.Validation.Validators
{
	/// <summary>
	/// Marks a method as implementing self validation logic.
	/// </summary>
	/// <remarks>
	/// The following conditions must be met for a method to be considered for self validation:
	/// <list type="number">
    /// <item><term>The type for which the validation is being created must have the <see cref="HasSelfValidationAttribute"/>.</term></item>
    /// <item><term>The method must have the <see cref="SelfValidationAttribute"/> with configured for the requested ruleset.</term></item>
    /// <item><term>The method must be void and take a single parameter of type <see cref="ValidationResults"/>.</term>term></item>
	/// </list>
	/// <para/>
	/// Non-public methods can be used for self validation, although inherited non-public methods will not be used.
	/// <para/>
	/// There is no configuration based way to specify self validation.
	/// </remarks>
	/// <seealso cref="SelfValidationValidator"/>
	/// <seealso cref="HasSelfValidationAttribute"/>
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
	public sealed class SelfValidationAttribute : Attribute
	{
		private string ruleset = string.Empty;

		/// <summary>
		/// Gets or set the ruleset for which the self validation method must be included.
		/// </summary>
		public string Ruleset
		{
			get { return ruleset; }
			set { ruleset = value; }
		}

        private readonly Guid typeId = Guid.NewGuid();

        /// <summary>
        /// Gets a unique identifier for this attribute.
        /// </summary>
        public override object TypeId
        {
            get
            {
                return this.typeId;
            }
        }
    }
}

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 GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions