Click here to Skip to main content
13,287,177 members (51,401 online)
Click here to Skip to main content

Stats

26.9K views
291 downloads
32 bookmarked
Posted 28 Sep 2009

Create Custom Application Block Using .NET Enterprise Library

, 21 Oct 2009
This white paper is written in a view to help developer to create custom application block using .NET Enterprise Library.
CustomAppBlock
SampleCustomBlock
SampleCustomBlock
bin
Debug
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.ObjectBuilder.dll
Project.Practice.DB.dll
Configuration
Project.Practice.DB.csproj.user
Properties
sn.snk
SampleCustomBlock.suo
WebSite2
App_Data
Bin
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.ObjectBuilder.dll
Project.Practice.DB.dll
WebSite2 (2).suo
using System;
using System.Configuration;

using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;

using Project.Practice.DB;
namespace Project.Practice.DB.Configuration
{

    [Assembler(typeof(DBAssembler))]
    public class DBData : NameTypeConfigurationElement
    {
        private const string userIdProperty = "userID";
        private const string passwordProperty = "password";
        private const string serverProperty = "server";
        private const string databaseProperty = "database";

        public DBData()
            : base("DBData", typeof(IDBProvider))
        {
        }
        public DBData(string name, Type type)
            : base(name, type)
        {
        }

        [ConfigurationProperty(userIdProperty, IsRequired = true)]
        public string UserId
        {
            get { return (string)this[userIdProperty]; }
            set { this[userIdProperty] = value; }
        }

        [ConfigurationProperty(passwordProperty, IsRequired = true)]
        public string Password
        {
            get { return (string)this[passwordProperty]; }
            set { this[passwordProperty] = value; }
        }

        [ConfigurationProperty(serverProperty, IsRequired = true)]
        public string Server
        {
            get { return (string)this[serverProperty]; }
            set { this[serverProperty] = value; }
        }

        [ConfigurationProperty(databaseProperty, IsRequired = false)]
        public string Database
        {
            get { return (string)this[databaseProperty]; }
            set { this[databaseProperty] = value; }
        }
    }

}

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)

Share

About the Author

santosh poojari
Technical Lead
Australia Australia
Whatsup-->Exploring--> MVC/HTML5/Javascript & Virtualization.......!
www.santoshpoojari.blogspot.com

You may also be interested in...

Pro
Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171207.1 | Last Updated 21 Oct 2009
Article Copyright 2009 by santosh poojari
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid