Firstly, I will talk about Enterprise Library
What is Enterprise Library and how it work
Enterprise Library is a framework and it is an integration pack for all Microsoft products (C#, Azure, Sharepoint and more).
It provides all application recommended operations like Validations, Exception Handling, Logging, Data Transfer objects, etc.
I recommend it, If your application deals with any bulk data Insert, Select and Update. Good at performance wise also.
The following computer screens will guide you.
Step 1: Create empty website
Step 2: Add SQL Server database template to your application.
Step 3: Add one Web Form or any sample page to your website.
Here I recommended you, a class that use expose DTO.
Step 4: Add one class to your website to develop Enterprise DAL and DTO (Data Transfer Objects).
Next find connection string to your Database.mdf with help of the following screen,
The above screenshot sqlDataSource will help you to get connection string to your project database.mdf and later you can remove from your page.
Find connection string and add it to your web.config file.
Next add DB stuff to your Testconnection Database Table and Procedures.
Table Design has been completed and next step is for Stored Procs.
All necessary stuff has been made and now lets come into application and add packages.
// Required : Install-Package EnterpriseLibrary.Data
Required namespaces
- using Microsoft.Practices.EnterpriseLibrary.Data;
- using Microsoft.Practices.EnterpriseLibrary.Common;
- using Microsoft.Practices.EnterpriseLibrary;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Data.Sql;
- using System.Data.SqlClient;
- using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
- using System.Threading.Tasks;
Above screenshot about Constructor logic, namespaces and below one is Insert operations using Enterprise Library.
Update Operations
Select Operations and Data Transfer objects to CollectData class
Your Home work :
Call your functions with help of EnterpriseDAL.cs Object.