How to use Enterprise Library using C#
Summary
The Microsoft Enterprise Library is a collection of reusable software components (application blocks) designed to assist software developers with common enterprise development cross-cutting concerns (such as logging, validation, data access, exception handling, and many others). Application blocks are a type of guidance; they are provided as source code, test cases, and documentation that can be used "as is," extended, or modified by developers to use on complex, enterprise-level line-of-business development projects.
Some Features
While using enterprise library you have to concern about opening and closing connections.
This will automatically handle connection pooling and other important errors of connection and database.
I had used Enterprise Library 2.0 - January 2006.
To use Enterprise Library you required to add reference of following files:-
Download Enterprise Library from following links:-
http://crococode.com/user/Download.aspx
You can also download code running code which is using master database as example.
http://www.4shared.com/file/110209896/9461588/EnterpriseLibraryDemo.html
Goals for Enterprise Library
Enterprise Library is a collection of application blocks intended for use by developers who build complex, enterprise-level applications.
Enterprise Library is used when building applications that are typically to be deployed widely and to interoperate with other applications and systems. In addition, they generally have strict security, reliability, and performance requirements.
The goals of Enterprise Library are the following:
The Microsoft Enterprise Library is a collection of reusable software components (application blocks) designed to assist software developers with common enterprise development cross-cutting concerns (such as logging, validation, data access, exception handling, and many others). Application blocks are a type of guidance; they are provided as source code, test cases, and documentation that can be used "as is," extended, or modified by developers to use on complex, enterprise-level line-of-business development projects.
Some Features
While using enterprise library you have to concern about opening and closing connections.
This will automatically handle connection pooling and other important errors of connection and database.
I had used Enterprise Library 2.0 - January 2006.
To use Enterprise Library you required to add reference of following files:-
- Microsoft.Practices.EnterpriseLibrary.Common.dll
- Microsoft.Practices.EnterpriseLibrary.Configuration.Design.dll
- Microsoft.Practices.EnterpriseLibrary.Data.dll
- Microsoft.Practices.ObjectBuilder.dll
#region Using
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
#endregion
public class spt_monitor
{
public DataTable Read()
{
try
{
Database db = DatabaseFactory.CreateDatabase("masterConnection");
DbCommand dbCommand = db.GetSqlStringCommand("Select * from spt_monitor");
DataSet dataSet = db.ExecuteDataSet(dbCommand);
return dataSet.Tables[0];
}
catch
{
return null;
}
}
}
This code is simply loading a dataset without much code.Download Enterprise Library from following links:-
- Enterprise Library 4.1 - October 2008
- Enterprise Library 4.0 - May 2008
- Enterprise Library 3.1 - May 2007
- Enterprise Library 2.0 - January 2006
http://crococode.com/user/Download.aspx
You can also download code running code which is using master database as example.
http://www.4shared.com/file/110209896/9461588/EnterpriseLibraryDemo.html
Goals for Enterprise Library
Enterprise Library is a collection of application blocks intended for use by developers who build complex, enterprise-level applications.
Enterprise Library is used when building applications that are typically to be deployed widely and to interoperate with other applications and systems. In addition, they generally have strict security, reliability, and performance requirements.
The goals of Enterprise Library are the following:
- Consistency. All Enterprise Library application blocks feature consistent design patterns and implementation approaches.
- Extensibility. All application blocks include defined extensibility points that allow developers to customize the behavior of the application blocks by adding their own code.
- Ease of use. Enterprise Library offers numerous usability improvements, including a graphical configuration tool, a simpler installation procedure, and clearer and more complete documentation and samples.
- Integration. Enterprise Library application blocks are designed to work well together or individually.
Comments
Reference: V8Web-Faribault Web Design