Click here to Skip to main content
12,447,242 members (65,704 online)
Click here to Skip to main content

Stats

23.2K views
276 downloads
32 bookmarked
Posted

Create Custom Application Block Using .NET Enterprise Library

, 21 Oct 2009 CPOL
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;

namespace Project.Practice.DB
{
    public static class DBFactory
    {

        public static IDBProvider CreateProvider()
        {
            try
            {
                DBProviderFactory factory = new DBProviderFactory(ConfigurationSourceFactory.Create());
                return factory.CreateDefault();
            }
            catch (ConfigurationErrorsException configurationException)
            {
                throw;
            }
        }
         public static IDBProvider CreateProvider( string name )
        {
        try
        {
            DBProviderFactory factory = new DBProviderFactory( ConfigurationSourceFactory.Create() );
            return factory.Create( name );
        }
        catch( ConfigurationErrorsException configurationException )
        {
            throw;
        }
     }
    }
   
}



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
India India
Whatsup-->Exploring--> MVC/HTML5/Javascript & Virtualization.......!
www.santoshpoojari.blogspot.com

You may also be interested in...

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