Click here to Skip to main content
15,893,401 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.7K   341   53  
Combining de-normalization, transformation, replication, and awesome-ness.
//===============================================================================
// Microsoft patterns & practices Enterprise Library
// Core
//===============================================================================
// 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;
using System.Diagnostics;

namespace Transformalize.Libs.EnterpriseLibrary.Common.Instrumentation
{
    /// <summary>
    /// Defines a <see cref="PerformanceCounter"></see>. Used by the reflection-based installers to 
    /// prepare a performance counter for installation.
    /// </summary>
    [AttributeUsage(AttributeTargets.Field)]
    public sealed class PerformanceCounterAttribute : Attribute
    {
        private string counterName;
        private string counterHelp;
        private PerformanceCounterType counterType;

        private string baseCounterName;
        private string baseCounterHelp;
        private PerformanceCounterType baseCounterType;

        /// <summary>
        /// Initializes this object with all data needed to install a <see cref="PerformanceCounter"></see>.
        /// </summary>
        /// <param name="counterName">Performance counter name.</param>
        /// <param name="counterHelp">Name of Help resource string. This is not the help text itself, 
        /// but is the resource name used to look up the internationalized help text at install-time.</param>
        /// <param name="counterType">Performance Counter type.</param>
        public PerformanceCounterAttribute(string counterName, string counterHelp, PerformanceCounterType counterType)
        {
            this.counterName = counterName;
            this.counterHelp = counterHelp;
            this.counterType = counterType;
        }

        /// <summary>
        /// Gets the <see cref="PerformanceCounter"></see> type.
        /// </summary>
        public PerformanceCounterType CounterType
        {
            get { return counterType; }
        }

        /// <summary>
        /// Get the name of Help resource string. This is not the help text itself, 
        /// but is the resource name used to look up the internationalized help text at install-time.
        /// </summary>
        public string CounterHelp
        {
            get { return counterHelp; }
        }

        /// <summary>
        /// Gets the <see cref="PerformanceCounter"></see> name.
        /// </summary>
        public string CounterName
        {
            get { return counterName; }
        }

        /// <summary>
        /// Gets and sets the base <see cref="PerformanceCounter"></see> type. This is an optional 
        /// property used when the counter being defined requires a base counter to operate, such as for 
        /// averages.
        /// </summary>
        public PerformanceCounterType BaseCounterType
        {
            get { return baseCounterType; }
            set { baseCounterType = value; }
        }

        /// <summary>
        /// Gets and sets the base <see cref="PerformanceCounter"></see> help resource name. 
        /// This is not the help text itself, 
        /// but is the resource name used to look up the internationalized help text at install-time.
        /// This is an optional 
        /// property used when the counter being defined requires a base counter to operate, such as for 
        /// averages.
        /// </summary>
        public string BaseCounterHelp
        {
            get { return baseCounterHelp; }
            set { baseCounterHelp = value; }
        }

        /// <summary>
        /// Gets and sets the base <see cref="PerformanceCounter"></see> name. This is an optional 
        /// property used when the counter being defined requires a base counter to operate, such as for 
        /// averages.
        /// </summary>
        public string BaseCounterName
        {
            get { return baseCounterName; }
            set { baseCounterName = value; }
        }

        /// <summary>
        /// Used to determine if the counter being installed has a base counter associated with it.
        /// </summary>
        /// <returns>True if counter being installed has a base counter associated with it.</returns>
        public bool HasBaseCounter() { return baseCounterName != null; }
    }
}

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