370 likes | 385 Views
A framework that simplifies and accelerates the development of Web and WinForms applications with database access and business process integration.
E N D
A Framework for Web and WinForms (Client-Server) Applications • “Enterprise Software Architecture”
Outline • Short introductions • Start with a demo (Web and WinForms) • Background and technical details • Code walkthrough • Building an application • Topics in depth
Demo 1 Sample Application
The goal is • Provide a framework of reusable software components to simplify, speedup, reduce the cost, and assist in the creation of Web and WinForms applications which access databases and follow a business process
Technical Summary • Framework processes client requests (Web or Windows GUI), handles business logic, accesses database, and generates output (GUI, XML or XHTML) – full cycle • Encapsulates all database access as well as display and form handling • A generic solution for writing applications, but with a powerful extensibility model!
Technical Details • Reusable layered .NET objects • Our own design and architecture for a Web and WinForms business applications. • Not using bound controls or web form controls • Object oriented • Data access encapsulation • Back-end independent approach for common database providers • Automatic SQL generation for searches and CRUD (all form handling) • Abstracted, key-based, optimistic-locking.
Technical Details • Metadata driven definition of forms, searches and security • Reusability • Flexible solutions • XML Based • Code generation vs. Runtime driven • One body of code • No orphan code • No regens
Technical Details • Stateless approach for both vertical and horizontal scalability of Web Apps • No object or object state maintained in memory between requests – all gets persisted • Objects created when needed • Generic objects restore state quickly from metadata, http request, and database • Objects can reside in “MTS” i.e. “Serviced Component” in .NET (“application server”)
Technical Details • Multi-layer security and role-based logic • Application logic security is used to authenticate and authorize user access to application and data • login via Oracle, SqlServer, CustomDB, LDAP, Windows, Passport, Certificate, etc. • Framework metadata-driven role-based security • Native support for SSL
Technical Details • Layered Application Architecture • Core framework data components • Core framework utility components • Application extensibility components • Platform or presentation specific layer (Web, WinForms, Web Service, etc.) • Each encapsulate core framework
Web/client to Server WinForms Browser WAF Object WAF Object Client IIS .NET ASPX pages WAF Object Server WAF Object WAF Object WAF Object Database Database
Demo 2 Behind the sample application.. (Database, metadata, security..)
Framework Objects • Two general business application activities: • Searching for and listing record sets as well as selecting records to navigate or ‘open’ them (DBFind) • Opening a single record, showing a form, to create new, update, or delete (DBRecord).
Framework Objects • DBFind • Searching for data to: • View (decision support) • Select as option (work flow, navigation) • Select to modify (transactions) • Invoking actions on found records
Framework Objects • DBRecord • CRUD (Create, Read, Update, and Delete) • Validation of data entry • Applying business rules • Transactions • Single record or set handling • Linked records and foreign keys • Edit Form • Result Set Table display
Framework Objects • Metastore • Holds Metadata for runtime data driven approach • XML DOM as a global singleton object • Holds all table definitions • Fields for each table • Search definitions for each table • Edit form definitions for each table • Security on most items • System and Application Strings • Multi language support on all items
Framework Objects • Additional activities for most business applications • User Profile • Session Control • String dictionary • Request Object • URL builder • Instrumentation (trace, audit, profile, etc.)
Demo 3 Framework project walkthrough
Runtime Browser Client IIS .NET Metastore ASPX pages Server DBFind DBRecord Database Database
Metastore XML DOM XML XML Metadata User interface and navigation XPATH, DOM API Tables DBFind or DBRecord HTML Fields Forms Basic HTML Searches Java Script Searches SQL Forms Database XML to HTML
Framework Object Life Cycle Create The object XML Restore all needed state SQL HTML Process Input Perform the work Compose output HTML Persist state SQL Destroy Object
Code Example DimRecordAsWAFdbComponents.DBRecord 'Create a DBRecord object Record = New WAFdbComponents.DBRecord() 'Build the object from metadata IfRecord.Build("Company", "EditForm", MainMetaStore, Profile)Then 'Identify and read the record from the database Record.PrimaryKeyValue = sPKey If Record.ReadRecordThen 'Output HTML-form populated with the fetched data Response.Write Record.EditFormHTML End If End If
Demo 4 Code walkthrough (DBFind, DBRecord)
Framework Extensions • Business Rules objects • Search Rules objects • Field validation objects • Authentication object • Property retriever • Function overrides
Runtime Browser Client IIS Metastore DBRecord ASPX pages Server IBusinessRules Database Database
Framework Object Life Cycle Create The object XML Restore all needed state SQL HTML Process Input Delegate toBusiness Rules Perform the work Delegate toBusiness Rules Compose output HTML Persist state SQL Destroy Object
Business Rules objects • Objects implementing the IBusinessRules interface • Assigned to a DBRecord object (in metadata) • Runtime framework delegation CanRead(..) IsValid(..) CanCreate(..) ReadComplete(..) CanEdit(..) WriteComplete(..) CanWrite(..) DeleteComplete(..) CanDelete(..) CanDisplay(..) WriteAllComplete(..)
Search Rules objects • Objects implementing the ISearchRules interface • Assigned to a DBFind object (in metadata) • Runtime framework delegation CanDisplaySearch(..) CanExecute (..)
Field validation objects • Objects implementing the IFieldValidation interface • Assigned to a Field object • Runtime framework delegation IsValid(..)
Demo 5 Business rule code walkthrough
Web Framework • ASP.NET layer • Pages derived from - System.Web.UI.Page • Encapsulates dbComponents work • Handles HTTP requests • Orchestrates HTML response
html Browser http request (state, action-verb) webComponents ASP.NET dbComponents System.Web.UI.Page DBFind WafControllerPage DBRecord WafFormPage WafForm (Application derived form) Profile Session Metastore Database
Demo 6 Web framework walkthrough Building an Application!
WinForms (Client/Server) • WinForms.NET layer • MDI Application Class • Forms derived from – System.Windows.Forms.Form • Encapsulation of dbComponents • UI driven (no UI generation)
Main Application window File Edit Tools User guiComponents dbComponents WinForms.NET DBFind Metastore FormDbFind Inherits System.Windows.Forms.Form DBRecord MyForm Inherits FormDbRecord Inherits System.Windows.Forms.Form Profile Database
Demo 7 WinForms framework walkthrough
Topics in depth • UI generation - XML and HTML pages (using customizable XSLTs if desired), • SQL generation • Back-end independent • Generic exception handling • Business rule extensibility • Profile • Session • ...