[PDF] [PDF] Creating 3-tier Architecture in Visual Studio

3-tier/layer Architecture 4 Presentation Why 3-Tier (N-Tier Architecture?) • Flexible Application tier (business logic, logic tier, data access tier, or middle tier)



Previous PDF Next PDF





[PDF] N-tier Architecture Improves Scalability - cadeirasisctept

This additional layer has the effect of decoupling business logic from presentation and database functions, both physically and in the software architecture The 



[PDF] Creating 3-tier Architecture in Visual Studio

3-tier/layer Architecture 4 Presentation Why 3-Tier (N-Tier Architecture?) • Flexible Application tier (business logic, logic tier, data access tier, or middle tier)



[PDF] Implementing N-Tier Architecture for Improvement in - IJERT

The simplest of n tier architecture is 3-Tier which typically contains following software component layers listed from top level to low level: presentation layer, 



[PDF] What is N-Tier? - Magadh University

A diagrammatic representation of an n-tier system depicts here – presentation, application, and database layers N Tier Architecture Diagram These three layers 



[PDF] WEB APP ARCHITECTURES:

Business/Logic □ Data □ N-tier architectures try to separate the components into different tiers/layers □ Tier: physical separation □ Layer: logical separation  



Cloud Deployments: Is this the End of N-Tier Architectures?

Via this model the presentation, the application processing (business logic) and end layers, N-tier architecture supports a more standardized, building block 



Understanding Application Architecture: An Overview

Not all applications need to use an n-tier architecture just because it is the will see that the business logic is the most important component of any application



[PDF] N-tier Architectures

N-tier Architectures DB3 - 2005 2 business logic ○ interfaces Logic Business Logic Monoliths Client Server Period 3 tier Period N-tier Period DB3 - 



A Web-Based Chinese Chess Xiang Qi using n-tier Architecture Model

The system applies the MVC (Model View Controller) concept and created four layers in the architecture which are presentation layer, business layer, data layer  



[PDF] Research and Application of the Four-tier Architecture Jiexian Cao

may have to increase the corresponding code in the business logic layer and data The four layers of four-tier architecture are presentation layer (PL), data 3) Using the four-tier architecture design patterns can guarantee the multi-team 

[PDF] n tier architecture data layer

[PDF] n tier architecture presentation layer

[PDF] n tier web application architecture aws

[PDF] n vertex connected graph

[PDF] n acetylation of amines

[PDF] n tier architecture diagram in java

[PDF] n tier architecture example

[PDF] n tier architecture service layer

[PDF] n tier client server architecture diagram

[PDF] n tier layer architecture

[PDF] n.c. court of appeals rules

[PDF] n100 mask

[PDF] n150822

[PDF] n154 france

[PDF] n192261050

3-tier ArchitectureStep by step Exerciseshttps://www.halvorsen.blogHans-Petter Halvorsen

Client-ServerSoftware ArchitectureWeb ServicesAPIs3-Tier ArchitectureAPI: Application Programming Interface. Different devices or software modules can share the same code. Code once, use it many timesWeb Services: A standard way to get data over a network/Internet using standard Web protocols (HTTP, etc.)3-Tier: A way to structure your code into logical parts. Different devices or software modules can share the same code. Good Software!2-Tiern-TierWeb API

3The database-centric style. Typically, the clients communicate directly with the database.A three-tier style, in which clients do not connect directly to the database.Web Services, etc.

3-tier/layer Architecture4Presentation TierBusiness Logic TierData Access TierData SourcePLBLDALNote! The different layers can be on the same computer (Logic Layers) or on different Computers in a network (Physical Layers)Data Tier -DLLogic Tier

Why 3-Tier (N-Tier Architecture?)•Flexible applications•Reusable code-Code once, use many times•Modularized-You need only to change part of the code-You can deploy only one part-You can Test only one part-Multiple Developers•Different parts (Tiers) can be stored on different computers•Different Platforms and Languages can be used•etc. 5

3-tier/layer ArchitecturePresentation Tier•This is the topmost level of the application. •The presentation tier displays information related to such services as browsing merchandise, purchasing and shopping cart contents. •It communicates with other tiers by which it puts out the results to the browser/client tier and all other tiers in the network. •In simple terms it is a layer which users can access directly such as a web page, or an operating systems GUIApplication tier (business logic, logic tier, data access tier, or middle tier)•The logical tier is pulled out from the presentation tier and, as its own layer. •It controls an application's functionality by performing detailed processing.Data tier•This tier consists of database servers. Here information is stored and retrieved. •This tier keeps data neutral and independent from application servers or business logic. •Giving data its own tier also improves scalability and performance.7http://en.wikipedia.org/wiki/Multitier_architecture

3-tier ArchitecturePresentation TierBusiness Logic TierData Access TierDatabasePresentation TierPresentation TierStored ProceduresData TierLogic Tier

3-tier ArchitecturePresentation TierBusiness Logic TierData Access TierDatabasePresentation TierPresentation TierStored ProceduresDifferent Devices can share the same Business and Data Access CodeThe different Tiers can be physical or logicalData TierLogic Tier

Web Server3-tier + WebServiceArchitecture -ExamplePresentation TierBusiness/Data Logic TierData SourceWeb ServicesServer(s)Data TierStored ProceduresServer-sideClient-side

Web Server3-tier + WebService Architecture -ExamplePresentation TierBusiness/Data Logic TierData SourceWeb ServicesTeam Foundation ServerTFS CientInstalled on one or more Windows Servers in your LAN or in the CloudData TierStored ProceduresTeam Foundation Server

3-tier Architecture ScenariosPresentation LayerBusiness LogicData Access LogicDatabasePresentation LayerPresentation LayerStored ProceduresClientClientClientWeb ServerWeb ServicePresentation LayerClientPresentation LayerInternetLocal Network (LAN)ClientFirewallPresentation LayerServerServer

Exercises1.Create Data Tier(Database)2.Create Logic Tier (Database Communication Logic)Create Presentation Tier (User Interface Logic):3.WebApp: Using ASP.NET Web Forms (WS normally not needed)4.Desktop App: Using WinFormsA.Without Web Services (We assume the App will be used only in the LAN and that we have direct access to the Database)B.With Web Services (We assume the App should be used on Internet outside the Firewall without direct DB access)

DatabasePresentation Tiere.g., ADO, ADO.NETLogic TierWeb ServiceBusiness TierData Access TierData TierStored ProceduresViewsTablesWeb ServerDatabaseServerPresentation TierClientASP.NET Web FormsWeb AppPresentation TierClientClientClientWinForms3-tier Architecture ScenariosFirewallClientsDesktop AppMobile AppInternetLocal NetworkNote! The different Tiers can be on the same Computer (Logic Layers) or on different Computers in a network (Physical Layers)Android, iOS, Windows 8/Windows Phone, etc.Presentation TiersDevices can share the same Business/Logic Tier and APIsSeperate Presentation Tier for each Device AppAPIAPIAPIAPI

15Visual Studio ProjectsSolution with all Projects (Logic Tier, Web Service, Desktop App, Web App, Mobile App)Solution with Projects used by Web App (Logic Tier, Web App)

Data TierWe are going to create the Database / Data Layer/Tier, including:1.Tables2.Views3.Stored Procedures4.Triggers5.Script for some "Dummy" DataDownload Zip Files with Tables, Views, Stored Procedures and Triggerse in order to create the Data Tier in SQL Server (The ZIP File is located on the same place as this File)16Note! Install them in this order

Data Tier17TablesViewsStored ProceduresSQL ServerTriggersData Tier

18Database Tables

19Execute the different Scripts inside SQL Server Management Studio

20You are finished with the Exercise

Create Logic Tier21DatabasePresentation TierLogic TierASP.NET Web FormsData TierPresentation TierPresentation TierWinFormsWindows Store AppPurpose: •All the Apps should/could share the same Logic Tier•To make your Apps easier to maintain and extend•etc.

22Create an Empty (Blank) Solutionin Visual Studio

23Add Projectfor Logic Tier (Data Access)Select a "Class Library" Project"LogicTier"

24Add a New Classto the Project ("StudentData.cs")"StudentData.cs"

25Create the Code, e.g., like this ("StudentData.cs"):Create your own NamespaceImprovements: Use Try... Catch ...A View that collects data from several tables

26You should test the SQL Query in the SQL Server Management Studio first

27Code ("StudentData.cs"):usingSystem.Data.SqlClient;usingSystem.Data.SqlTypes;usingSystem.Data;namespaceTuc.School.LogicTier{publicclassStudentData{publicDataSetGetStudentDB(stringconnectionString){stringselectSQL= "select StudentName, StudentNumber, SchoolName, ClassName, Grade from StudentDataorder by StudentName";// Define the ADO.NET objects.SqlConnectioncon = newSqlConnection(connectionString);SqlDataAdapterda = newSqlDataAdapter(selectSQL, con);DataSetds = newDataSet();da.Fill(ds);returnds;}}}

28Create a proper name for the Assembly(.dll File)This will be the Assembly for your Logic Tier, that can be imported and used in other projects.Create once -use it many times!! Then Build your Project (hopefully with no errors)Right-click on the Project in the Solution Explorer and select Properties

29You are finished with the Exercise

30Presentation LayerWeb App: ASP.NET WebFormsWe will create a WebForm like this where the data comes from our Logic Tier

31Add Project for Presentation Tier (ASP.NET WebForm)

32Add a New Class ("Student.cs")

33Add Code ("Student.cs")Add a Reference to the Assembly in the Logic TierNote! This is our Logic Tier

34Code for "Student.cs"usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Data;usingTuc.School.LogicTier;namespaceTuc.School.WebApp{publicclassStudent{publicDataSetGetStudent(stringconnectionString){StudentDatastudentData = newStudentData();returnstudentData.GetStudentDB(connectionString);}}}Get Dat from our Logic TierSince we are using the DataSet ClassOur Logic Tier

35Add a New WebForm(StudentInformation.aspx)

36Create WebForm Page ("StudentInformation.aspx")GridView (Drag & Drop from Toolbox or create code in .aspx file)

37<%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="StudentInformation.aspx.cs"Inherits="WebApp.StudentInformation"%>Student Information

Student Information

HTML /ASPX Code ("StudentInformation.aspx")

38Code behind for the Web Form ("StudentInformation.aspx.cs")usingSystem.Web.Configuration;usingTuc.School.WebApp;namespaceWebApp{publicpartialclassStudentInformation: System.Web.UI.Page{privatestringconnectionString = WebConfigurationManager.ConnectionStrings["SCHOOLConnectionString"].ConnectionString;protectedvoidPage_Load(objectsender, EventArgse){if(!IsPostBack){FillStudentGrid();}}privatevoidFillStudentGrid(){DataSetds = newDataSet();StudentstudentList = newStudent();ds = studentList.GetStudent(connectionString);gridStudentData.DataSource = ds;gridStudentData.DataBind();}}}Note!Web.Config

39Store the "ConnectionString" for your Database in "Web.Config"Then you can easly switch Databsse without changing the Code!!

40Test your Web AppNote! We have used a "View" in order to get data from several tables

41Additional Exercise:Update GridView with New Data from DatabaseGoto New WebFormin order to Add another Student

42You are finished with the Exercise

43Presentation LayerDesktop App: WinFormsPart A: Without Web Services (we assume the App will be used only in the local LAN (or local on the same computer where the database is located) and that we have direct access to the Database)LabelDataGridView

44Add a WinForm Project

45Add a New Class("StudentWinForm.cs")

46Add Codein ClassAdd a Reference to the Assembly in the Logic Tier

47Code for Class "StudentWinForm.cs"usingSystem.Data;usingTuc.School.LogicTier;namespaceTuc.School.WinFormApp{classStudentWinForm{publicDataSetGetStudent(stringconnectionString){StudentDatastudentData = newStudentData();returnstudentData.GetStudentDB(connectionString);}}}Reference to our Logic TierSince we are using the DataSet ClassOur Database Method in our Logic Tier

48Create FormLabelDataGridView

49Create Form Code

50usingSystem.Configuration;usingTuc.School.WinFormApp;namespaceWinFormApp{publicpartialclassForm1: Form{privatestringconnectionString = ConfigurationManager.ConnectionStrings["SCHOOLConnectionString"].ConnectionString;publicForm1(){ InitializeComponent();}privatevoidForm1_Load(objectsender, EventArgse){FillStudentGrid();}privatevoidFillStudentGrid(){DataSetds = newDataSet();StudentWinFormstudentList = newStudentWinForm();ds = studentList.GetStudent(connectionString);dataGridViewStudentInformation.DataSource = ds.Tables[0];}}}WinForm CodeNote!ConnectionString is stored in App.config

51Note! Add System.Configuration Reference

52Create DB ConnectionString in App.config

53Test itIt works!!!

54You are finished with the Exercise

55Presentation LayerDesktop App: WinFormsPart B: Using Web Services (we assume the The App should be used on Internet outside the Firewall)LabelDataGridView

56Step 1: Create Web ServiceAdd Web Service:Create an ASP.NET Project:"SchoolWS""SchoolWS.asmx"

57Web Service CodeDatabase ConnectionStringis located in Web.configWeb Service Method

58Database ConnectionString is located in Web.config

59Test Web ServiceIt Works!!Click to Test the Web Service Method we created

60Deploy/Publish Web Service to IISCopy Web Service Files (Project) to default IIS Directory: C:\inetpub\wwwroot

61

62Test if WS working:http://localhost/SchoolWS

63Step 2: Use Web Service in WinFormCreate New WinForm Project:"WinFormAppWSClient"

64Add Web Service ReferenceOur Web Service Methods

Create GUILabelDataGridView

66Create Code

67usingSystem.Windows.Forms;namespaceWinFormAppWSClient{publicpartialclassFormWSClient: Form{publicFormWSClient(){InitializeComponent();}privatevoidFormWSClient_Load(objectsender, EventArgse){FillStudentGrid();}privatevoidFillStudentGrid(){DataSetds = newDataSet();SchoolWSReference.SchoolWSSoapClientschoolWs = newSchoolWSReference.SchoolWSSoapClient();ds = schoolWs.GetStudent();dataGridViewStudentInformation.DataSource = ds.Tables[0];}}WinForm CodeCall the Web Service methodFill GridView

68Test it:It works!!!

69You are finished with the Exercise

Hans-Petter HalvorsenUniversity of South-Eastern Norwaywww.usn.noE-mail: hans.p.halvorsen@usn.noWeb: https://www.halvorsen.blog

quotesdbs_dbs20.pdfusesText_26