1 / 26

Visual Studio.NET 2005 Using RAD Tools for N-Tier Development

Visual Studio.NET 2005 Using RAD Tools for N-Tier Development. Andy Beaulieu MCT, MCSD.NET. Drag/Drop Apps?. Demo Using Server Explorer Drag/Drop Table onto Page Use Smart Tag for Formatting No code is generated; instead, everything is “declarative”. Drag/Drop Apps?.

allegra
Download Presentation

Visual Studio.NET 2005 Using RAD Tools for N-Tier Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Visual Studio.NET 2005Using RAD Tools for N-Tier Development Andy Beaulieu MCT, MCSD.NET

  2. Drag/Drop Apps? • Demo • Using Server Explorer • Drag/Drop Table onto Page • Use Smart Tag for Formatting • No code is generated; instead, everything is “declarative”

  3. Drag/Drop Apps? Looking at the source view…

  4. Pros and Cons • Pros • Very fast • Little coding knowledge required • Cons • Easy to break (no validation) • 2Tier Architecture • No reusability • Limited functionality (at some point, you have to code).

  5. N-Tier Architecture • With a bit more work, we can still use RAD tools but get an N-Tier Architecture. • N-Tier provides reusability, scalability, maintainability.

  6. N-Tier Architecture

  7. Data Access Layer • Provides “Programmer Friendly” components for retrieving and updating data • Developer is freed from writing mundane and error-prone ADO.NET code • Instead can concentrate on Business Logic

  8. Data Access Layer • TableAdapter is a new class ideal for creating DAL components • Exists within context of a Typed DataSet • Contains DB Connection logic, Select, Insert, Update, Delete commands.

  9. Data Access Layer DEMO: Using VS.NET 2005 Designers to create a DAL component (Typed DataSet + TableAdapter)

  10. Data Access Layer Note on WindowsForms Clients: • WindowsForms clients can take advantage of DataSet events for validation! • Provides strongly typed row argument • Not usable from ASP.NET client using ObjectDataSource

  11. Business Logic Layer • provides validation and workflow • We will extend the Data Access Layer to provide BLL layer • New ObjectDataSource component allows data binding between UI and BLL components

  12. Business Logic Layer • If we want to use ObjectDataSource component for data binding, we must follow some rules…

  13. Business Logic LayerRules for ObjectDataSource • “select” methods must return a DataSet, Typed DataSet, IEnumerable implementation, Collection, or Array. Public Function GetCustomers() As DataSet Public Function GetCustomers() As CustomerDataSet Public Function GetCustomers() As CustomerCollection

  14. Business Logic LayerRules for ObjectDataSource • Insert, update, delete methods must take each field as individual parameters, or a single object containing fields as properties Public Sub Update(ByVal CustomerId As String, _ ByVal CompanyName As String, _ByVal Address As String, ByVal City As String) Public Sub Update(ByVal oCustomersBLL As CustomersBLL)

  15. Business Logic Layer • Good News:The TableAdapter conforms to the requirements of the ObjectDataSource control! • This means we can extend the TableAdapter control to add our own customizations such as validation

  16. Business Logic Layer DEMO: Creating the Business Logic Layer Component

  17. Presentation LayerWeb UI • User interface • Input and validation • ObjectDataSource can be used to bind UI Elements to Business Logic Layer components

  18. Presentation LayerWeb UI DEMO: Creating an input page using the GridView, ObjectDataSource, and BLL Component

  19. Adding ValidationWeb UI • GridView class exposes a RowUpdated event which is fired whenever a row is updated Protected Sub GridView1_RowUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdatedEventArgs) Handles GridView1.RowUpdated

  20. Adding ValidationWeb UI • RowUpdated Event e.Exception argument will contain any errors raised from the update Protected Sub GridView1_RowUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdatedEventArgs) Handles GridView1.RowUpdated If Not e.Exception Is Nothing Then

  21. Adding ValidationWeb UI • We can create a Custom Exception Class to raise Validation errors through the ObjectDataSource component’s Update Event. • CExceptionDetail will hold single error • CValidationException inherits from ApplicationException and holds List of CExceptionDetail.

  22. Adding ValidationWeb UI DEMO: Adding Validation to the Web UI

  23. Presentation LayerWinForms UI • We can reuse Business Logic Layer in WinForms Client • Why WinForms? • “Smart Client” • WinForms are “statefull” • Better DataBinding support • Easy Distribution • Web Browsers Suck!!!

  24. Presentation LayerWinForms UI DEMO: Creating the Windows UI

  25. Adding ValidationWinForms UI DEMO: Adding Validation to WinForms

  26. A Quick word about Transactions For Web UI’s, look at Transaction Attribute on Page For WinForms UI’s, look at new System.Transactions.TransactionScope Ideally, should Introduce Business Façade Layer for Winforms

More Related