Click here to Skip to main content
15,892,965 members
Articles / Programming Languages / Visual Basic

Simulating Stored Procedures in Microsoft Access using Enterprise Library Application Blocks

Rate me:
Please Sign up or sign in to vote.
3.46/5 (12 votes)
25 Jul 2005MIT6 min read 98.3K   1.1K   37  
Simulating stored procedures in Microsoft Access using Enterprise Library Application Blocks.
//===============================================================================
// Microsoft patterns & practices Enterprise Library
// Data Access 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;
using System.ComponentModel;
using Microsoft.Practices.EnterpriseLibrary.Configuration.Design;
using Microsoft.Practices.EnterpriseLibrary.Configuration.Design.Validation;

namespace Microsoft.Practices.EnterpriseLibrary.Data.Configuration.Design
{
    /// <summary>
    /// <para>
    /// Represents a parameter to the connection string for a database in the application.
    /// </para>
    /// </summary>
    [Image(typeof(ParameterNode))]
    public class ParameterNode : ConfigurationNode
    {
        private ParameterData parameterData;

        /// <summary>
        /// <para>
        /// Initialize a new instance of the <see cref="ParameterNode"/> class.
        /// </para>
        /// </summary>
        public ParameterNode() : this(new ParameterData(SR.DefaultParameterNodeName, string.Empty))
        {
        }

        /// <summary>
        /// <para>
        /// Initialize a new instance of the <see cref="ParameterNode"/> class with a <see cref="ParameterData"/> object.
        /// </para>
        /// </summary>
        /// <param name="parameter">
        /// <para>The <see cref="ParameterData"/> runtime configuration.</para>
        /// </param> 
        public ParameterNode(ParameterData parameter) : base()
        {
            if (parameter == null)
            {
                throw new ArgumentNullException("parameter");
            }
            this.parameterData = parameter;
        }

        /// <summary>
        /// <para>
        /// Gets or sets the value of the parameter.
        /// </para>
        /// </summary>
        /// <value>
        /// <para>
        /// The name of the parameter.
        /// </para>
        /// </value>
        [Required]
        [SRCategory(SR.Keys.CategoryGeneral)]
        [SRDescription(SR.Keys.ParameterValueDescription)]
        public virtual string Value
        {
            get { return this.parameterData.Value; }
            set { this.parameterData.Value = value; }
        }

        /// <summary>
        /// <para>Gets the runtime configuration <see cref="ParameterData"/>.</para>
        /// </summary>
        /// <value>
        /// <para>The runtime configuration <see cref="ParameterData"/>.</para>
        /// </value>
        [Browsable(false)]
        public virtual ParameterData Parameter
        {
            get { return this.parameterData; }
        }

        /// <summary>
        /// <para>Sets the <seeals cref="ConfigurationNode.Name"/> to the <seealso cref="ParameterData.Name"/></para>
        /// </summary>
        protected override void OnSited()
        {
            base.OnSited();
            Site.Name = parameterData.Name;
        }

        /// <summary>
        /// <para>Sets the <seeals cref="ParameterData.Name"/> to the <seealso cref="ConfigurationNode.Name"/></para>
        /// </summary>
        /// <param name="e"><para>A <see cref="ConfigurationNodeChangedEventArgs"/> that contains the event data.</para></param>
        protected override void OnRenamed(ConfigurationNodeChangedEventArgs e)
        {
            base.OnRenamed(e);
            parameterData.Name = e.Node.Name;
        }
    }
}

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 MIT License


Written By
Software Developer (Senior) http://ADefWebserver.com
United States United States
Michael Washington is a Microsoft MVP. He is a ASP.NET and
C# programmer.
He is the founder of
AiHelpWebsite.com,
LightSwitchHelpWebsite.com, and
HoloLensHelpWebsite.com.

He has a son, Zachary and resides in Los Angeles with his wife Valerie.

He is the Author of:

Comments and Discussions