Skip to content

1. Introduction

The PDF for this document is available |HERE|.

The examples in this document are available |HERE|.

We want to write a .NET application that allows a user to simulate payroll calculations for the child care providers of the "Maison de la petite enfance" association in a municipality. We will focus as much on the organization of the application's code as on the code itself.

The final application, which we will call [SimuPaie], will have the following three-layer structure:

  • The [1-dao] layer (dao = Data Access Object) will handle data access. This data will be stored in a database.
  • The [2-métier] layer will handle the business logic of the application, specifically payroll calculation.
  • The [3-ui] layer (ui=User Interface) will handle the presentation of data to the user and the execution of user requests. We refer to the set of modules performing this function as [Application]. It serves as the user interface.
  • The three layers will be made independent through the use of interfaces. NET
  • The integration of the different layers will be handled by Spring IoC

The processing of a client request follows these steps:

  1. The client makes a request to the application.
  1. The application processes this request. To do this, it may need assistance from the [métier] layer, which itself may need the [dao] layer if data needs to be exchanged with the database. The application receives a response from the [métier] layer.
  2. Based on this response, it sends the appropriate view (= the response) to the client.

The interface presented to the user can take various forms:

  1. a console application: in this case, the view is a series of lines of text.
  2. a Windows GUI application: in this case, the view is a Windows window
  3. a web application: in this case, the view is a HTML page
  4. ...

We will write different versions of this application:

  1. a version ASPNET containing a single form and built with a single-layer architecture.
  2. a version identical to the previous one but with Ajax extensions
  3. a version ASP.NET based on a three-tier architecture where the data access layer is implemented using the NHibernate framework. It will still have the single form from version 1.
  4. a version 4 ASP.NET multi-view and single-page application with the three-tier architecture of version 3.
  5. the server part of a client/server application where the server is implemented by a web service based on the layered architecture of version 3.
  6. the client part of the previous client/server application, implemented by a ASP.NET layer.
  7. a multi-view and multi-page version 7 ASP.NET with the three-tier architecture of version 3.
  8. a multi-view and multi-page version 8 ASP.NET client of the version 5 web service.
  9. a version 9 ASP.NET multi-view and multi-page-page application with the three-tier architecture of version 3, where the data access layer is implemented using Spring classes that facilitate the use of the NHibernate framework.
  10. a version 10 implemented in FLEX and a client of the version 5 web service.

Prerequisites


In the [débutant-intermédiaire-avancé] series, this document is part of the [intermédiaire] section. Understanding it requires various prerequisites that can be found in some of the documents I have written:

  1. ASP.NET Programming [Web Development with ASP.NET 1.1 (2004)];
  2. C# 2008: [Learning C# Version 3.0 with the .NET Framework 3.5 (2008)]: classes, interfaces, inheritance, polymorphism
  3. [Spring IoC], available at URL [Spring IoC for .NET (2005)]. Presents the basics of Inversion of Control (IoC) or Dependency Injection (DI) in the Spring.Net [http://www.springframework.net] framework.
  4. [Construction d'une application web à trois couches avec Spring et VB.NET], available at URL [Building a Three-Tier Web Application with ASP.NET 2.0, C#, Spring.NET, and NHibernate (2010)]. This course presents a simplified web-based product purchasing application. Its three-tier architecture implements the MVC model.

Reading recommendations are sometimes provided at the beginning of paragraphs in this document. They refer to the preceding documents.


Tools


The tools used in this case study are freely available on the web. They are as follows:

  • Visual C# 2008, Visual Web Developer Express 2008, and SQL Server Express 2005, available at URL [http://www.microsoft.com/express/downloads/].
  • Spring IoC for instantiating the services required by the application, available at URL [http://www.springframework.net/] - see also [3]
  • NHibernate for the data access layer of SGBD [http://sourceforge.net/projects/nhibernate/]
  • NUnit: [http://www.nunit.org] for unit tests.