three tier architecture of asp_net

23
Three Tier Architecture in ASP.NET [email protected]

Upload: biswadip-goswami

Post on 17-Jan-2015

5.127 views

Category:

Education


2 download

DESCRIPTION

This slide show would talk about the 3-tier architecture and how is it helpful and about .NET Platform. I came up with some Networking Stuffs at http://www.youtube.com/bgccnadom. Try them if you like... THANK YOU FOR YOUR SUPPORT AND LIKES.

TRANSCRIPT

Page 1: Three tier Architecture of ASP_Net

Three Tier Architecture in ASP.NET

[email protected]

Page 2: Three tier Architecture of ASP_Net

Our Discussion

• What is a 3-Tier concept.• What are the various layers.• Application layer.• Business Logic Layer• Data Layer

[email protected]

Page 3: Three tier Architecture of ASP_Net

Know How of Tools

• Tools used:– Visual Web Developer 2005 (Free)– Visual Studio 2005 (Paid)

• Databases used:– MS SQL Server 2005– MS ACCESS 2003/2007 (with MS-Office package)

[email protected]

Page 4: Three tier Architecture of ASP_Net

General 3-Tier Structure

[email protected]

Page 5: Three tier Architecture of ASP_Net

.NET 3-TIER Structure

[email protected]

Page 6: Three tier Architecture of ASP_Net

Three layers• Presentation tier: The top most level of the application is

the user interface(Web Browser). The main function of the interface is to translate tasks and results to something the user understands. This is also called the Application layer.

• Logic Tier: This layer coordinates the application, processes commands, makes logical decisions and evaluations, and performs calculations, It also moves and processes data between the two surrounding layers.

• Data tier: Here information is stored and retrieved from a database management system. The information is then passed back to the logic tier for processing and then eventually back to the user.

[email protected]

Page 7: Three tier Architecture of ASP_Net

Creating ASP. Net project

[email protected]

Page 8: Three tier Architecture of ASP_Net

Source of DB

• DB used with this is the Default NorthWind Database which can be downloaded from here

• http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46a0-8da2-eebc53a68034&DisplayLang=en

[email protected]

Page 9: Three tier Architecture of ASP_Net

Connecting to DB

[email protected]

Page 10: Three tier Architecture of ASP_Net

• The data access layer has four Methods:• GetCategories()• GetProducts()• GetProductsByCategoryID(categoryID)• GetProductByProductID(productID)

[email protected]

Page 11: Three tier Architecture of ASP_Net

Typed Dataset and Table Adapter

[email protected]

Page 12: Three tier Architecture of ASP_Net

Table Adapters• TableAdapters provide communication between your

application and a database. More specifically, a TableAdapter connects to a database, executes queries or stored procedures, and either returns a new data table populated with the returned data or fills an existing DataTable with the returned data. TableAdapters are also used to send updated data from your application back to the database.

Generic Structure :• TableAdapter.Fill • TableAdapter.Update • TableAdapter.GetData • TableAdapter.Insert • TableAdapter.ClearBeforeFill

[email protected]

Page 13: Three tier Architecture of ASP_Net

Database Name

[email protected]

Page 14: Three tier Architecture of ASP_Net

Connection string

[email protected]

Page 15: Three tier Architecture of ASP_Net

Query

[email protected]

Page 18: Three tier Architecture of ASP_Net

User defined queries

[email protected]

Page 20: Three tier Architecture of ASP_Net

Samples• The DataTables returned by the TableAdapter can be bound to

ASP.NET data Web controls, such as the – GridView, – DetailsView, – DropDownList,– CheckBoxList, and several others.

Sample Code:>> AllProducts.aspx.csusing NorthwindTableAdapters; public partial class AllProducts : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e) { ProductsTableAdapter productsAdapter = new ProductsTableAdapter();

GridView1.DataSource = productsAdapter.GetProducts(); GridView1.DataBind();

} }

[email protected]

Page 21: Three tier Architecture of ASP_Net

Adding parameterized methods

[email protected]

Page 22: Three tier Architecture of ASP_Net

Insert,Update and Delete

[email protected]

SAMPLE CODE:>>

ProductsTableAdapter productsAdapter = new ProductsTableAdapter(); // Delete the product with condition productsAdapter.Delete(…); // Update a record with conditionproductsAdapter.Update(…); // Add a new product productsAdapter.Insert(…);

Page 23: Three tier Architecture of ASP_Net

References

• http://msdn.microsoft.com/• http://aspnet.4guysfromrolla.com• http://www.asp.net

For my latest updates:• http://www.cognobytes.com/biswadipgoswami/Default.

aspx

[email protected]