ODOT Default Web Application Architecture
Total Page:16
File Type:pdf, Size:1020Kb
The Ohio Department of Transportation (ODOT) Division of Information Technology ODOT Default Web Application Architecture Filename:ODOT Web Application Architecture.doc Version: 8.0 Author: Michael Jordan Last Modified: 11/16/2017 Project Site: Document Summary: Prepared by the ODOT Division of Information Technology (DoIT) [Document Header] Contents 1 Introduction ......................................................................................................................... 3 1.1 About This Document ..................................................................................................... 3 1.2 Document Location ......................................................................................................... 3 2 Architecture ......................................................................................................................... 4 2.1 A Layered Approach ....................................................................................................... 4 2.1.1 User Interface Layer ............................................................................................... 4 2.1.2 Domain Layer ......................................................................................................... 4 2.1.3 Service Layer .......................................................................................................... 5 3 Technologies ....................................................................................................................... 6 3.1 Microsoft .NET Platform.................................................................................................. 6 3.1.1 C# ........................................................................................................................... 6 3.1.2 ASP.NET ................................................................................................................ 6 3.2 AJAX ............................................................................................................................... 6 3.3 Third Party Libraries ....................................................................................................... 7 3.3.1 Bing Maps API ........................................................................................................ 7 3.3.2 Spring.NET – Lightweight Dependency Injection API ............................................ 7 3.3.3 ExtJs ....................................................................................................................... 7 3.3.4 log4net .................................................................................................................... 8 4 Visual Studio Projects ........................................................................................................ 8 5 How To ................................................................................................................................. 9 5.1 How to use the AdoTemplate in Spring.Net to perform database queries and transactions .............................................................................................................................. 9 5.2 How to create a Visual Studio Project template automatically using the batch program9 [Version], [Date] 1 [Document Header] Document History Version Date Author Description 1.0 12/28/2007 Michael Jordan Initial Version 2.0 7/17/2008 Michael Jordan Removed references to the NHibernate OR mapping framework. 3.0 6/17/2010 Michael Jordan Updated the version references of the ExtJS and Spring libraries to current 4.0 11/4/2011 Michael Jordan Removed some additional NHibernate references. Added additional text related to rich JavaScript business objects. Corrected some spelling issues. 5.0 10/18/2013 Michael Jordan Updated to reflect use of .Net 4.0 Updated to reflect use of ExtJs 4.X Updated to reflect use of Html5 Update Virtual Earth to Bing Maps 6 07/01/2013 Michael Jordan Updated to include both ExtJs 4.x and 5.x 7 004/27/2017 Michael Jordan Updated ExtJs 5.x and referencing SQL Server as preferred backend database 8 11/16/2017 Michael Jordan Updated document location section Added Technology Constraints and Appendix sections Added Architecture Justifications section Updated Ajax and ASP.Net verbiage in the Technologies section Added support for stored procedures Added Security Authentication and Authorization section [Version], [Date] 2 [Document Header] 1 Introduction 1.1 About This Document The purpose of this document is to describe the default architecture used in development web applications at the Ohio Department of Transportation. Many of these same concepts apply to client/server based application development as well. 1.2 Document Location The latest version of this document is available from the following site. The following table provides the website and folder location of the document. Application Site http://portal.dot.state.oh.us/Divisions/DoIT/SoftProd/client/Software%20 Development%20Practices Document Folder http://portal.dot.state.oh.us/Divisions/DoIT/SoftProd/client/Software%20 Development%20Practices/Forms/AllItems.aspx Filename ODOT Web Application Architecture.doc [Version], [Date] 3 [Document Header] 2 Architecture 2.1 A Layered Approach The default architectural approach used at ODOT for web applications involves a standard 3-tiered model for partitioning application logic. The three primary layers are User Interface Layer, Domain Layer, and Service Layer. The implementation of these various layers uses the C# programming language from the Microsoft .NET platform. The use of well-defined application layers allows applications to be modified and extended without necessarily requiring significant code re-rewrites. For example by having the data access logic located in the Service layers it makes it possible to replace the implementation without necessarily requiring any changes to the user interface. The following sections provide a brief description of these application layers and an indication of the type of application logic that should be implemented within each. 2.1.1 User Interface Layer This layer contains code that is specific to the user interface interactions (i.e. responding to user event, button clicks, click on links, form submission, etc). For web application this logic will be implemented in C# as ASP.Net MVC Controllers returning Json data in response to AJAX calls from the client. When server side view logic is necessary then the system can leverage either the ASPX or (preferably) the Razor view engines. For the most part though, all view logic will be implemented using the ExtJs JavaScript framework and the server side controllers would be APIs returning Json/XML data in response to AJAX calls. Use of the ExtJs (5.x) JavaScript user interface library is required for consistency in user interface development as well as for the rich set of user interface components offer by this library. The structure of the ExtJs JavaScript files should follow the Application Architecture recommended by the ExtJs vendor: http://docs.sencha.com/extjs/5.1/application_architecture/application_architecture.html Use of Web 2.0 style development techniques (i.e. AJAX based requests) to provide dynamic client side functionality is encouraged where appropriate. This is accomplished by using the AJAX libraries built into the ExtJs JavaScript framework. Note: One caveat to this is when building a feature rich JavaScript application it may be necessary for performance reasons to build a rich client side domain model in JavaScript. In this case these JavaScript classes would be considered an extension of the Domain layer as indicated below and could contain business logic that runs client side in the browser. 2.1.2 Domain Layer This is a Visual Studio class library project that compiles to a DLL called ODOT.<app name>.Domain.dll. The core of the application requirements will be modeled as Domain objects. Domain objects are C# classes that represent the key business concepts within the application (i.e. Users, Projects, Purchase Orders, Coordinates, etc.). This layer contains the primary business logic of the application (calculations, relationships among domain [Version], [Date] 4 [Document Header] entities, etc). The exception to this would be business logic that spans multiple objects within a given database transaction in which case that logic would be located in a Service Layer method that would coordinate the logic required among the various domain entities. The Domain Layer is generated in its own .NET Assembly/dll which will contain all the domain entities for the application as well as interface definitions for the service layers (implemented as C# interface classes). The implementation of the service interfaces will reside in the Server Layer Assembly. By decoupling the domain layer from the service assembly we can swap out different service implementation without affecting either the Domain Layer or the User Interface Layer. 2.1.3 Service Layer This is a Visual Studio class library project that compiles to a DLL called ODOT.<app name>.Service.dll. For ODOT web applications the Service Layer contains the transactional boundaries for the application and the data access logic (Create, Read, Update, and Delete logic). The Service Layer should be generated as its own .Net Assembly and it should provide an implementation of the service interfaces defined in the Domain Layer assembly. Most of the business logic of the application should be contains within the Domain entities